SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0 || 1 || 2 || 3)
{
gTeam[playerid] = TEAM_GROVE;
}
else if(classid == 4 || 5 || 6)
{
gTeam[playerid] = TEAM_AZTECAS;
}
else if(classid == 7 || 8 || 9)
{
gTeam[playerid] = TEAM_COPS;
}
else if(classid == 10 || 11 || 12 || 13)
{
gTeam[playerid] = TEAM_BALLAS;
}
else if(classid == 14 || 15 || 16)
{
gTeam[playerid] = TEAM_VAGOS;
}
else if(classid == 17 || 18 || 19)
{
gTeam[playerid] = TEAM_BIKERS;
}
else if(classid == 20 || 21)
{
gTeam[playerid] = TEAM_SKATERS;
}
else if(classid == 22 || 23 || 24 || 25)
{
gTeam[playerid] = TEAM_RED;
}
}
public OnPlayerSpawn(playerid)
{
TextDrawHideForPlayer(playerid, grove0);
TextDrawHideForPlayer(playerid, grove1);
TextDrawHideForPlayer(playerid,aztec0);
TextDrawHideForPlayer(playerid,aztec1);
TextDrawHideForPlayer(playerid,cop0);
TextDrawHideForPlayer(playerid,cop1);
TextDrawHideForPlayer(playerid,balla0);
TextDrawHideForPlayer(playerid,balla1);
TextDrawHideForPlayer(playerid,vago0);
TextDrawHideForPlayer(playerid,vago1);
TextDrawHideForPlayer(playerid,skate0);
TextDrawHideForPlayer(playerid,skate1);
TextDrawHideForPlayer(playerid,bike0);
TextDrawHideForPlayer(playerid,bike1);
TextDrawHideForPlayer(playerid,red0);
TextDrawHideForPlayer(playerid,red1);
ClearAnimations(playerid);
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0);
SetPlayerHealth(playerid, 100);
if(gTeam[playerid] == TEAM_GROVE)
{
SetPlayerColor(playerid, COLOR_GREEN);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 27, 200);
GivePlayerWeapon(playerid, 31, 300);
GivePlayerWeapon(playerid, 32, 50);
GivePlayerWeapon(playerid, 16, 5);
new rand = random(sizeof(gRandomSpawns));
SetPlayerPos(playerid, gRandomSpawns[rand][0], gRandomSpawns[rand][1], gRandomSpawns[rand][2]);
}
else if(gTeam[playerid] == TEAM_BALLAS)
{
SetPlayerColor(playerid, COLOR_PURPLE);
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 25, 200);
GivePlayerWeapon(playerid, 34, 50);
GivePlayerWeapon(playerid, 18, 5);
GivePlayerWeapon(playerid, 28, 400);
new rand = random(sizeof(bRandomSpawns));
SetPlayerPos(playerid, bRandomSpawns[rand][0], bRandomSpawns[rand][1], bRandomSpawns[rand][2]);
}
else if(gTeam[playerid] == TEAM_VAGOS)
{
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 26, 210);
GivePlayerWeapon(playerid, 33, 50);
GivePlayerWeapon(playerid, 18, 5);
new rand = random(sizeof(vRandomSpawns));
SetPlayerPos(playerid, vRandomSpawns[rand][0], vRandomSpawns[rand][1], vRandomSpawns[rand][2]);
}
else if(gTeam[playerid] == TEAM_AZTECAS)
{
GivePlayerWeapon(playerid, 22, 250);
GivePlayerWeapon(playerid, 26, 210);
GivePlayerWeapon(playerid, 29, 300);//9mm Pistol~n~Sawn-Offs~n~MP5~n~Sniper Rifle~n~grenades
GivePlayerWeapon(playerid, 34, 50);
GivePlayerWeapon(playerid, 16, 5);
new rand = random(sizeof(aRandomSpawns));
SetPlayerPos(playerid, aRandomSpawns[rand][0], aRandomSpawns[rand][1], aRandomSpawns[rand][2]);
}
else if(gTeam[playerid] == TEAM_COPS)
{
GivePlayerWeapon(playerid, 22, 250);
GivePlayerWeapon(playerid, 25, 200);
GivePlayerWeapon(playerid, 29, 300);
GivePlayerWeapon(playerid, 31, 300);
GivePlayerWeapon(playerid, 16, 5);
new rand = random(sizeof(cRandomSpawns));
SetPlayerPos(playerid, cRandomSpawns[rand][0], cRandomSpawns[rand][1], cRandomSpawns[rand][2]);
}
else if(gTeam[playerid] == TEAM_SKATERS)
{
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 26, 200);
GivePlayerWeapon(playerid, 28, 350);
GivePlayerWeapon(playerid, 34, 50);
new rand = random(sizeof(sRandomSpawns));
SetPlayerPos(playerid, sRandomSpawns[rand][0], sRandomSpawns[rand][1], sRandomSpawns[rand][2]);
}
else if(gTeam[playerid] == TEAM_BIKERS)
{
GivePlayerWeapon(playerid, 22, 200);
GivePlayerWeapon(playerid, 28, 350);
GivePlayerWeapon(playerid, 30, 350);
GivePlayerWeapon(playerid, 25, 200);
GivePlayerWeapon(playerid, 18, 5);
new rand = random(sizeof(biRandomSpawns));
SetPlayerPos(playerid, biRandomSpawns[rand][0], biRandomSpawns[rand][1], biRandomSpawns[rand][2]);
}
else if(gTeam[playerid] == TEAM_RED)
{
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 26, 250);
GivePlayerWeapon(playerid, 32, 250);
GivePlayerWeapon(playerid, 34, 50);
new rand = random(sizeof(rRandomSpawns));
SetPlayerPos(playerid, rRandomSpawns[rand][0], rRandomSpawns[rand][1], rRandomSpawns[rand][2]);
}
return 1;
}
if (classid == 0 || 1 || 2 || 3) //Wrong
if (classid == 0 || classid == 1 || classid == 2 || classid == 3) //Right
//Example
switch(classid)
{
case 1..3: gTeam[playerid] = TEAM_GROVE;
case 4..6: gTeam[playerid] = TEAM_AZTECAS;
//and so on
}
Your if statements are structured wrong.
pawn Код:
pawn Код:
|
Your if statements are structured wrong.
pawn Код:
pawn Код:
|