OnPlayerDeath
#21

pawn Код:
if(class_selection[ playerid ] == 0)
Don't do that. You set the variable to 1 and then checking if it is 0..
Reply
#22

sorry i havent reads all the comments and the codes still there is a way to prevent it by
new class_setup_complted=0;
and change it to 1 when he join and selects the class for first time
and when onplayerrequestclass is called again add a check if the class_setup_complted==1 if it is spawn the player with SpawnPlayer then and there but first set the spawninfo if you get what i just said
Reply
#23

Well, i got this now on PlayerSpawn
pawn Код:
public OnPlayerSpawn( playerid )
{
    SetPlayerInterior( playerid, 0 );
    SetCameraBehindPlayer( playerid );
    if( isDead[ playerid ] == 1 && class_selection[ playerid ] == 1 )
    {
        isDead[ playerid ] = 0;
        class_selection[ playerid ] = 1;
    }
    if( isDead[ playerid ] == 1 ) isDead[ playerid ] = 0;
    if( class_selection[ playerid ] == 1 ) class_selection[ playerid ] = 1;
    TextDrawShowForPlayer(playerid, VHealth[playerid]);
    TextDrawShowForPlayer(playerid, Stats[playerid]);
    TextDrawShowForPlayer(playerid, VArmour[playerid]);
    TextDrawShowForPlayer(playerid, VLevel[playerid]);
    TextDrawShowForPlayer(playerid, VCash[playerid]);
    TextDrawShowForPlayer(playerid, VPlayer[playerid]);
    GivePlayerWeapon(playerid, 24, 50);
    return 1;
}
This is On Player Request Class

pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
   if(class_selection[ playerid ] == 0)
   {
    new string[128];
    SetPlayerPos(playerid, 786.2990,845.2061,176.7938);
    SetPlayerCameraPos(playerid, 779.6148,845.5803,180.1051);
    SetPlayerCameraLookAt(playerid, 786.2990,845.2061,176.7938);
    if( isDead[ playerid ] == 1 ) SpawnPlayer( playerid );
    if(classid == 0)
    {
        format(string, sizeof(string), "~r~Terrorists");
        GameTextForPlayer(playerid, string, 3000, 6);
        SetPlayerSkin(playerid, 294);
        PlayerInfo[playerid][pTeam] = 1;
        SetPlayerColor(playerid, COLOR_RED);
        return 0;
    }
    else if(classid == 1)
    {
        format(string, sizeof(string), "~b~Counter-Terrorists");
        GameTextForPlayer(playerid, string, 3000, 6);
        SetPlayerSkin(playerid, 285);
        PlayerInfo[playerid][pTeam] = 2;
        SetPlayerColor(playerid, COLOR_BLUE);
        return 0;
    }
   }
   else if( isDead[ playerid ] == 1 && class_selection[ playerid ] == 1 )
   {
     if(PlayerInfo[playerid][pAdmin] == 1)
     {
        SetSpawnInfo( playerid, 0, 294, 195.5586, 427.2332, 12.7379, 269.15, 0, 0, 0, 0, 24, 50 );
        SpawnPlayer( playerid );
     }
     else if(PlayerInfo[playerid][pTeam] == 2)
     {
        SetSpawnInfo( playerid, 0, 285, 49.1121, 423.5605, 12.7379, 269.15, 0, 0, 0, 0, 24, 50 );
        SpawnPlayer( playerid );
     }
     return 1;
   }
   return 1;
}
Ehhm..
Well. If i die, It's returning to class selection :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)