26.07.2013, 19:23
if you're using ZCMD
(this should work, sorry I was late, I'm on phone)
Edit:That's how it works, (it's a base) any additional depends on you
pawn Код:
CMD:givecash(playerid, params[])//if you are using ZCMD > credits to zeex....
{
//first we are creating some variables that will help us much
new Target, value;//we've created the target who will be givn the money and the value (how much they will take)
if(sscanf(params, "ds", Target, value)) return SendClientMessage(playerid, -1, "SYNTAX: /givecash [playerid] [ammount]");
//now, we've used sscanf to detect if the player has entered wrong syntax
// d > Target
//s > value
// -1 > color white.
GivePlayerMoney(playerid, -value);//we put the "-" to reduce the value from his money
GivePlayerMoney(Target, value);//now we are giving that value to the target
//we've done the transfer
//Additional, let's put some messages (by format)
new str[50];//added a new variable (string)
format(str, sizeof(str), "ID(%d) has given you $%d",playerid, value);
SendClientMessage(playerid, -1, str);
//read about formats , it's easy :D
return 1;
}
Edit:That's how it works, (it's a base) any additional depends on you