Help /setskin -
Linus- - 28.12.2010
Hey guys, i need help with this cmd /setskin
when i type '/setskin 0 23' its not changing my skin to 23 its shows 'Administrator Linus[0] has seted your skin to 20' not 23
and not changing mine skin to 23
pawn Код:
COMMAND:setskin(playerid, params[])
{
if(AccountInfo[playerid][aLevel] < 1) SendClientMessage(playerid, COLOR_RED, "AdminLevel 1 needed for this command!");
else
{
new ID, Index;
new tmp2[256]; tmp2 = strtok(params,Index);
new skin = strval(tmp2);
if(sscanf(params, "is", ID, skin)) SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /setskin [id] [skinid]");
else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_RED, "Player is not connected");
else
{
if(!IsValidSkin(skin)) return SendClientMessage(playerid, COLOR_YELLOW, "ERROR: Invaild Skin ID");
SetPlayerSkin(ID, skin);
new string[256], name[60], name2[60];
GetPlayerName(playerid, name, 60);
GetPlayerName(ID, name2, 60);
format(string, 256, "Administrator %s[%d] has set your skin to %d", name, playerid, skin);
SendClientMessage(ID, COLOR_YELLOW, string);
format(string, 256, "You have seted %s skin to %d", name2, skin);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
return 1;
}
Re: Help /setskin -
SAMPGammer - 28.12.2010
Quote:
Originally Posted by Linus-
Hey guys, i need help with this cmd /setskin
when i type '/setskin 0 23' its not changing my skin to 23 its shows 'Administrator Linus[0] has seted your skin to 20' not 23 help
pawn Код:
COMMAND:setskin(playerid, params[]) { if(AccountInfo[playerid][aLevel] < 1) SendClientMessage(playerid, COLOR_RED, "AdminLevel 1 needed for this command!"); else { new ID, Index; new tmp2[256]; tmp2 = strtok(params,Index); new skin = strval(tmp2); if(sscanf(params, "is", ID, skin)) SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /setskin [id] [skinid]"); else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_RED, "Player is not connected"); else { if(!IsValidSkin(skin)) return SendClientMessage(playerid, COLOR_YELLOW, "ERROR: Invaild Skin ID"); SetPlayerSkin(ID, skin); new string[256], name[60], name2[60]; GetPlayerName(playerid, name, 60); GetPlayerName(ID, name2, 60); format(string, 256, "Administrator %s[%d] has set your skin to %d", name, playerid, skin); SendClientMessage(ID, COLOR_YELLOW, string); format(string, 256, "You have seted %s skin to %d", name2, skin); SendClientMessage(playerid, COLOR_YELLOW, string); } } return 1; }
|
AFAIK 23 aren't valid skin.
Re: Help /setskin -
Linus- - 28.12.2010
Quote:
Originally Posted by SAMPGammer
AFAIK 23 aren't valid skin.
|
Its not only showing, its not changing mine skin to 23
.
(sorry for my bad english)
Re: Help /setskin -
JaTochNietDan - 28.12.2010
You are using sscanf to pass it as a string, it is not a string, it is an integer. I also recommend using the u parameter in sscanf, as it automatically converts name or integer to an ID.
pawn Код:
if(sscanf(params, "ud", ID, skin))
Re: Help /setskin -
Linus- - 28.12.2010
Quote:
Originally Posted by JaTochNietDan
You are using sscanf to pass it as a string, it is not a string, it is an integer. I also recommend using the u parameter in sscanf, as it automatically converts name or integer to an ID.
pawn Код:
if(sscanf(params, "ud", ID, skin))
|
Still doing this.
Re: Help /setskin -
JaTochNietDan - 28.12.2010
Also you could do with an overall improvement of code.
pawn Код:
COMMAND:setskin(playerid, params[])
{
if(AccountInfo[playerid][aLevel] < 1) SendClientMessage(playerid, COLOR_RED, "AdminLevel 1 needed for this command!");
else
{
new ID, skin;
if(sscanf(params, "ud", ID, skin)) SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /setskin [id] [skinid]");
else
{
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_YELLOW,"ERROR: Player not found");
if(!IsValidSkin(skin)) return SendClientMessage(playerid, COLOR_YELLOW, "ERROR: Invaild Skin ID");
SetPlayerSkin(ID, skin);
new string[128], name[24], name2[24];
GetPlayerName(playerid, name, 24);
GetPlayerName(ID, name2, 24);
format(string, 128, "Administrator %s[%d] has set your skin to %d", name, playerid, skin);
SendClientMessage(ID, COLOR_YELLOW, string);
format(string, 128, "You have seted %s skin to %d", name2, skin);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
return 1;
}
Re: Help /setskin -
Linus- - 28.12.2010
Quote:
Originally Posted by JaTochNietDan
Also you could do with an overall improvement of code.
pawn Код:
COMMAND:setskin(playerid, params[]) { if(AccountInfo[playerid][aLevel] < 1) SendClientMessage(playerid, COLOR_RED, "AdminLevel 1 needed for this command!"); else { new ID, skin; if(sscanf(params, "ud", ID, skin)) SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /setskin [id] [skinid]"); else { if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_YELLOW,"ERROR: Player not found"); if(!IsValidSkin(skin)) return SendClientMessage(playerid, COLOR_YELLOW, "ERROR: Invaild Skin ID"); SetPlayerSkin(ID, skin); new string[128], name[24], name2[24]; GetPlayerName(playerid, name, 24); GetPlayerName(ID, name2, 24); format(string, 128, "Administrator %s[%d] has set your skin to %d", name, playerid, skin); SendClientMessage(ID, COLOR_YELLOW, string); format(string, 128, "You have seted %s skin to %d", name2, skin); SendClientMessage(playerid, COLOR_YELLOW, string); } } return 1; }
|
still doing this
Re: Help /setskin -
JaTochNietDan - 28.12.2010
What's it doing? I don't understand.
Re: Help /setskin -
Linus- - 28.12.2010
Quote:
Originally Posted by JaTochNietDan
What's it doing? I don't understand.
|
When i type /setskin 0 23
'Administrator Linus[0] has seted your skin to 20' not 23 and not changing skin to 23 skin.
Re: Help /setskin -
JaTochNietDan - 28.12.2010
Are you sure you've actually copy and pasted the command that I gave you and checked it? Because it looks fine to me. There's no reason it should be doing that.