pawn Код:
if(!strcmp(cmdtext,"/giveweed",true, 9))
{
if(!strlen(cmdtext[9])) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /giveweed [playerid]");
if(hasweed[playerid] <= 0) return SendClientMessage(playerid,0xFF0000AA,"You don't have any weed to give out!");
new giveid = strval(cmdtext[10]);
if(!IsPlayerConnected(giveid)) return SendClientMessage(playerid, 0xFF0000AA, "That player isnt connected");
new string[128], string2[128];
new adminname[MAX_PLAYER_NAME], bringname[MAX_PLAYER_NAME];
GetPlayerName(giveid, givename, sizeof(givename));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string,sizeof(string),">> You have given %s 1 unit of weed", givename);
SendClientMessage(playerid,0xFF8000FF, string);
format(string2,sizeof(string2),">> You have received 1 unit of weed from %s ", adminname);
SendClientMessage(giveid,0xFF8000FF, string2);
GivePlayerMoney(giveid,-1000);
GivePlayerMoney(playerid, 1000);
hasweed[giveid]++;
hasweed[playerid]--;
return 1;
}
I have made it so that the person who is receiving the weed gets -$1000 and the person selling/giving gets +$1000. Remove those lines if you want.
Not Tested
Also, if anyone is thinking, yes i know strtok and dcmd is faster and more efficient etc, so please don't go moaning about it. I'm not too familiar with this at the moment, so if you want, post the strtok/dcmd solution.