Team BlueWater Game Online Tutorial's
Bine ati venit la Team-BlueWater!!Tutorial's 4 all Games!

/post Source Code

View previous topic View next topic Go down

/post Source Code

Post  m4s4cru on Tue Aug 02, 2011 11:49 am

Code:
void DataSendAll(unsigned char* Packet, int Length)
{
  for (int i=6400; i<7400; i++)
      if(gObjIsConnected(i))
        DataSend(i, Packet, Length);
}

void SendPost(int wId, LPCSTR Command, LPCSTR Text)
{
  if (!IsPost) return;
  if (!gObjIsConnected(wId)) return;
  if (!strcmpi(Command, "/Post"))
  {
      MessageOutput(wId, "[%s] Useage: /Post <Msg>.", szPrefix);
      MessageOutput(wId, "[%s] Price for post: %d, Minimun Level: %d", szPrefix, PostCost, PostLevel);
      return;
  }
  gObj_SetInfo(wId);
  if (gObj.Level < PostLevel)
  {
      MessageOutput(wId, "[%s] You're level is too low to post!", szPrefix);
      return;
  }
  if (gObj.Money < PostCost)
  {
      MessageOutput(wId, "[%s] You don't have enough money to post!", szPrefix);
      return;
  }
  BYTE *Packet;
  char Message[100];
  Packet = (BYTE*) malloc(200);
  memset(Packet, 0x00, 200);
  *Packet = 0xC1;
  *(Packet+2) = 0x00;
  memcpy((Packet+3), gObj.Nick, strlen(gObj.Nick));
  sprintf(Message, "@@[Global] %s", Text);
  memcpy((Packet+13), Message, strlen(Message));
  int Len = (strlen(Message) + 0x13);
  *(Packet+1) = Len;
  DataSendAll(Packet, Len);
  int Amount = (gObj.Money - PostCost);
  gObj_Write(wId, gObj_Money, Amount);
  MoneySend(wId, Amount);
  free (Packet);
}
avatar
m4s4cru
Admin
Admin

Mesaje : 172
Data de inscriere : 2011-07-29
Varsta : 26

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum