View Full Version : /pay help

01/01/2012, 08:27 AM
hey, can somone help me with this, im so confused, i go in game type /pay to my id just to test it but it just pays 0 to me as the id i am

if (strcmp("/pay", cmd, true) == 0)
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pay [player id][amount]");
new playeree = strval(tmp);
new playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
GetPlayerName(playeree, playername, MAX_PLAYER_NAME);
GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
if(!IsPlayerConnected(playeree)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected.");

new tmp2[128];
new ammount = strval(tmp2);
if(ammount >= 0 && ammount <= 99999999)

if(GetPlayerMoney(playerid) < ammount) return SendClientMessage(playerid, COLOR_ROYALBLUE, "You don't have enough cash.");

new Float:x, Float:y, Float:z;

GetPlayerPos(playeree, x, y, z);

if(IsPlayerInRangeOfPoint(playerid, 30, x, y, z))
format(string, sizeof(string), "%s Has Payed You $%i",adminname, ammount);
SendClientMessage(playeree, COLOR_RED, string);
format(string, sizeof(string), "You Have Payed %s $%i", playername, ammount);
SendClientMessage(playerid, COLOR_RED, string);
GivePlayerMoney(playeree, ammount);

for(new i = 0; i < MAX_PLAYERS; i++)

if(IsPlayerInRangeOfPoint(i, 30, x, y, z))
format(string, sizeof(string), "%s has give some cash to %s", adminname, playername);
SendClientMessage(i ,COLOR_PINK, string);

return 1;

01/01/2012, 08:44 AM
Try testing it with other players, its kinda stupid doing it to yourself
(PM me IP now and i'll help you test )

01/01/2012, 10:06 AM
still need help with this

01/01/2012, 10:54 AM
Why dont you use ZCMD, which is more easier to use and a faster command processor.

01/01/2012, 10:56 AM
cause i dont wanna have to relearn all the functions and this is fast enogh for what i use

01/01/2012, 11:16 PM

01/01/2012, 11:29 PM
Change this
GivePlayerMoney(playeree, ammount);
to this
GivePlayerMoney(playerid, ammount);

01/01/2012, 11:31 PM
umm im not trying to pay myself, my money needs to go to my target id

01/01/2012, 11:32 PM
Just test it if it works.

01/01/2012, 11:37 PM
it wont work, i dont even need to compile it, cause paying my self wont work

02/01/2012, 03:01 AM