new A = 21;
new B = 2;
public OnPlayerDeath(playerid, killerid, reason)
{
if(A)
{
SetTimerEx("Team1", 3300, false, "i", playerid);
}
else if(B)
{
SetTimerEx("Team2", 3300, false, "i", playerid);
}
Show your timers.
And you might want to assign the variable A and B with [MAX_PLAYERS];. if(A[playerid]). |
public Team1(playerid)
{
switch(random(6)) // Negros
{
case 0:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
switch(random(8))
{
case 0: {SetPlayerSkin(playerid, 21);
SetSpawnInfo(playerid,0,21,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
case 1: {SetPlayerSkin(playerid, 19);
SetSpawnInfo(playerid,0,19,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
case 2: {SetPlayerSkin(playerid, 183);
SetSpawnInfo(playerid,0,183,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
case 3: {SetPlayerSkin(playerid, 104);
SetSpawnInfo(playerid,0,104,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
case 4: {SetPlayerSkin(playerid, 28);
SetSpawnInfo(playerid,0,28,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
case 5: {SetPlayerSkin(playerid, 22);
SetSpawnInfo(playerid,0,22,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
case 6: {SetPlayerSkin(playerid, 190);
SetSpawnInfo(playerid,0,190,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
case 7: {SetPlayerSkin(playerid, 195);
SetSpawnInfo(playerid,0,195,-2636.9077,260.5389,4.3281,75.9486,30,150,25,50,29,150);}
}
SetPlayerColor(playerid, color_NEGROS);
}
case 1:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
switch(random(8))
{
case 0: {SetPlayerSkin(playerid, 21);
SetSpawnInfo(playerid,0,21,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
case 1: {SetPlayerSkin(playerid, 19);
SetSpawnInfo(playerid,0,19,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
case 2: {SetPlayerSkin(playerid, 183);
SetSpawnInfo(playerid,0,183,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
case 3: {SetPlayerSkin(playerid, 104);
SetSpawnInfo(playerid,0,104,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
case 4: {SetPlayerSkin(playerid, 28);
SetSpawnInfo(playerid,0,28,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
case 5: {SetPlayerSkin(playerid, 22);
SetSpawnInfo(playerid,0,22,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
case 6: {SetPlayerSkin(playerid, 190);
SetSpawnInfo(playerid,0,190,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
case 7: {SetPlayerSkin(playerid, 195);
SetSpawnInfo(playerid,0,195,-2659.7424,260.6835,4.6328,20.2774,30,150,25,50,29,150);}
}
SetPlayerColor(playerid, color_NEGROS);
}
case 2:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
switch(random(8))
{
case 0: {SetPlayerSkin(playerid, 21);
SetSpawnInfo(playerid,0,21,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
case 1: {SetPlayerSkin(playerid, 19);
SetSpawnInfo(playerid,0,19,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
case 2: {SetPlayerSkin(playerid, 183);
SetSpawnInfo(playerid,0,183,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
case 3: {SetPlayerSkin(playerid, 104);
SetSpawnInfo(playerid,0,104,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
case 4: {SetPlayerSkin(playerid, 28);
SetSpawnInfo(playerid,0,28,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
case 5: {SetPlayerSkin(playerid, 22);
SetSpawnInfo(playerid,0,22,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
case 6: {SetPlayerSkin(playerid, 190);
SetSpawnInfo(playerid,0,190,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
case 7: {SetPlayerSkin(playerid, 195);
SetSpawnInfo(playerid,0,195,-2695.9822,262.4749,4.6328,258.9438,30,150,25,50,29,150);}
}
SetPlayerColor(playerid, color_NEGROS);
}
case 3:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
switch(random(8))
{
case 0: {SetPlayerSkin(playerid, 21);
SetSpawnInfo(playerid,0,21,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
case 1: {SetPlayerSkin(playerid, 19);
SetSpawnInfo(playerid,0,19,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
case 2: {SetPlayerSkin(playerid, 183);
SetSpawnInfo(playerid,0,183,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
case 3: {SetPlayerSkin(playerid, 104);
SetSpawnInfo(playerid,0,104,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
case 4: {SetPlayerSkin(playerid, 28);
SetSpawnInfo(playerid,0,28,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
case 5: {SetPlayerSkin(playerid, 22);
SetSpawnInfo(playerid,0,22,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
case 6: {SetPlayerSkin(playerid, 190);
SetSpawnInfo(playerid,0,190,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
case 7: {SetPlayerSkin(playerid, 195);
SetSpawnInfo(playerid,0,195,-2694.5286,276.3913,4.3359,230.1168,30,150,25,50,29,150);}
}
SetPlayerColor(playerid, color_NEGROS);
}
case 4:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
switch(random(8))
{
case 0: {SetPlayerSkin(playerid, 21);
SetSpawnInfo(playerid,0,21,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);}
case 1: {SetPlayerSkin(playerid, 19);
SetSpawnInfo(playerid,0,19,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);}
case 2: {SetPlayerSkin(playerid, 183);
SetSpawnInfo(playerid,0,183,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);}
case 3: {SetPlayerSkin(playerid, 104);
SetSpawnInfo(playerid,0,104,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);}
case 5: {SetPlayerSkin(playerid, 22);
SetSpawnInfo(playerid,0,22,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);}
case 6: {SetPlayerSkin(playerid, 190);
SetSpawnInfo(playerid,0,190,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);}
case 7: {SetPlayerSkin(playerid, 195);
SetSpawnInfo(playerid,0,195,-2659.1301,275.6968,4.3359,79.7154,30,150,25,50,29,150);}
}
SetPlayerColor(playerid, color_NEGROS);
}
case 5:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
switch(random(8))
{
case 0: {SetPlayerSkin(playerid, 21);
SetSpawnInfo(playerid,0,21,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
case 1: {SetPlayerSkin(playerid, 19);
SetSpawnInfo(playerid,0,19,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
case 2: {SetPlayerSkin(playerid, 183);
SetSpawnInfo(playerid,0,183,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
case 3: {SetPlayerSkin(playerid, 104);
SetSpawnInfo(playerid,0,104,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
case 4: {SetPlayerSkin(playerid, 28);
SetSpawnInfo(playerid,0,28,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
case 5: {SetPlayerSkin(playerid, 22);
SetSpawnInfo(playerid,0,22,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
case 6: {SetPlayerSkin(playerid, 190);
SetSpawnInfo(playerid,0,190,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
case 7: {SetPlayerSkin(playerid, 195);
SetSpawnInfo(playerid,0,195,-2665.8315,237.6608,4.3359,96.0087,30,150,25,50,29,150);}
}
SetPlayerColor(playerid, color_NEGROS);
}
}
}
public Team2(playerid)
{
switch(random(6)) //Civiles
{
case 0:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
SetPlayerSkin(playerid, 2);
SetSpawnInfo(playerid,1,2,-1762.0461,960.5403,24.8828,171.4048,26,100,29,150,24,20);
SetPlayerColor(playerid, color_CIVILES);
}
case 1:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
SetPlayerSkin(playerid, 2);
SetSpawnInfo(playerid,1,2,-1771.2639,961.1591,24.8828,167.9581,26,100,29,150,24,20);
SetPlayerColor(playerid, color_CIVILES);
}
case 2:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
SetPlayerSkin(playerid, 2);
SetSpawnInfo(playerid,1,2,-1751.0995,961.6115,24.8828,176.7314,26,100,29,150,24,20);
SetPlayerColor(playerid, color_CIVILES);
}
case 3:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
SetPlayerSkin(playerid, 2);
SetSpawnInfo(playerid,1,2,-1739.0233,961.1733,24.8828,171.0913,26,100,29,150,24,20);
SetPlayerColor(playerid, color_CIVILES);
}
case 4:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
SetPlayerSkin(playerid, 2);
SetSpawnInfo(playerid,1,2,-1743.8237,946.1083,24.8828,15.3633,26,100,29,150,24,20);
SetPlayerColor(playerid, color_CIVILES);
}
case 5:
{
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
SetPlayerSkin(playerid, 2);
SetSpawnInfo(playerid,1,2,-1764.9819,945.7482,24.8828,31.9701,26,100,29,150,24,20);
SetPlayerColor(playerid, color_CIVILES);
}
}
}
new SKIN_MODELS[] = {
21,
2,
124,
122,
285,
108,
248,
295,
159,
50,
296,
287
};
new SKIN_NAMES[][] = {
"__Negros",
"_Civiles",
"___Mafia",
"____Nang",
"____Swat",
"___Maras",
"___Biker",
"____Rich",
"_Farmers",
"Mechanic",
"____Pimp",
"Soldados"
};
new A = 21;
new B = 2;
new C = 124;
new D = 122;
new E = 285;
new F = 108;
public OnPlayerRequestClass(playerid, classid)
{
PlayAudioStreamForPlayer(playerid, "https://open.spotify.com/track/677emOQgVxZAMZcLFEAr1z?si=sBh9rxFWSXGAU4UzWPaxCQ");
SetSpawnInfo(playerid, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
TogglePlayerSpectating(playerid, true);
SetTimerEx("login_dialog", 0, 0, "i", playerid);
const MAX_SKINS = 312;
static string[MAX_SKINS * 16];
if (string[0] == EOS) {
for (new i; i < MAX_SKINS; i++) {
format(string, sizeof string, "%s%i\tID: %i\n", string, i, i);
}
}
return ShowPreviewModelDialog(playerid, 0, "Selecciуn de Equipo", SKIN_MODELS,SKIN_NAMES , "Select", "Cancel");
}
CMD:class(playerid,params[])
{
GetPlayerHealth(playerid, health);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Equipos","\nNegros\nCiviles\nMafia\nNang\nSwat\nMaras\nBiker\nRich\nFarmers\nMechanic\nPimp\nSoldados" , "Select", "");
SendClientMessage(playerid, -1, "Your class will be changed in 10 seconds.");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
switch(listitem)
{
case 0:{if(A)
{
SetTimerEx("ClassSelection1", 10000, false, "i", playerid);
}}
case 1:{if(B)
{
SetTimerEx("ClassSelection2", 10000, false, "i", playerid);
}}
case 2:{if(C)
{
SetTimerEx("ClassSelection3", 10000, false, "i", playerid);
}}
case 3:{if(D)
{
SetTimerEx("ClassSelection4", 10000, false, "i", playerid);
}}
case 4:{if(E)
{
SetTimerEx("ClassSelection5", 10000, false, "i", playerid);
}}
case 5:{if(F)
{
SetTimerEx("ClassSelection6", 10000, false, "i", playerid);
}}
}
}
But you never assign any variable to a player, so how do you expect the script to put a player in the same team he used to be?
From my point of view that entire script should be rewritten. |
new gTeam[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
if(gTeam[playerid] == A)) //<----- (19916)
{
SetTimerEx("Team1", 3300, false, "i", playerid);
}
else if(gTeam[playerid] == B))
{
SetTimerEx("Team2", 3300, false, "i", playerid);
}