Isnt there a faster way to do that`? - 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)
+--- Thread: Isnt there a faster way to do that`? (
/showthread.php?tid=382207)
Isnt there a faster way to do that`? -
CrazyChoco - 02.10.2012
Well Hello, i was currently starting a new Gamemode, but then i came to the part with gTeam, and i made like 53 classes for civil, and i want to know a faster way to do this cmd
pawn Код:
if(classid == 0)
{
gTeam[playerid] = TEAM_CIVIL;
}
i want the code above to make it like it will shows between 0 and 53 the player will be civil. If you didnt understand my explanation then just simply ask
Re: Isnt there a faster way to do that`? -
XtremeR - 02.10.2012
u can use it like:
pawn Код:
if(classid == 0 || classid == 1 ||classid == 2 ||classid == 3//and so on...)
{
gTeam[playerid] = TEAM_CIVIL;
}
Re: Isnt there a faster way to do that`? -
[XST]O_x - 02.10.2012
A loop.
pawn Код:
for(new i = 0; i < 53; i++)
{
if(classid == i)
{
gTeam[playerid] = TEAM_CIVIL;
}
}
Re: Isnt there a faster way to do that`? -
CrazyChoco - 02.10.2012
Yea but isnt the a faster way to do it ? I tried something like this code
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0 > 53) // The warning occured here
{
gTeam[playerid] = TEAM_CIVIL;
}
}
and got this warning
Quote:
warning 213: tag mismatch
|
EDIT: Thanks
Re: Isnt there a faster way to do that`? -
XtremeR - 02.10.2012
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
if(classid = 0 > 53)
{
gTeam[playerid] = TEAM_CIVIL;
}
}
should work now
Re: Isnt there a faster way to do that`? -
[XST]O_x - 02.10.2012
Quote:
Originally Posted by XtremeR
pawn Код:
SetPlayerTeamFromClass(playerid, classid) { if(classid = 0 > 53) { gTeam[playerid] = TEAM_CIVIL; } }
should work now
|
What?
You mean:
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
if(classid >= 0 && classid <= 53)
{
gTeam[playerid] = TEAM_CIVIL;
}
}
Re: Isnt there a faster way to do that`? -
CrazyChoco - 02.10.2012
I think he meaned, that one you posted at last

Because i tried the other one and it gave me error

But thanks !!!!
Re: Isnt there a faster way to do that`? -
RedFusion - 02.10.2012
pawn Код:
switch(classid)
{
case 0:gTeam[playerid] = TEAM_CIVIL;
}