limit class selection
#1

hi all

i would like to no how to make it that you have to have 50 score to become a police officer, and that if say 10 people are on game that 2 out of 10 can be police , and like 20 players 5 can be police etc.

any help ?

explain easy for me )

+rep for anyone who helps

pawn Код:
i use class selection like AddPlayerClassEx(1, skin ,x,y,z
Reply
#2

https://sampwiki.blast.hk/wiki/How_to_pa..._protect_skins

Take a look at that. It's the same sort of idea but you will check if the players score is sufficient enough then use the lock variable and set it to 0. Same thing applies to the team balancer.
Reply
#3

i dont get that i dont want it to be locked, i want it so player must have 50 score, i noi can put in getplayerscore but there must be easier way to do it.
+rep for you
Reply
#4

50 score?
Код:
if(GetPlayerScore(playerid) > 300)
{
	// AddClass ...
}
Reply
#5

i have done it like this i dont no if that will work

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
  switch(classid)//Switching the class ID. You could simply do if statements, such as if(classid == 250) ..., but switch is a faster and more efficient way of doing that in this case.
    {
        case 1://You would do if(classid == 0) here if you use simple if statements. So this one corresponds to if(classid == 0) and so will do other cases you add.
        {
            if(GetPlayerScore(playerid) < 50)//From now on, all is clear I guess!
            {
                GameTextForPlayer(playerid, "~r~You Need at least 50 score~n~to join", 5000, 6);
                return 0;
            }
        }
        //Add more cases... depending on the order of the AddPlayerClasses.
    }

    switch(GetPlayerTeam(playerid))
    {
        //Usage: "case [Team id]: GameTextForPlayer(playerid, "[Class name]", 6000, 1);
        case 1: GameTextForPlayer(playerid, "~b~POLICE", 5000, 6); //Shows a text with the class name
        case 2: GameTextForPlayer(playerid, "~y~~h~TRUCKER", 5000, 6);
        case 3: GameTextForPlayer(playerid, "~g~~h~~h~MECHANIC", 5000, 6);
        case 4: GameTextForPlayer(playerid, "~y~BUS DRIVER", 5000, 6);
        case 5: GameTextForPlayer(playerid, "~p~~h~CABBIE", 5000, 6);
        case 6: GameTextForPlayer(playerid, "~p~MAFIA",5000, 6);
       
        }
   
    SetupPlayerForClassSelection(playerid);
    return 1;
}
Reply
#6

just tested what i had above and it doesnt work
Reply
#7

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
50 score?
Код:
if(GetPlayerScore(playerid) > 300)
{
	// AddClass ...
}
where to add that ?
Reply
#8

pawn Код:
// Game mode init ( This will be for police and gangs, you can change )
AddPlayerClass(280,1579.0623,-1636.2430,13.5601,92.9449,24,500,32,800,31,1000);//p1
AddPlayerClass(286,1579.0623,-1636.2430,13.5601,92.9449,24,500,32,800,31,1000);//p2
AddPlayerClass(285,1579.0623,-1636.2430,13.5601,92.9449,24,500,32,800,31,1000);//p3
AddPlayerClass(165,1579.0623,-1636.2430,13.5601,92.9449,24,500,32,800,31,1000);// p4
AddPlayerClass(120,1130.2954,-2037.3755,69.0078,269.8708,30,1000,25,200,28,800); // g5
AddPlayerClass(104,1130.2954,-2037.3755,69.0078,269.8708,30,1000,25,200,28,800); // g6
AddPlayerClass(107,1130.2954,-2037.3755,69.0078,269.8708,30,1000,25,200,28,800); // g7
AddPlayerClass(248,1130.2954,-2037.3755,69.0078,269.8708,30,1000,25,200,28,800); // g8

// Request class
public OnPlayerRequestClass(playerid, classid)
{
    if (classid == 0||classid == 1||classid == 2||classid == 3) {
        GameTextForPlayer(playerid,"~bl~Police",2000,3);
    }
    if (classid == 4||classid == 5||classid == 6||classid == 7) {
        GameTextForPlayer(playerid,"~g~Gangs",2000,3);
   }
return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)