CMD:pay(playerid, params[])
{
new id, money, log[128];
if(!ProxDetectorS(5.0, playerid, id)) return SendClientMessage(playerid, COLOR_BS,"[BS] {E6DFDF}You are too far away from that player");
else
{
3327 new payer[128] = GetName(playerid);
3328 new reciever[128] = GetName(id);
3329 if (payer == reciever)
{
SendClientMessage(playerid, COLOR_BS, "[BS] {E6DFDF}You cannot pay yourself...");
}
}
return 1;
}
C:\Documents and Settings\Vice\Desktop\NEW ROLEPLAY\gamemodes\RP.pwn(3327) : error 008: must be a constant expression; assumed zero C:\Documents and Settings\Vice\Desktop\NEW ROLEPLAY\gamemodes\RP.pwn(3328) : error 008: must be a constant expression; assumed zero C:\Documents and Settings\Vice\Desktop\NEW ROLEPLAY\gamemodes\RP.pwn(3329) : error 033: array must be indexed (variable "payer") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Errors.
|
A much simpler way to do this is just to see if the player's ID and the ID of the player that's being paid are the same.
|
|
I just want to make a coding where I prevent the player when he attempts to pay himself, because that's retarded. Any suggestions? :/
|
if(GetPlayerMoney(playerid) > money) SendClientMessage(playerid, -1,"You don't have that much money!");
else if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, -1, "That Player is not connected!");
else if(payer == playerid) SendClientMessage(playerid, -1, "You cannot pay yourself!");