Returning to class selection after next death
#9

Quote:
Originally Posted by Sascha
Посмотреть сообщение
you can use "OnPlayerSpawn" and set his skin, and team, etc. back to his old team...
pawn Код:
public OnPlayerSpawn(playerid)
{
    new rand = random(sizeof(TSpawns));
    new rand1 = random(sizeof(GSpawns));
    new rand2 = random(sizeof(RSpawns));
    new rand3 = random(sizeof(SSpawns));
   
    //GangZone Areas
    GangZoneShowForPlayer(playerid, TerroristZone, -16777017);
    GangZoneShowForPlayer(playerid, GanstasZone, 16711888);
    GangZoneShowForPlayer(playerid, RebelZone, -65332);
    GangZoneShowForPlayer(playerid, SwatZone, 65477);
   
    if(TClassID[playerid] == 0)
    {
        if(TeamTestTerror < 8)
        {
            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid, TSpawns[rand][0], TSpawns[rand][1], TSpawns[rand][2]);
            SetPlayerHealth(playerid, 9999999.9);
            SetPlayerColor(playerid, 0xF50000FF);
            ShowPlayerDialog(playerid, TMENU, DIALOG_STYLE_LIST, "Choose what you want to be below:", "Recon\nMedic\nAssault\nEngineer", "Pick", "Cancel");
            IsTerrorist[playerid] = 1;
            IsInTerror[playerid] = true;
            TeamTestTerror += 1;
        }
        else if(TeamTestTerror == 8)
        {
            ForceClassSelection(playerid);
            SetPlayerHealth(playerid, 0);
        }
    }
    if(TClassID[playerid] == 1)
    {
        if(TeamTestSwat < 8)
        {
            ResetPlayerWeapons(playerid);
            SetPlayerHealth(playerid, 9999999.9);
            SetPlayerColor(playerid, 0x000FFFFF);
            SetPlayerPos(playerid, SSpawns[rand3][0], SSpawns[rand3][1], SSpawns[rand3][2]);
            ShowPlayerDialog(playerid, SMENU, DIALOG_STYLE_LIST, "Choose what you want to be below:", "Recon\nMedic\nAssault\nEngineer", "Pick", "Cancel");
            IsSwat[playerid] = 1;
            IsInSwat[playerid] = true;
            TeamTestSwat += 1;
        }
        else if(TeamTestSwat == 8)
        {
            ForceClassSelection(playerid);
            SetPlayerHealth(playerid, 0);
        }
    }
    if(TClassID[playerid] == 2)
    {
        if(TeamTestGang < 8)
        {
            ResetPlayerWeapons(playerid);
            SetPlayerHealth(playerid, 9999999.9);
            SetPlayerColor(playerid, 0x00FF14FF);
            SetPlayerPos(playerid, GSpawns[rand1][0], GSpawns[rand1][1], GSpawns[rand1][2]);
            ShowPlayerDialog(playerid, GMENU, DIALOG_STYLE_LIST, "Choose what you want to be below:", "Recon\nMedic\nAssault\nEngineer", "Pick", "Cancel");
            IsGansta[playerid] = 1;
            IsInGang[playerid] = true;
            TeamTestGang += 1;
        }
        else if(TeamTestGang == 8)
        {
            ForceClassSelection(playerid);
            SetPlayerHealth(playerid, 0);
        }
    }
    if(TClassID[playerid] == 3)
    {
        if(TeamTestRebel < 8)
        {
            ResetPlayerWeapons(playerid);
            SetPlayerHealth(playerid, 9999999.9);
            SetPlayerColor(playerid, 0xFFFA00FF);
            SetPlayerPos(playerid, RSpawns[rand2][0], RSpawns[rand2][1], RSpawns[rand2][2]);
            ShowPlayerDialog(playerid, RMENU, DIALOG_STYLE_LIST, "Choose what you want to be below:", "Recon\nMedic\nAssault\nEngineer", "Pick", "Cancel");
            IsRebel[playerid] = 1;
            IsInRebel[playerid] = true;
            TeamTestRebel += 1;
        }
        else if(TeamTestRebel == 8)
        {
            ForceClassSelection(playerid);
            SetPlayerHealth(playerid, 0);
        }
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
   
    if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
   
    //If used /changeteam, else if used F4, it will mess up.
    if(UsedCTeam[playerid] == 1)
    {
        IsTerrorist[playerid] = 0;
        IsRebel[playerid] = 0;
        IsSwat[playerid] = 0;
        IsGansta[playerid] = 0;
       
        TeamTestRebel -= 1;
        TeamTestGang -= 1;
        TeamTestSwat -= 1;
        TeamTestTerror -= 1;
       
        IsInTerror[playerid] = false;
        IsInSwat[playerid] = false;
        IsInGang[playerid] = false;
        IsInRebel[playerid] = false;
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)