sscanf bug again -
Tagathron - 22.10.2013
Sorry for posting this again,but i have a bug with sscanf.
The main thing is that i'm scripting a taxi driver job,and when i do the fare cmd,it's buggy.
So the first time i fixed this bug,but now it's kinda half fixed.
The problem is when i type "/fare" it sends "USAGE: /fare [PRICE]",also when i type "/fare [and some int here]" it also prints "USAGE: /fare [PRICE]".I'm not sure what causes this.
Code:
CMD:fare (playerid, params[])
{
new price;
new string[128];
new taxistName[MAX_PLAYER_NAME];
if (PlayerIsTaxiDriver[playerid]==1)
{
if (sscanf(params, "i", price)) return SendClientMessage(playerid, 0xFFF0F0, "USAGE : /fare [PRICE]");
GetPlayerName(playerid, taxistName, MAX_PLAYER_NAME);
format (string, sizeof(string), "Taxi driver %s is now on duty.Fare: %i .", taxistName,price);
SendClientMessageToAll(0xFFFFCC, string);
}
else if (PlayerIsTaxiDriver[playerid]==0)
{
SendClientMessage(playerid, CMD_ERROR, "You're not a taxi driver.");
}
return 1;
}
Re: sscanf bug again -
newbie scripter - 22.10.2013
is the function working? i mean whether " Taxi driver unknown is now on duty . fare: 10000000." shows?
Re: sscanf bug again -
Tagathron - 22.10.2013
I said above,that if you type /fare ,or /fare [price here] it prints same thing : "USAGE: /fare [PRICE]".
Code:
The problem is when i type "/fare" it sends "USAGE: /fare [PRICE]",also when i type "/fare [and some int here]" it also prints "USAGE: /fare [PRICE]"
Re: sscanf bug again -
PT - 22.10.2013
try
pawn Code:
CMD:fare (playerid, params[])
{
if(PlayerIsTaxiDriver[playerid] != 1) return SendClientMessage(playerid, CMD_ERROR, "You're not a taxi driver.");
new price;
if (sscanf(params, "d", price)) return SendClientMessage(playerid, 0xFFF0F0, "USAGE : /fare [PRICE]");
new string[100], taxistName[MAX_PLAYER_NAME];
GetPlayerName(playerid, taxistName, MAX_PLAYER_NAME);
format (string, sizeof(string), "Taxi driver %s is now on duty. Fare: %i .", taxistName, price);
SendClientMessageToAll(0xFFFFCC, string);
return 1;
}
Re: sscanf bug again -
Kyance - 22.10.2013
Im only guessing that you did something wrong with the brackets..
Well, i tried this, cause i havent got any classes/jobs w.e
pawn Code:
CMD:fare(playerid, params[])
{
new price;
new string[128];
new taxistName[MAX_PLAYER_NAME];
if (sscanf(params, "i", price)) return SendClientMessage(playerid, 0xFFF0F0, "USAGE : /fare [PRICE]");
GetPlayerName(playerid, taxistName, MAX_PLAYER_NAME);
format (string, sizeof(string), "Taxi driver %s is now on duty. Fare: %i.", taxistName,price);
SendClientMessageToAll(0xFFFFCC, string);
return 1;
}
And it worked perfectly.
Well, you can't type "500$" or something, you need to type 100, 6000 etc..
Re: sscanf bug again -
Tagathron - 22.10.2013
I will try that one Kyance.Not sure what do you mean wrong with brackets?
Re: sscanf bug again -
Tagathron - 22.10.2013
Same error from your code too?
Code looks normal to me,not sure why would there be bugs.
Re: sscanf bug again -
Tagathron - 22.10.2013
BUMP
Is this really a code error or might be something else?
I mean,i tested other codes,that other people made-and it's still the same bug.
That's not possible.
Re: sscanf bug again -
Threshold - 22.10.2013
Are you sure you're using the latest version of the sscanf plugin + include?
Re: sscanf bug again -
Tagathron - 22.10.2013
BenzoAMG,i'm not sure,i got .inc's and the plugin from some links at this forum,i'm not sure.
Is there any way i can get the latest ones?