ZCMD - /setskin [PlayerID] [SkinID]
#1

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

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;
}
Reply
#2

Figure it your self
Click me to Learn
Reply
#3

pawn Код:
if(!IsPlayerAdmin(playerid)) return 0;
//It should be return 1;
if(!IsPlayerAdmin(playerid)) return 1;
/////......
if(skinid > 299 || skinid < 0) return 0;
//Same^ return 1;
if(skinid > 299 || skinid < 0) return 1;
Reply
#4

I still need help on this...
Reply
#5

Use the command in the link
Код:
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;
}
if(skinid == 153) return scm(blalbal), is a way to do it, otherwise use a simple stock or something, not authorizing usage of bad skins.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)