[Tutorial] Team Cars and Team Players
#16

Nice Tutorial Helped me a lot but why are you getting them to write long pice of code (boring one)
and not use switch
Quote:
Code:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = GROVE_STREET;
    }
    if(classid == 1)
    {
        gTeam[playerid] = POLICE;
    }
}
can be writen
Code:
SetPlayerTeamFromClass(playerid, classid)
{
     Switch(classid)
     {
     case 0 :gTeam[playerid] = GROVE_STREET;
     case 1 :gTeam[playerid] = POLICE;
     }   
}
and if you got more skins for each of them

Code:
SetPlayerTeamFromClass(playerid, classid)
{
     Switch(classid)
     {
     case 0,1,2:gTeam[playerid] = GROVE_STREET;
     case 3,4,5,6,7,8,9:gTeam[playerid] = POLICE;
     }   
}
or even shorter
Code:
SetPlayerTeamFromClass(playerid, classid)
{
     Switch(classid)
     {
     case 0..2:gTeam[playerid] = GROVE_STREET;
     case 3..9:gTeam[playerid] = POLICE;
     }   
}
it is useful when there is a lot of skins and more than 2 teams
Reply


Messages In This Thread
Team Cars and Team Players - by Emanuel_Rodriguez - 17.07.2010, 20:30
Re: Team Cars and Team Players - by Thebest96 - 17.07.2010, 21:02
Re: Team Cars and Team Players - by [XST]O_x - 17.07.2010, 21:05
Re: Team Cars and Team Players - by Thebest96 - 17.07.2010, 21:08
Re: Team Cars and Team Players - by Desertsoulz - 20.07.2010, 23:35
Re: Team Cars and Team Players - by Scenario - 20.07.2010, 23:46
Re: Team Cars and Team Players - by 3ventic - 26.07.2010, 15:22
Re: Team Cars and Team Players - by R@ger - 26.07.2010, 15:34
Re: Team Cars and Team Players - by Steven82 - 29.07.2010, 19:30
Re: Team Cars and Team Players - by Scenario - 30.07.2010, 03:40
Re: Team Cars and Team Players - by CEZALAND - 31.07.2010, 22:17
Re: Team Cars and Team Players - by sDAAw - 03.08.2010, 22:27
Re: Team Cars and Team Players - by MadalinX5 - 08.08.2010, 10:08
Re: Team Cars and Team Players - by nexco - 21.08.2010, 20:29
Re: Team Cars and Team Players - by bertuspiteri - 22.08.2010, 20:18
Re: Team Cars and Team Players - by Nekrus2 - 22.08.2010, 23:20
Re: Team Cars and Team Players - by sekol - 30.08.2010, 13:17
Re: Team Cars and Team Players - by Yamoo - 30.08.2010, 17:11
Re: Team Cars and Team Players - by Thebest96 - 01.09.2010, 14:47
Re: Team Cars and Team Players - by Thebest96 - 03.09.2010, 06:25
Re: Team Cars and Team Players - by Nekrus2 - 03.09.2010, 16:40
Re: Team Cars and Team Players - by Nekrus2 - 03.09.2010, 16:42
Re: Team Cars and Team Players - by Thebest96 - 03.09.2010, 21:19
Re: Team Cars and Team Players - by tanush - 16.10.2010, 19:11
Re: Team Cars and Team Players - by IndoScripter - 29.10.2010, 12:03
Re: Team Cars and Team Players - by Tessar - 30.10.2010, 19:45
Re: Team Cars and Team Players - by fysssical - 17.11.2010, 15:33
Re: Team Cars and Team Players - by Miado_Hulk - 20.11.2010, 16:36
Re: Team Cars and Team Players - by ollis93 - 21.11.2010, 17:57
Re: Team Cars and Team Players - by EstSampBro - 20.06.2013, 20:12
Re: Team Cars and Team Players - by hitman14 - 12.08.2014, 12:10
Re: Team Cars and Team Players - by killerbigpoint - 10.10.2014, 16:55
Re: Team Cars and Team Players - by TheRaGeLord - 04.01.2015, 12:59
Re: Team Cars and Team Players - by Ankon - 12.10.2015, 03:58

Forum Jump:


Users browsing this thread: 1 Guest(s)