SA-MP Forums Archive
[HELP] Leveled skins? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Leveled skins? (/showthread.php?tid=450554)



[HELP] Leveled skins? - BatmanAndRobin - 13.07.2013

So how would I onely let a player who is say... level 2 use a certain skin?

For example, when you want to spawn as a level 2 skin,text would say "You are not level 2!"
and you would stay in the class selection screen. But if you are a level 2, then you can spawn as that skin.


Re: [HELP] Leveled skins? - Konstantinos - 13.07.2013

You charge money for projects, even large ones like your signature says but you do not know how to do a simple thing? I'm just saying..

Anyway, in OnPlayerRequestSpawn callback check if a player has the skin n and if the level is not the one you want return 0 to prevent the player from being spawned.


Re: [HELP] Leveled skins? - Mitchy - 13.07.2013

Something like this?:

pawn Код:
command(skin2, playerid, params[])
{
    if(Player[playerid][pLevel] == 2)
    {
        SendClientMessage(playerid, -1, "You are now equipped with a level 2 skin!");
        SetPlayerSkin(playerid, PUTSKINHERE);
    }
    else return SendClientMessage(playerid, -1, "You are not level 2!");
}
< I know it's a command, but hey..

Anyways, as _Zeus said, make a function on OnPlayerRequestSpawn. Not entirely sure on how to do that. Though the skin can be easily set via commands


Re: [HELP] Leveled skins? - random123 - 13.07.2013

Make an array,
PHP код:
new skins[] []=
{
     {
skinid,requiredlevel},
     {
0,3},
     {
1,4},
     {
2,5}//Note this will only work if you do all skins in the order they are in where you use AddPlayerClass
}
public 
OnPlayerRequestClass(playerid,classid)
{
    new 
level PlayerInfo[playerid][pLevel];
    if(
skins[classid][1] > level
    {
          new 
string[128];
          
format(string,sizeof(string),"You need to be at least level %d to use this skin",skins[classid][1]);
          
SendClientMessage(playerid,-1,string);
          return 
0;
        
    }
    return 
1;

this code is untested but that should give you a basic idea on how to do it.