Why this script doesnt work ? - 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)
+--- Thread: Why this script doesnt work ? (
/showthread.php?tid=462217)
Why this script doesnt work ? -
bustern - 05.09.2013
PHP Code:
CMD:vcolor(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return 0;
new color1, color2;
if(sscanf(params,"ui", color1, color2)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /vcolor [COLOR 1] [COLOR 2]");
ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
SendClientMessage(playerid,COLOR_BLUE,"Your car was resprayed");
return 1;
}
Re: Why this script doesnt work ? -
Pawnie - 05.09.2013
Try something like this
pawn Code:
CMD:vcolor(playerid,params[])
{
new color[2];
if(PlayerInfo[playerid][pAdmin] < 3)
{
if(sscanf(params,"ii",color[0],color[1])) return SendClientMessage(playerid,0xFFFFFFFF,"Use: /vcolor [color1] [color2]");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"You need to be in vehicle to use this command!");
ChangeVehicleColor(GetPlayerVehicleID(playerid),color[0],color[1]);
}
return 1;
}
The problem should be here
Code:
if(sscanf(params,"ui", color1, color2))
Change ui to ii
Re: Why this script doesnt work ? -
bustern - 05.09.2013
Works, thank you.
Re: Why this script doesnt work ? -
CaveDweller - 05.09.2013
I suggest you read the
specifiers section on the
sscanf thread.