whats this called? - 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: whats this called? (
/showthread.php?tid=183815)
whats this called? -
Rocky Balboa - 16.10.2010
hmm i made a vaariable like class[max_players] for teams ..
ok i want to get their teams,.. now how do i find that when noone is in team 2 ? i could do it like this ..
pawn Код:
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
else if(class[i] != 2)
{
//blah
}
}
}
i tried taht but it didnt work .. what if i use this .. if(class[max_players] for all the players ... but that will tell me taht it is out of bounds , and what if i use if(class[499] != 2 )? will this work ?
Re: whats this called? -
JaTochNietDan - 16.10.2010
pawn Код:
new count = 0;
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(class[i] != 2) // You can't have an else if statement on it's own, or an else statement for that matter
{
//blah
}
else count++; // You could do an else here, after a previous if statement, counting people in team 2
}
}
// Now if count = 0 nobody is in team 2
Hope that helps.
Re: whats this called? -
Rocky Balboa - 16.10.2010
Yea,that might help, but i used the [499] lol, it worked..
Re: whats this called? -
JaTochNietDan - 16.10.2010
Quote:
Originally Posted by Rocky Balboa
Yea,that might help, but i used the [499] lol, it worked..
|
Well then you'd be checking the class of playerid 499 only! If that's what you want, there's no need for a loop at all. You would just make a single if statement
Re: whats this called? -
Rocky Balboa - 24.10.2010
well i am using a timer for this funciton , but the timer goes crazy ...and spams shit..