Command to change skin -
Aram555 - 17.01.2010
How to make the such:
When I enter a command
/skin1
varies skin on ID skin 105
Re: Command to change skin -
Miguel - 17.01.2010
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[128], string[128], cmd[128], idx, skinid;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/changeskin", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR, "Usage: /changeskin [skinid]");
skinid = strval(tmp);
if(IsValidSkin(skinid) == 0) return SendClientMessage(playerid, COLOR, "Error: invalid skin ID!");
SetPlayerSkin(playerid, skinid);
format(string, sizeof(string), "You have successfully changed your skin to %d", skinid);
SendClientMessage(playerid, COLOR, string);
return 1;
}
return 0;
}
Copied from wiki...
Re: Command to change skin -
Kostas' - 25.09.2011
I got these errors:
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3741) : warning 217: loose indentation
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3741) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3744) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3747) : error 017: undefined symbol "IsValidSkin"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3753) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Should i #include <...> something for this?
Re: Command to change skin -
dice7 - 25.09.2011
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/changeskin", true, 11) == 0)
{
new string[128], skinid;
if(!cmdtext[11]) return SendClientMessage(playerid, COLOR, "Usage: /changeskin [skinid]");
skinid = strval(cmdtext[12]);
switch(skinid)
{
case 3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 268, 273, 289: { return SendClientMessage(playerid, COLOR, "Error: invalid skin ID!"); }
default:
{
SetPlayerSkin(playerid, skinid);
format(string, sizeof(string), "You have successfully changed your skin to %d", skinid);
SendClientMessage(playerid, COLOR, string);
}
}
return 1;
}
return 0;
}
Re: Command to change skin -
Kostas' - 25.09.2011
It's compile and the command works, but i have a warning
Re: Command to change skin -
MA_proking - 25.09.2011
pawn Код:
if(strcmp(cmd, "/myskin", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, red, "Usage: /myskin [skinid]");
return 1;
}
new skin;
skin = strval(tmp);
format(string, sizeof(string), "You change your skin to this skin ID: %d", skin);
SendClientMessage(playerid, COLOR_GREEN, string);
SetPlayerSkin(playerid, skin);
return 1;
}
This will work
Re: Command to change skin -
Kostas' - 25.09.2011
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4329) : error 017: undefined symbol "cmd"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4331) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4331) : error 017: undefined symbol "idx"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4332) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4334) : error 017: undefined symbol "red"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(433
: error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4339) : error 017: undefined symbol "string"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4339) : error 017: undefined symbol "string"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4339) : error 029: invalid expression, assumed zero
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Фб ЭггсбцЬ мпх\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(4339) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
10 Errors.
I must add something?
Re: Command to change skin -
Kingunit - 25.09.2011
This one need zcmd and sscanf:
pawn Код:
CMD:setskin(playerid, params[])
{
new level, id;
if(sscanf(params, "dd", id, level)) return SendClientMessage(playerid, WHITE, "{FF0000}USAGE:{FFFFFF} /setskin [playerid] [skin id]");
{
if(level > 299 || level < 1) return SendClientMessage(playerid, GREY, "Invalid skin ID!");
SetPlayerSkin(id, level);
}
return 1;
}
Re: Command to change skin -
Kostas' - 25.09.2011
Thank you, Kingunit!
It works fine!
Re: Command to change skin -
SantarioLeone - 26.09.2011
Right as LAs Venturas CNR said it doesnt detect invalid IDS and if someone set your skin as an invalid ID you'll crash. Try my ZCMD and sscanf setskin cmd
Also this works only for admins whos level is 4 but you can change that value to whatever you desire.
pawn Код:
CMD:setskin(playerid, params[])
{
new id, ammount, name[MAX_PLAYER_NAME], string[128];
if(!(PlayerInfo[playerid][pAdmin] >= 4)) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command");
else if(sscanf(params,"ui", id, ammount)) return SendClientMessage(playerid, COLOR_GREY,"[True:RP]: /setskin [playerid/partofname] [skinmodel]");
else if(ammount > 299 || ammount < 1) return SendClientMessage(playerid, COLOR_GREY,"Wrong Skin ID! Available ID's: 1-299");
else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
else
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string),"Your skin have been set to %i by admin %s", ammount, name);
SendClientMessage(id, COLOR_GREEN, string);
PlayerInfo[id][pSkin] = ammount;
SetPlayerSkin(id, PlayerInfo[id][pSkin]);
}
return 1;
}