Help with class selection
#1

Hi,

I need help with this on class selection:

PHP код:
public OnPlayerRequestClass(playerid,classid)
{
    if(
pInfo[playerid][skin] > 0)
{
SetPlayerSkin(playerid,pInfo[playerid][skin]);

What I want this to do is, if the player has a skin saved, have that skin locked (cant choose any other skin), if player doesn't have skin saved, I want him to be able to select any skin. I tried multiple things, this above is my latest.
Reply
#2

So, you just want him not you get another skin, but you dont mind him changing class?
if yes, Use OnPlayerSpawn..
PHP код:
public OnPlayerSpawn(playerid)
{
if(
GetPlayerSkin(playerid)!=pInfo[playerid][Skin] && pInfo[playerid][skin]!= -1?)//if a player doesnt have custom skin, make the value -1, else New Player's Skin will be 0 and they will get CJ-Skin
{
SetPlayerSkin(playeridpInfo[playerid][Skin]);
}

Reply
#3

Quote:
Originally Posted by Mic_H
Посмотреть сообщение
So, you just want him not you get another skin, but you dont mind him changing class?
if yes, Use OnPlayerSpawn..
PHP код:
public OnPlayerSpawn(playerid)
{
if(
GetPlayerSkin(playerid)!=pInfo[playerid][Skin] && pInfo[playerid][skin]!= -1?)//if a player doesnt have custom skin, make the value -1, else New Player's Skin will be 0 and they will get CJ-Skin
{
SetPlayerSkin(playeridpInfo[playerid][Skin]);
}

That would never work because that way, the nonlock on there skin can be abused.
Reply
#4

try this one
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(pInfo[playerid][Skin])
    {
        if(pInfo[playerid][Skin]!=GetPlayerSkin(playerid))
        {
            SendClientMessage(playerid,-1,"Skin Locked / You already have a saved skin");
            return 0;
        }
    }
    return 1;
}
EDIT: make sure that his saved skin is not a CJ skin
Reply
#5

^
Not to be mean, but that will cause the player to be unable to spawn. You must put something this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(pInfo[playerid][Skin] > 0)
    {
        if(skinchange[playerid] == 0)
        {
            SetPlayerSkin(playerid,pInfo[playerid][Skin]);
            SpawnPlayer(playerid);
        }
        return 1;
    }
    return 1;
}
With the code I posted above, when the player gets to class selection, if the skin is greater than 0 (so that it cannot select an invalid skin id), it will set their skin, if they try to use the arrow keys, it will spawn them.
Reply
#6

as earlybird325 says
Quote:
Originally Posted by earlybird325
What I want this to do is, if the player has a skin saved, have that skin locked (cant choose any other skin), if player doesn't have skin saved, I want him to be able to select any skin. I tried multiple things, this above is my latest.
Reply
#7

Quote:
Originally Posted by Quickie
Посмотреть сообщение
as earlybird325 says
It makes more since since you quoted it , but eh, both ways should probably work.
Reply
#8

thx you both help, +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)