Some help ?
#1

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 ?
Reply
#2

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

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

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

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 !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)