SA-MP Forums Archive
I need help with /pay [Simple errors]{ZCMD} - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need help with /pay [Simple errors]{ZCMD} (/showthread.php?tid=581057)



I need help with /pay [Simple errors]{ZCMD} - NotYoMama - 10.07.2015

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.



Re: I need help with /pay [Simple errors]{ZCMD} - NotYoMama - 10.07.2015

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


Re: I need help with /pay [Simple errors]{ZCMD} - SloProKiller - 10.07.2015

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.


Re: I need help with /pay [Simple errors]{ZCMD} - NotYoMama - 10.07.2015

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


Re: I need help with /pay [Simple errors]{ZCMD} - Michael B - 10.07.2015

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!");