getplayerskin help
#1

Hello,

I want to know how to i change players skin with GetPlayerSkin? i tried this:

if(GetPlayerSkin(294)) return SetPlayerSkin(playerid, 270);

basicly i want if the players skin id is 294 i want the server to change it to 270. help please?
Reply
#2

Quote:
Originally Posted by Proph3t
Посмотреть сообщение
Hello,

I want to know how to i change players skin with GetPlayerSkin? i tried this:

if(GetPlayerSkin(294)) return SetPlayerSkin(playerid, 270);

basicly i want if the players skin id is 294 i want the server to change it to 270. help please?
https://sampwiki.blast.hk/wiki/GetPlayerSkin

As you can see from there, it's expecting the players ID. So you can do something like;

pawn Код:
if(GetPlayerSkin(playerid) == 294) SetPlayerSkin(playerid, 270);
Reply
#3

Maybe this will work.

pawn Код:
new skin = GetPlayerSkin(playerid); // Put this on the TOP of the script.

// This under OnPlayerStateChange

if(skin == 294) // If the skin equals 294
{
    SetPlayerSkin(playerid, 270); // Sets the skin back to 270.
    SendClientMessage(playerid, YourColorID, "This skin is restricted."); // Text when changing skin to 270.
    return 1;
    }
}
Reply
#4

Quote:
Originally Posted by NL-Sultan
Посмотреть сообщение
Maybe this will work.

pawn Код:
new skin = GetPlayerSkin(playerid); // Put this on the TOP of the script.

// This under OnPlayerStateChange

if(skin == 294) // If the skin equals 294
{
    SetPlayerSkin(playerid, 270); // Sets the skin back to 270.
    SendClientMessage(playerid, YourColorID, "This skin is restricted.");
    return 1;
    }
}
You cannot add skin as a global variable like that, because playerid is undefined variable. Furthermore, OnPlayerStateChange has nothing to do with the skins, I'd recommend to check in OnPlayerSpawn if the skin id 294 and then set it to 270 as you wish!
Reply
#5

Hmm, what are you even trying to use this for? Are you trying to stop people from spawning as a certain class? Are you trying to make it so admins can't set their skin to certain IDs? Is it for an anti-cheat?
Reply
#6

No, i have a closed source script and i wanted to change the skin from a certain thing.

thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)