Isnt there a faster way to do that`?
#1

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
Reply
#2

u can use it like:
pawn Код:
if(classid == 0 || classid == 1 ||classid == 2 ||classid == 3//and so on...)
    {
        gTeam[playerid] = TEAM_CIVIL;
    }
Reply
#3

A loop.
pawn Код:
for(new i = 0; i < 53; i++)
{
    if(classid == i)
    {
        gTeam[playerid] = TEAM_CIVIL;
    }
}
Reply
#4

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
Reply
#5

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid = 0 > 53)
    {
        gTeam[playerid] = TEAM_CIVIL;
    }
}
should work now
Reply
#6

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;
    }
}
Reply
#7

I think he meaned, that one you posted at last Because i tried the other one and it gave me error But thanks !!!!
Reply
#8

pawn Код:
switch(classid)
{
case 0:gTeam[playerid] = TEAM_CIVIL;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)