08.07.2012, 14:46
Greetings I got a problem here.
I've mixed together a /setskin command for administrators only, so basically what it does is. It changes only my skin. and when I do /setskin 22(which is a incorrect ID) 153 it doesn't show any error message as it should.
Also when I am the only on the server and do /setskin 0 124 then it changes my skin to CJ. but when I do /setskin 124 it changes my skin.
Also, the ' if(!IsPlayerAdmin(playerid)) return 0; ' does not work here as it should. I do not need to be logged in as an administrator to change my skin which is very annoying.
here's the code
I've mixed together a /setskin command for administrators only, so basically what it does is. It changes only my skin. and when I do /setskin 22(which is a incorrect ID) 153 it doesn't show any error message as it should.
Also when I am the only on the server and do /setskin 0 124 then it changes my skin to CJ. but when I do /setskin 124 it changes my skin.
Also, the ' if(!IsPlayerAdmin(playerid)) return 0; ' does not work here as it should. I do not need to be logged in as an administrator to change my skin which is very annoying.
here's the code
pawn Код:
// ADMIN COMMNAD: setskin [PlayerID] [SkinID] //
COMMAND: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, COLOR_WHITE, "Correct usage: /setskin [PlayerID] [SkinID]");
if(skinid > 299 || skinid < 0) return 0;
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
GetPlayerName(id, targetname, MAX_PLAYER_NAME);
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: {ffffff}Invalid player ID.");
SetPlayerSkin(id, skinid);
format(string, 128, "Administrator: %s(%d) changed your skin to skin ID: %i", name, playerid, skinid);
SendClientMessage(id, COLOR_LOCAL, string);
format(string, 128, "You've set %s(%d) skin to skin ID: %i", targetname, id, skinid);
SendClientMessage(playerid, COLOR_LOCAL, string);
return 1;
}