21.10.2013, 17:44
(
Последний раз редактировалось Tagathron; 21.10.2013 в 18:37.
)
I was scripting taxi job,and when i got to the /fare command part,i get bugs from sscanf.
There aren't compile errors/warnings just this bug.
So i used sscanf to print Driver [PLAYER NAME HERE] is now on duty.Fare [PRICE HE TYPED AFTER "/fare"] .
The bug is next:
-when i don't enter anything after fare it's supposed to print "USAGE: ..." but it prints that and
[MY NAME IG] is now on duty.Fare 0.
Prints the same thing when i type "/fare [SOME INTEGER HERE].
I checked multiple forums,and tested other peoples codes(which are like my one) and those codes also have bugs.
Here is the code:
Thanks in advance,i would really like to know how to solve this.
There aren't compile errors/warnings just this bug.
So i used sscanf to print Driver [PLAYER NAME HERE] is now on duty.Fare [PRICE HE TYPED AFTER "/fare"] .
The bug is next:
-when i don't enter anything after fare it's supposed to print "USAGE: ..." but it prints that and
[MY NAME IG] is now on duty.Fare 0.
Prints the same thing when i type "/fare [SOME INTEGER HERE].
I checked multiple forums,and tested other peoples codes(which are like my one) and those codes also have bugs.
Here is the code:
Код:
CMD:fare (playerid, params[]) { new price; new string[128]; new taxistName[MAX_PLAYER_NAME]; if (sscanf(params, "i", price)) 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; }