SA-MP Forums Archive
Restrict anyone from spawning as specific team without 2000 score. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Restrict anyone from spawning as specific team without 2000 score. (/showthread.php?tid=426141)



Restrict anyone from spawning as specific team without 2000 score. - Eminem 2ka9 - 28.03.2013

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", "");
        }



Re: Restrict anyone from spawning as specific team without 2000 score. - andrewgrob - 28.03.2013

put

if(GetPlayerScore(playerid) < 2000)

onplayer requestclass

it should work


Re: Restrict anyone from spawning as specific team without 2000 score. - Eminem 2ka9 - 28.03.2013

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


Re: Restrict anyone from spawning as specific team without 2000 score. - Eminem 2ka9 - 28.03.2013

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", "");
        }



Re: Restrict anyone from spawning as specific team without 2000 score. - andrewgrob - 28.03.2013

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;


Re: Restrict anyone from spawning as specific team without 2000 score. - andrewgrob - 28.03.2013

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