Newbie question :P
#1

Probably a easy solve, but this dosnt give the weapons when i want it.

It will when i remove the

pawn Code:
if(PlayerInfo[playerid][pSClass] == 1)
    {
        return 1;
    }
    else if(PlayerInfo[playerid][pSClass] == 0)
    {
        ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class Selection","Assualt\nSniper\nSpy\nPilot\n","Select"," ");
        return 1;
    }
Heres The whole code for this.


pawn Code:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pSClass] == 1)
    {
        return 1;
    }
    else if(PlayerInfo[playerid][pSClass] == 0)
    {
        ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class Selection","Assualt\nSniper\nSpy\nPilot\n","Select"," ");
        return 1;
    }
    if(PlayerInfo[playerid][pClass] == 1)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have The Assualt Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,25,250);
    }
    else if(PlayerInfo[playerid][pClass] == 2)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Sniper Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,34,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,25,250);
    }
    else if(PlayerInfo[playerid][pClass] == 3)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Spy Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,23,250);
    }
    else if(PlayerInfo[playerid][pClass] == 1)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Pilot Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,22,250);
    }
    return 1;
}
Reply
#2

Remove the first 'if'. The code stops there when you're in a class, which means the lower ifs wont get executed
Reply
#3

Quote:
Originally Posted by dice7
View Post
Remove the first 'if'. The code stops there when you're in a class, which means the lower ifs wont get executed
Im a bit confused, Come again?
Reply
#4

pawn Code:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pSClass] == 0)
    {
         ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class Selection","Assualt\nSniper\nSpy\nPilot\n","Select"," ");
         return 1;
    }
   
    else if(PlayerInfo[playerid][pClass] == 1)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have The Assualt Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,25,250);
    }
    else if(PlayerInfo[playerid][pClass] == 2)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Sniper Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,34,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,25,250);
    }
    else if(PlayerInfo[playerid][pClass] == 3)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Spy Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,23,250);
    }
    else if(PlayerInfo[playerid][pClass] == 1)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Pilot Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,22,250);
    }
    return 1;
}
Reply
#5

pawn Code:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pSClass] == 0)  //player doesnt have a class
    {
        ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class Selection","Assualt\nSniper\nSpy\nPilot\n","Select"," ");
    }
    //player has a class, checking which one is it
    else if(PlayerInfo[playerid][pClass] == 1)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have The Assualt Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,25,250);
    }
    else if(PlayerInfo[playerid][pClass] == 2)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Sniper Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,34,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,25,250);
    }
    else if(PlayerInfo[playerid][pClass] == 3)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Spy Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,23,250);
    }
    else if(PlayerInfo[playerid][pClass] == 1)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Pilot Class!");
        SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        GivePlayerWeapon(playerid,31,500);
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,22,250);
    }
    return 1;
}
Reply
#6

PHP Code:
public OnPlayerSpawn(playerid)
{
    if(
PlayerInfo[playerid][pSClass] == 0)
    {
        
ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class Selection","Assualt\nSniper\nSpy\nPilot\n","Select"," ");
        return 
1;
    }
    else if(
PlayerInfo[playerid][pSClass] == 1)
    {
        return 
1;
    }
    if(
PlayerInfo[playerid][pClass] == 1)
    {
        
SendClientMessage(playerid,COLOR_YELLOW,"Your Have The Assualt Class!");
        
SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
        
SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        
GivePlayerWeapon(playerid,31,500);
        
GivePlayerWeapon(playerid,29,500);
        
GivePlayerWeapon(playerid,25,250);
    }
    else if(
PlayerInfo[playerid][pClass] == 2)
    {
        
SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Sniper Class!");
        
SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
          
SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        
GivePlayerWeapon(playerid,34,500);
        
GivePlayerWeapon(playerid,29,500);
        
GivePlayerWeapon(playerid,25,250);
    }
    else if(
PlayerInfo[playerid][pClass] == 3)
    {
        
SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Spy Class!");
        
SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
          
SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
        
GivePlayerWeapon(playerid,31,500);
        
GivePlayerWeapon(playerid,29,500);
        
GivePlayerWeapon(playerid,23,250);
    }
    else if(
PlayerInfo[playerid][pClass] == 1)
    {
        
SendClientMessage(playerid,COLOR_YELLOW,"Your Have Selected Pilot Class!");
        
SendClientMessage(playerid,COLOR_RED,"Note* You Can Change Your Class By Type /ClassSelection");
         
SendClientMessage(playerid,COLOR_LIMEGREEN,"Kill Anyone That Is NOT On Your Team!");
         
GivePlayerWeapon(playerid,31,500);
         
GivePlayerWeapon(playerid,29,500);
        
GivePlayerWeapon(playerid,22,250);
    }
    return 
1;

Reply
#7

Would i do the same for this?

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        for(new i = 0; i < sizeof(PoliceVehcles); i++)
        {
            if(vid == PoliceVehcles[i])
            {
                if(PlayerInfo[playerid][pTeam] == 6)
                {
                    RemovePlayerFromVehicle(playerid);
                    SendClientMessage(playerid,COLOR_RED,"You Are Not A Police Officer!");
                    return 1;
                }
            }
        }
    }
    else if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        for(new i = 0; i < sizeof(PilotHunter); i++)
        {
            if(vid == PilotHunter[i])
            {
                if(PlayerInfo[playerid][pClass] == 4)
                {
                    if(PlayerInfo[playerid][pARank] == 3)
                    {
                        RemovePlayerFromVehicle(playerid);
                        SendClientMessage(playerid,COLOR_RED,"You Are Not An Level 3 Pilot!");
                        return 1;
                    }
                }
            }
        }
    }
    else if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        for(new i = 0; i < sizeof(PilotHydra); i++)
        {
            if(vid == PilotHydra[i])
            {
                if(PlayerInfo[playerid][pClass] == 4)
                {
                    if(PlayerInfo[playerid][pARank] == 4)
                    {
                        RemovePlayerFromVehicle(playerid);
                        SendClientMessage(playerid,COLOR_RED,"You Are Not An Level 4 Pilot!");
                        return 1;
                    }
                }
            }
        }
    }
    else if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        for(new i = 0; i < sizeof(PilotNevada); i++)
        {
            if(vid == PilotNevada[i])
            {
                if(PlayerInfo[playerid][pClass] == 4)
                {
                    if(PlayerInfo[playerid][pARank] == 1)
                    {
                        RemovePlayerFromVehicle(playerid);
                        SendClientMessage(playerid,COLOR_RED,"You Are Not An Level 1 Pilot!");
                        return 1;
                    }
                }
            }
        }
    }
    else if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        for(new i = 0; i < sizeof(PilotShamal); i++)
        {
            if(vid == PilotShamal[i])
            {
                if(PlayerInfo[playerid][pClass] == 4)
                {
                    if(PlayerInfo[playerid][pARank] == 1)
                    {
                        RemovePlayerFromVehicle(playerid);
                        SendClientMessage(playerid,COLOR_RED,"You Are Not An Level 1 Pilot!");
                        return 1;
                    }
                }
            }
        }
    }
    else if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        for(new i = 0; i < sizeof(PoliceHydra); i++)
        {
            if(vid == PoliceHydra[i])
            {
                if(PlayerInfo[playerid][pTeam] == 6)
                {
                    if(PlayerInfo[playerid][pClass] == 4)
                    {
                        if(PlayerInfo[playerid][pARank] == 4)
                        {
                            RemovePlayerFromVehicle(playerid);
                            SendClientMessage(playerid,COLOR_RED,"You Are Not An Level 4 Police Pilot!");
                            return 1;
                        }
                    }
                }
            }
        }
    }
    else if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        for(new i = 0; i < sizeof(MedicVehicles); i++)
        {
            if(vid == MedicVehicles[i])
            {
                if(PlayerInfo[playerid][pTeam] == 5)
                {
                    RemovePlayerFromVehicle(playerid);
                    SendClientMessage(playerid,COLOR_RED,"You Are Not A Medic!");
                }
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)