Command Error - 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: Command Error (
/showthread.php?tid=225571)
Command Error -
Rock18 - 13.02.2011
Hey , today i've made a new command ussing zcmd and sscanf
Код:
COMMAND:skin(playerid , params[ ] )
{
new skin[128];
if(sscanf(params,"d", skin)) return SendClientMessage(playerid,COLOR_WHITE,"Folosire: /skin <id>");
SetPlayerSkin(playerid,strval(skin));
return 1;
}
The command work but when i go in game and type ex : /skin 29 it doesn't change my skin to that id , it change to id 0 whatever id i put and i can't figure out what's the problem ....
Re: Command Error -
JaTochNietDan - 13.02.2011
The problem is that your code doesn't make a lot of sense! The "skin" variable should be an integer in the first place, then you're telling sscanf to look for an integer and store it in a string!
So this is an example with the problems I outlined fixed:
pawn Код:
COMMAND:skin(playerid , params[ ] )
{
new skin;
if(sscanf(params,"d", skin)) return SendClientMessage(playerid,COLOR_WHITE,"Folosire: /skin <id>");
SetPlayerSkin(playerid,skin);
return 1;
}