How to do class limit? - 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: How to do class limit? (
/showthread.php?tid=88427)
How to do class limit? -
krawN - 26.07.2009
Hey, how could I make a class limit? For example, if there's more than 3 players in one team they can't select it and have to select another one.
Thanks.
Re: How to do class limit? -
James_Alex - 26.07.2009
use "for(new i = 0; i < MAX_PLAYERS; i ++)"
Re: How to do class limit? -
SpiderPork - 26.07.2009
Use variables.
Re: How to do class limit? -
krawN - 26.07.2009
I've tried a lot of things but it doesn't works, any help? I know I have to declare "MAX_PLAYERS" but don't know how.
Re: How to do class limit? -
James_Alex - 26.07.2009
try this
pawn Код:
// put this in the to of the script
new teamMembers[15];
// put this is OnGameModeInit
SetTimer("CheckTeams", 100, true);
// put this anywhere in the script
forward CheckTeams();
public CheckTeams()
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
teamMembers[gTeam[i]] += 1;
}
}
// then use this in your command
if(teamMembers[1] > 3) // the [1] is the team id
{
// bla bla bla...
}
Re: How to do class limit? -
gtalover12 - 26.07.2009
Quote:
Originally Posted by James_Alex(Coder)
try this
pawn Код:
// put this in the to of the script new teamMembers[15];
// put this is OnGameModeInit SetTimer("CheckTeams", 100, true);
// put this anywhere in the script forward CheckTeams(); public CheckTeams() { for(new i = 0; i < MAX_PLAYERS; i ++) { teamMembers[gTeam[i]] += 1; } }
// then use this in your command if(teamMembers[1] > 3) // the [1] is the team id { // bla bla bla... }

|
OH MY GOD?
100 Ms Timer + a MAX_PLAYER Loop? Bad shizzle..
Re: How to do class limit? -
john11johng - 22.08.2009
on the blahh blahh blahh bit is that where u put code to disable class. If so what is it
Re: How to do class limit? -
Mr_Finnigan - 22.08.2009
Quote:
Originally Posted by john11johng
on the blahh blahh blahh bit is that where u put code to disable class. If so what is it
|
You simply do some kind of text message saying,"team is full"
Re: How to do class limit? -
john11johng - 22.08.2009
Quote:
Originally Posted by Mr_FinnigaN
Quote:
Originally Posted by john11johng
on the blahh blahh blahh bit is that where u put code to disable class. If so what is it
|
You simply do some kind of text message saying,"team is full"
|
ok thanks. Sorry another question, but how would you insert the last bit into game. Wo