Setskin cmd
#2

error came from:
PHP код:
// This line is for; if an admin uses the cmd inproperly like, /setskin [ID] 401, the admin will receive an message displayed, "Error: Available skinids 0 - 311".  I will explain the code,  if(skinid < 0 (means you're not allowed to use a skin below the 0. and the other part, skinid > 311 (basically means, you're not allowed to use a skin above 311. I hope you have learned the meanings of < > in school. 
because it very long line
try this one:
PHP код:
CMD:setskin(playeridparams[])
{
   new 
targetplayerskinid// targetplayer = (the player you want to set the skin of) skinid = (obviously the skin you want to set)
   
if(!IsPlayerAdmin(playerid)) return 0// You may choose if you whether wants this cmd to be used for rcon admins only or everyone, if you prefer for admins only, use this line.
   
{
   if(
sscanf(params"ui"targetplayerskinid)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /setskin [ID] [skinid]"); // this line is for; if you type /setskin, you will receive a message displayed with the "Usage" part.
   
if(skinid || skinid 311) return SendClientMessage(playeridCOLOR_RED"Error: Available skinids 0 - 311");
   
// This line is for; if an admin uses the cmd inproperly like, /setskin [ID] 401, the admin will receive an message displayed, "
   // Error: Available skinids 0 - 311".  I will explain the code,  if(skinid < 0 (means you're not allowed to use a skin below the 0. and the other part, skinid > 311 (basically means, you're not allowed to use a skin above 311. I hope you have learned the meanings of < > in school.
   
if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playeridCOLOR_RED"Error: Player is not connected!");
 
// this line means nothing less than detecting if the player is connected.
   
new string[150], pName[MAX_PLAYER_NAME]; // string[150] = just the characters of the format that will be used later. pName[MAX_PLAYER_NAME] = for detecting the player's name.
   
SetPlayerSkin(targetplayerskinid); // That's basically the code of the /setskin
   
format(stringsizeof string"Your skinid has been set by an admin to %i"skinid); // %i in the format is the skinid
   
SendClientMessage(targetplayerCOLOR_GREENstring); // Sending the player a message in GREEN, as you can see, and string means the string I have made in the format above.
   
GetPlayerName(targetplayerpNameMAX_PLAYER_NAME); // Detecting the player name.
   
format(stringsizeof string"You have set %s's skinid to %i"pNameskinid); // Yep you have noticed it good, the second format. This format will be sent to the ADMIN who gives the skinids to players.
   
SendClientMessage(playeridCOLOR_WHITEstring); // This message will be send to the Admin with a WHITE color.
   
}
   return 
1;
 } 
Reply


Messages In This Thread
Setskin cmd - by AndreiWow - 04.09.2015, 11:16
Re: Setskin cmd - by jlalt - 04.09.2015, 11:21
Re: Setskin cmd - by AndreiWow - 04.09.2015, 11:30
Re: Setskin cmd - by AndreiWow - 04.09.2015, 11:40
Re: Setskin cmd - by jlalt - 04.09.2015, 11:41
Re: Setskin cmd - by saffierr - 04.09.2015, 13:20
Re: Setskin cmd - by saffierr - 04.09.2015, 13:38
Re: Setskin cmd - by AndreiWow - 04.09.2015, 14:01
Re: Setskin cmd - by saffierr - 04.09.2015, 14:32

Forum Jump:


Users browsing this thread: 2 Guest(s)