SA-MP Forums Archive
[BUG] Personalized SetVehicleNumberPlate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [BUG] Personalized SetVehicleNumberPlate (/showthread.php?tid=201786)



[BUG] Personalized SetVehicleNumberPlate - alanhutch - 22.12.2010

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


Re: [BUG] Personalized SetVehicleNumberPlate - DVDK - 22.12.2010

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?


Re: [BUG] Personalized SetVehicleNumberPlate - alanhutch - 22.12.2010

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


Re: [BUG] Personalized SetVehicleNumberPlate - alanhutch - 22.12.2010

Thanks!! IS WORKS!!


Re: [BUG] Personalized SetVehicleNumberPlate - alanhutch - 22.12.2010

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



Re: [BUG] Personalized SetVehicleNumberPlate - DVDK - 22.12.2010

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.


Re: [BUG] Personalized SetVehicleNumberPlate - leong124 - 22.12.2010

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.


Re: [BUG] Personalized SetVehicleNumberPlate - Austin - 23.12.2010

This should be moved.