SA-MP Forums Archive
Some help ? - 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: Some help ? (/showthread.php?tid=592779)



Some help ? - SpikeSpigel - 29.10.2015

PHP код:
CMD:pay(playeridparams[])
{
    new 
idamountpName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], string[126];
    
GetPlayerName(playeridpNamesizeof(pName));
      
GetPlayerName(playeridpName2sizeof(pName2));
        
    if(
sscanf(params"ud"idamount))
    {
        if(
Player[playerid][Money] >= amount)
        {
            
Player[playerid][Money] -= amount;
            
Player[id][Money] += amount;
        
            
format(stringsizeof(string), "%s i-a dat lui %s $%d"pNamepName2amount);
            
ProxDetector(30playeridstringcolor_purplecolor_purplecolor_purplecolor_purplecolor_purple);
        }
    }
    return 
1;

I can't figure out how to repair this, can someone explain me and help me a bit ?


Re: Some help ? - Private200 - 29.10.2015

How can we help you if we don't know what the problem is?


Re: Some help ? - SpikeSpigel - 30.10.2015

Oh, sorry. You cant give more then 100$ and it gives the money to u, no matter who I put .


Re: Some help ? - iKarim - 30.10.2015

PHP код:
CMD:pay(playeridparams[])
{
    new 
idamountpName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], string[126];

    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(idpName2sizeof(pName2));
        
    if(
sscanf(params"ud"idamount))
    {
        if(
Player[playerid][Money] >= amount)
        {
            
Player[playerid][Money] -= amount;
            
Player[id][Money] += amount;
        
            
format(stringsizeof(string), "%s i-a dat lui %s $%d"pNamepName2amount);
            
ProxDetector(30playeridstringcolor_purplecolor_purplecolor_purplecolor_purplecolor_purple);
        }
    }
    return 
1;

Not sure if this is the problem but, Try it.


Re: Some help ? - PrO.GameR - 30.10.2015

sscanf returns 0 on success, therefore this:

if(sscanf(params, "ud", id, amount))
should be

if(!sscanf(params, "ud", id, amount))

the line you wrote means: "check to see if params doesn't have parameters ID and amount."


@PawnHunter: if you can't see whats wrong, it's simple not to answer bro, indentation doesn't make code work wrong !