Class Limit
#1

i would like to make it so say if there are 5 players on my server but only 2 players can join as police ?

but the more players the more police can join etc ? and how to add class score limit

so if you want to join police u have to have say 50 score or it dont let you join and send message u cant join

i use class selections like:
pawn Код:
AddPlayerClassEx(1, 280,2296.7986,2450.9976,10.8203,94.1213,3,0,29,2000,31,500); //Team ID 1 == Police
and the team is id 1 and skin 280
Reply
#2

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            if(GetPlayerScore(playerid) < 50)
            {
                //Your code here...
                return 0;
            }
        }
        //Add more cases... depending on the order of the AddPlayerClasses.
    }
    return 1;
}
Reply
#3

so like this will work ? i no its not right whatsoever but that was off top of my head , and how i stop them spawning if there is to many police already on server
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            if(GetPlayerScore(playerid) < 50)
            {
                ifplayerclass 1 GameTextForPlayer u cant join ur score is to les
                return 0;
            }
        }
        //Add more cases... depending on the order of the AddPlayerClasses.
    }
    return 1;
}
Reply
#4

You don't need to check again the player class, just do what you want to show, maybe a gametext.
Oh and sorry classid is used to check the class ID(skin ID), not the order as I said above, got confused.
Reply
#5

i dont get it im easily confused ill have a look into it.
Reply
#6

Let me explain it for you:
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 0://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!
            {
                //Your code here...
                return 0;
            }
        }
        //Add more cases... depending on the order of the AddPlayerClasses.
    }
    return 1;
}
If you need any further explanation please say!
Reply
#7

i dont use class id i dont think i was told i use teams
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)