PLEASE HELP ME WITH....
#1

Please help me im trynna make it so u can only sell a materials with this code shown below
how do i make it so u cant sell more then wat u got..

if(strcmp(cmd, "/sella", true) == 0)
{
if (PlayerInfo[playerid][pJob] != 9)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /sella [playerid/PartOfName] [amount]");
return 1;
}
//giveplayerid = strval(tmp);
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /sella [playerid/PartOfName] [amount]");
return 1;
}
new playa;
GetPlayerName(playa, sendername, sizeof(sendername));
playa = ReturnUser(tmp);
moneys = strval(tmp);
PlayerInfo[giveplayerid][pMatsA] = moneys;
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "[ADMIN] %s has given %s %d materials.", sendername,giveplayer,moneys);
ABroadCast(COLOR_YELLOW,string,1);
}
}
return 1;
}
Reply
#2

pawn Код:
if(strcmp(cmd, "/sella", true) == 0)
  {
   if (PlayerInfo[playerid][pJob] != 9)
   {
     if(IsPlayerConnected(playerid))
     {
      tmp = strtok(cmdtext, idx);
      if(!strlen(tmp))
      {
        SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /sella [playerid/PartOfName] [amount]");
        return 1;
      }
      giveplayerid = ReturnUser(tmp);
      tmp = strtok(cmdtext, idx);
      if(!strlen(tmp))
      {
        SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /sella [playerid/PartOfName] [amount]");
        return 1;
      }
      moneys = strval(tmp);
      if(moneys > PlayerInfo[playerid][pMatsA]) { SendClientMessage(playerid, 0xAA3333AA, "You don't have that much!"); return 1; }
      PlayerInfo[giveplayerid][pMatsA] += moneys;
      PlayerInfo[playerid][pMatsA] -= moneys;
      GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
      GetPlayerName(playerid, sendername, sizeof(sendername));
      format(string, 256, "[ADMIN] %s has given %s %d materials.", sendername,giveplayer,moneys);
      ABroadCast(COLOR_YELLOW,string,1);
     }
   }
   return 1;
  }

It should work, untested...

It will add the amount to the giveplayerid and it will remove the amount to the playerid
Reply
#3

okay it compiled lets c if ot work on my server btw drop by

ill give you a little present
91.204.210.14:1111
91.204.210.14:1111
91.204.210.14:1111
91.204.210.14:1111
Reply
#4

don't worry, i do this for nothing in reward
Reply
#5

hey it don work in game
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)