Help with class selection -
earlybird325 - 15.12.2014
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.
Re: Help with class selection -
Mic_H - 16.12.2014
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(playerid, pInfo[playerid][Skin]);
}
}
Re: Help with class selection -
earlybird325 - 16.12.2014
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(playerid, pInfo[playerid][Skin]);
}
}
|
That would never work because that way, the nonlock on there skin can be abused.
Re: Help with class selection -
Quickie - 16.12.2014
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
Re: Help with class selection -
Banana_Ghost - 16.12.2014
^
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.
Re: Help with class selection -
Quickie - 16.12.2014
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.
|
Re: Help with class selection -
Banana_Ghost - 16.12.2014
Quote:
Originally Posted by Quickie
as earlybird325 says
|
It makes more since since you quoted it
, but eh, both ways should probably work.
Re: Help with class selection -
earlybird325 - 16.12.2014
thx you both help, +rep