Skins help
#10

Quote:
Originally Posted by caki
Посмотреть сообщение
This works it compile ok without errors. If you still have errors update your
#include <foreach>
#include <sscanf2>

Use search button to find them.

pawn Код:
CMD:setskin(playerid, params[])
{
     new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
     if(!IsPlayerAdmin(playerid)) return 0;
     if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, -1, "USAGE: /setskin [playerid] [skinid]");
     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
     GetPlayerName(id, targetname, MAX_PLAYER_NAME);
     if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player not connected!");
     SetPlayerSkin(id, skinid);
     format(string, 128, "RCON Admin %s(%d) has set your skinid to %i", name, playerid, skinid);
     SendClientMessage(id, -1, string);
     format(string, 128, "You set %s(%d) skin to skinid %i", targetname, id, skinid);
     SendClientMessage(playerid, -1, string);
     return 1;
}
I suggest you to add this line also in command before setting the skin because if he/she uses invalid skin id, players near them and they will get crashed.
pawn Код:
if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, 0xFF0000, "Invalid skin id. (Available skinid's 0-299)");
//0 is the minimum and 299 the max.
Added in the command. :
pawn Код:
CMD:setskin(playerid, params[])
{
     new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
     if(!IsPlayerAdmin(playerid)) return 0;
     if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, -1, "USAGE: /setskin [playerid] [skinid]");
     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
     GetPlayerName(id, targetname, MAX_PLAYER_NAME);
     if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player not connected!");
     if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, 0xFF0000, "Invalid skin id. (Available skinid's 0-299)");
     SetPlayerSkin(id, skinid);
     format(string, 128, "RCON Admin %s(%d) has set your skinid to %i", name, playerid, skinid);
     SendClientMessage(id, -1, string);
     format(string, 128, "You set %s(%d) skin to skinid %i", targetname, id, skinid);
     SendClientMessage(playerid, -1, string);
     return 1;
}
Credits to caki because it's his cmd, I just created the function to detect skin id.
Reply


Messages In This Thread
Skins help - by Mustafa6155 - 21.10.2012, 14:44
Re: Skins help - by caki - 21.10.2012, 14:54
Re: Skins help - by _Khaled_ - 21.10.2012, 14:54
Re: Skins help - by Mustafa6155 - 21.10.2012, 15:09
Re: Skins help - by caki - 21.10.2012, 15:19
Re: Skins help - by Mustafa6155 - 21.10.2012, 15:20
Re: Skins help - by Mustafa6155 - 21.10.2012, 15:27
Re: Skins help - by Mustafa6155 - 21.10.2012, 17:05
Re: Skins help - by caki - 22.10.2012, 14:40
Re: Skins help - by Lordzy - 22.10.2012, 14:51

Forum Jump:


Users browsing this thread: 1 Guest(s)