[BUG] Personalized SetVehicleNumberPlate
#1

Hello everyone,
I wanted to inform you that there is a bug in SetVehicleNumberPlate
This is my script to the custom SetVehicleNumberPlate
Код:
if(dialogid == 8 && response)
	{
	    if(strlen(inputtext) == 0) return SendClientMessage(playerid,COLOR_GREY,"|> You must enter a license plate!");
	    if(strlen(inputtext) > 5) return ShowPlayerDialog(playerid,8,DIALOG_STYLE_INPUT,"Enter the license plate!","Please enter your desired plate (5 characters max):", "Ok","Back");
	    new carid = GetPlayerVehicleID(playerid);
	    new string[16], string2[32];
		SetVehicleNumberPlate(carid, "%s", inputtext);
		format(string2, sizeof(string2), "|> New license plate: %s",inputtext);
		SendClientMessage(playerid,COLOR_YELLOW2,string2);
		SafeGivePlayerMoney(playerid,-100000);
		SBizzInfo[13][sbTill] += 100000;
		SBizzInfo[13][sbProducts]--;
		OnPropUpdate();
	}
When I go to try to put it on the plate is written % s help me know?
Sorry for my bad english im am italian
Reply
#2

Quote:
Originally Posted by alanhutch
Посмотреть сообщение
Hello everyone,
I wanted to inform you that there is a bug in SetVehicleNumberPlate
This is my script to the custom SetVehicleNumberPlate
Код:
if(dialogid == 8 && response)
	{
	    if(strlen(inputtext) == 0) return SendClientMessage(playerid,COLOR_GREY,"|> You must enter a license plate!");
	    if(strlen(inputtext) > 5) return ShowPlayerDialog(playerid,8,DIALOG_STYLE_INPUT,"Enter the license plate!","Please enter your desired plate (5 characters max):", "Ok","Back");
	    new carid = GetPlayerVehicleID(playerid);
	    new string[16], string2[32];
		SetVehicleNumberPlate(carid, "%s", inputtext);
		format(string2, sizeof(string2), "|> New license plate: %s",inputtext);
		SendClientMessage(playerid,COLOR_YELLOW2,string2);
		SafeGivePlayerMoney(playerid,-100000);
		SBizzInfo[13][sbTill] += 100000;
		SBizzInfo[13][sbProducts]--;
		OnPropUpdate();
	}
When I go to try to put it on the plate is written % s help me know?
Sorry for my bad english im am italian
Err, you're doin' it wrong:
Код:
SetVehicleNumberPlate(carid, inputtext);
And you don't need 2 strings..

How did you even compiled this?
Reply
#3

Quote:
Originally Posted by DVDK
Посмотреть сообщение
Err, you're doin' it wrong:
Код:
SetVehicleNumberPlate(carid, inputtext);
And you don't need 2 strings..

How did you even compiled this?
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Header size: 12676 bytes
Code size: 2276900 bytes
Data size: 22698968 bytes
Stack/heap size: 16384 bytes; estimated max. usage=4790 cells (19160 bytes)
Total requirements:25004928 bytes
Reply
#4

Thanks!! IS WORKS!!
Reply
#5

And for this?
Код:
SetVehicleNumberPlate(carid,"SF %d%d%d",rand1,rand2,rand3);
Reply
#6

Quote:
Originally Posted by alanhutch
Посмотреть сообщение
And for this?
Код:
SetVehicleNumberPlate(carid,"SF %d%d%d",rand1,rand2,rand3);
Like i said, PAWN doesn't work like that, use a format.
Reply
#7

Here're some guides for you:
1.Show "%" is possible, but you need to have it doubled in the "format" function, e.g.
Код:
format(string,sizeof(string),"AB %% %s",something);
shows:
Код:
AB % (string in the variable "something")
Also,
1.Your stack is overflowing. Reduce memory usge.
2.Check for wiki for the usage of the functions before asking questions.
3.Repeated posts(Not even a double, but triple), use edit function.
Reply
#8

This should be moved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)