Question about ZCMD & SSCANF
#2

Made it quirckly, just look in both commands and try get their logic's by your self.

pawn Код:
CMD:givemoney(playerid,params[])
{
   new money,people;
   if(sscanf(params,"ud",people,money))return SendClientMessage(playerid,-1,#usage /givemoney [id] [amount]);
   if(!IsPlayerConnected(people)) return SendClientMessage(playerid,-1,#not connected);
   if(playerid == people) return SendClientMessage(playerid,-1,#you can't give money to yourself.);
   GivePlayerMoney(playerid,-money);
   GivePlayerMoney(people,money);
   return 1;
}
new keys[MAX_PLAYERS];
CMD:givekey(playerid,params[])
{
   new people,key;
   if(sscanf(params,"ud",people,keys))return SendClientMessage(playerid,-1,#usage /givekey [id]);
   if(!IsPlayerConnected(people)) return SendClientMessage(playerid,-1,#not connected);
   if(playerid == people) return SendClientMessage(playerid,-1,#you can't give the key to yourself.);
   keys[playerid]-=key;
   keys[people]+=key;
   return 1;
}
Reply


Messages In This Thread
Question about ZCMD & SSCANF - by ddnbb - 11.08.2012, 19:23
Re: Question about ZCMD & SSCANF - by leonardo1434 - 11.08.2012, 19:38
Re: Question about ZCMD & SSCANF - by ddnbb - 11.08.2012, 19:49
Re: Question about ZCMD & SSCANF - by leonardo1434 - 11.08.2012, 19:56
Re: Question about ZCMD & SSCANF - by FalconX - 11.08.2012, 19:56
Re: Question about ZCMD & SSCANF - by MeDaKewlDude - 11.08.2012, 20:04
Re: Question about ZCMD & SSCANF - by ddnbb - 11.08.2012, 20:29

Forum Jump:


Users browsing this thread: 2 Guest(s)