Some help ? -
SpikeSpigel - 29.10.2015
PHP код:
CMD:pay(playerid, params[])
{
new id, amount, pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], string[126];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(playerid, pName2, sizeof(pName2));
if(sscanf(params, "ud", id, amount))
{
if(Player[playerid][Money] >= amount)
{
Player[playerid][Money] -= amount;
Player[id][Money] += amount;
format(string, sizeof(string), "%s i-a dat lui %s $%d", pName, pName2, amount);
ProxDetector(30, playerid, string, color_purple, color_purple, color_purple, color_purple, color_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(playerid, params[])
{
new id, amount, pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], string[126];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(id, pName2, sizeof(pName2));
if(sscanf(params, "ud", id, amount))
{
if(Player[playerid][Money] >= amount)
{
Player[playerid][Money] -= amount;
Player[id][Money] += amount;
format(string, sizeof(string), "%s i-a dat lui %s $%d", pName, pName2, amount);
ProxDetector(30, playerid, string, color_purple, color_purple, color_purple, color_purple, color_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 !