I need help with /pay [Simple errors]{ZCMD}
#1

Here's my pay command. It's not the full command, but to make it simple: (It's still the same without the rest)

pawn Код:
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.
Reply
#2

I just want to make a coding where I prevent the player when he attempts to pay himself, because that's retarded. Any suggestions? :/
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by SloProKiller
Посмотреть сообщение
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.
Oh, wow, thanks friend. PLUS REP FOR YA!


Archive this thread
Reply
#5

Quote:
Originally Posted by NotYoMama
Посмотреть сообщение
I just want to make a coding where I prevent the player when he attempts to pay himself, because that's retarded. Any suggestions? :/
Add these conditions:

PHP код:
if(GetPlayerMoney(playerid) > moneySendClientMessage(playerid, -1,"You don't have that much money!");
    else if(!
IsPlayerConnected(otherid)) SendClientMessage(playerid, -1"That Player is not connected!");
    else if(
payer == playeridSendClientMessage(playerid, -1"You cannot pay yourself!"); 
Reply


Forum Jump:


Users browsing this thread: