Restrict anyone from spawning as specific team without 2000 score.
#1

I need to restrict players from spawning as a certain team without having 2000 score.

This is my current code, which fails to work.

pawn Code:
case 6:
                {
                    if(GetPlayerScore(playerid) < 2000)
                        {
                    SendClientMessage(playerid, C_RED, "You need 2000 score to become US Army.");
                    return ShowPlayerDialog(playerid, Team_Dialog, DIALOG_STYLE_LIST, "{33AA33}Team Selection", "{15FF00}England\n{FF0000}Soviet Union\n{FFFF00}Taliban Cell\n{0000BB}United States\n{A86EFC}Australian Armada\n{FF9900}European Alliance\n{AFAFAF}US Army", "Choose", "");
                    }
                    gTeam[playerid] = T_SPECIAL;
                    SetPlayerColor(playerid, C_GREY);
                    GameTextForPlayer(playerid, "~r~US Army", 3000, 3);
                    //ShowPlayerDialog(playerid, Skin_Dialog, DIALOG_STYLE_LIST, "Select a Skin", "", "Choose", "");
                    SetSpawnInfo(playerid, 0, 121, -1217.3820,1493.2750,21.6103,280.8538, 0, 0, 0, 0, 0, 0);
                }
            }
            ShowPlayerDialog(playerid, Class_Dialog, DIALOG_STYLE_LIST, "{15FF00}Class Selection", "Assault\nMedic             \t{FF0000}(Score: 50)\nSniper            \t{FF0000}(Score: 300)\nAnti-Tank         \t{FF0000}(Score: 500)\nSpy               \t{FF0000}(Score: 2500)\nPilot          \t{FF0000}(Score: 6500)\nEngineer          \t{FF0000}(Score: 1000)\nSpecial Operations\t{FF0000}(Score: 10000)", "Choose", "");
        }
Reply
#2

put

if(GetPlayerScore(playerid) < 2000)

onplayer requestclass

it should work
Reply
#3

I have a custom dialog, so nothing is in OnPlayerRequestClass.
Reply
#4

Nevermind.. fixed it with:

pawn Code:
case 6:
                {
                    if(GetPlayerScore(playerid) < 2000)
                        {
                    gTeam[playerid] = T_SPECIAL;
                    SetPlayerColor(playerid, C_GREY);
                    GameTextForPlayer(playerid, "~r~US Army", 3000, 3);
                    //ShowPlayerDialog(playerid, Skin_Dialog, DIALOG_STYLE_LIST, "Select a Skin", "", "Choose", "");
                    SetSpawnInfo(playerid, 0, 121, -1217.3820,1493.2750,21.6103,280.8538, 0, 0, 0, 0, 0, 0);
                    }
                    SendClientMessage(playerid, C_RED, "You need 2000 score to become US Army.");
                    return ShowPlayerDialog(playerid, Team_Dialog, DIALOG_STYLE_LIST, "{33AA33}Team Selection", "{15FF00}England\n{FF0000}Soviet Union\n{FFFF00}Taliban Cell\n{0000BB}United States\n{A86EFC}Australian Armada\n{FF9900}European Alliance\n{AFAFAF}US Army", "Choose", "");
                    }

            }
            ShowPlayerDialog(playerid, Class_Dialog, DIALOG_STYLE_LIST, "{15FF00}Class Selection", "Assault\nMedic             \t{FF0000}(Score: 50)\nSniper            \t{FF0000}(Score: 300)\nAnti-Tank         \t{FF0000}(Score: 500)\nSpy               \t{FF0000}(Score: 2500)\nPilot          \t{FF0000}(Score: 6500)\nEngineer          \t{FF0000}(Score: 1000)\nSpecial Operations\t{FF0000}(Score: 10000)", "Choose", "");
        }
Reply
#5

Quote:
Originally Posted by Eminem 2ka9
View Post
I have a custom dialog, so nothing is in OnPlayerRequestClass.
i not that good at pawn but try this


public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == )T_SPECIAL
{
GetPlayerScore(playerid) + 2000);
SendClientMessage(playerid,0xFF0000AA,"You must have 2000 score!!");
return 1;
Reply
#6

Quote:
Originally Posted by Eminem 2ka9
View Post
Nevermind.. fixed it with:

pawn Code:
case 6:
                {
                    if(GetPlayerScore(playerid) < 2000)
                        {
                    gTeam[playerid] = T_SPECIAL;
                    SetPlayerColor(playerid, C_GREY);
                    GameTextForPlayer(playerid, "~r~US Army", 3000, 3);
                    //ShowPlayerDialog(playerid, Skin_Dialog, DIALOG_STYLE_LIST, "Select a Skin", "", "Choose", "");
                    SetSpawnInfo(playerid, 0, 121, -1217.3820,1493.2750,21.6103,280.8538, 0, 0, 0, 0, 0, 0);
                    }
                    SendClientMessage(playerid, C_RED, "You need 2000 score to become US Army.");
                    return ShowPlayerDialog(playerid, Team_Dialog, DIALOG_STYLE_LIST, "{33AA33}Team Selection", "{15FF00}England\n{FF0000}Soviet Union\n{FFFF00}Taliban Cell\n{0000BB}United States\n{A86EFC}Australian Armada\n{FF9900}European Alliance\n{AFAFAF}US Army", "Choose", "");
                    }

            }
            ShowPlayerDialog(playerid, Class_Dialog, DIALOG_STYLE_LIST, "{15FF00}Class Selection", "Assault\nMedic             \t{FF0000}(Score: 50)\nSniper            \t{FF0000}(Score: 300)\nAnti-Tank         \t{FF0000}(Score: 500)\nSpy               \t{FF0000}(Score: 2500)\nPilot          \t{FF0000}(Score: 6500)\nEngineer          \t{FF0000}(Score: 1000)\nSpecial Operations\t{FF0000}(Score: 10000)", "Choose", "");
        }
ok good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)