Command Error
#1

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 ....
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)