SA-MP Forums Archive
Locking a class... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Locking a class... (/showthread.php?tid=100329)



Locking a class... - Puzi - 04.10.2009

Hello there,

I would like to know how to lock a class and make it for only certain people, If you know what I mean, so like for the chosen names. For example I am making a truck company and I would like to make it only for some people. Is it possible? If yes, how?

Thanks and Regards
Puzi


Re: Locking a class... - ferriswheel - 04.10.2009

I do not believe the inbuilt class system allows for "locking" of a class, but you could simply check the players skin in the "OnPlayerRequestSpawn" callback and return zero if the player is not allowed to use that skin.


Re: Locking a class... - Puzi - 04.10.2009

Quote:
Originally Posted by ferriswheel
I do not believe the inbuilt class system allows for "locking" of a class, but you could simply check the players skin in the "OnPlayerRequestSpawn" callback and return zero if the player is not allowed to use that skin.
Well, that would lock all players I guess from choosing the skin, am I correct?
I want it only for certain people, like after their names, for example I (Puzi) would be allowed to choose the skin, but Player would not, if you get what I mean


Re: Locking a class... - ferriswheel - 04.10.2009

You would have to setup some sort of account system, checking the name would mean anyone could set their name to "Puzi" and then join the server and select any class. Do a search on the forums for a registration system or admin system if you are unable to script your own.


Re: Locking a class... - MadeMan - 04.10.2009

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    if(GetPlayerSkin(playerid) == YOUR_SKIN_ID_HERE && strcmp(playername, "Puzi") != 0) // replace YOUR_SKIN_ID_HERE
    {
      return 0;
    }
    return 1;
}



Re: Locking a class... - Puzi - 04.10.2009

Doesn't work I'm afraid.


Re: Locking a class... - ferriswheel - 04.10.2009

Please explain, what happens that makes it "not work"?


Re: Locking a class... - Puzi - 04.10.2009

YOUR_SKIN_ID_HERE
Does that mean entering the Class ID like 0 or Skin ID which would be on Class 0 76? I think that's wrong...

When I choose the Class 0, it just spawns with even I have a different nick.


Re: Locking a class... - ferriswheel - 04.10.2009

It means the skin id, 0 being CJ.