[Help]Skin selection based on PlayerScore.(will Rep for Help)
#1

I want to make Team Cop skins only for players who has ">=300" score
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetupPlayerForClassSelection(playerid);
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0 || classid == 1 || classid == 2 || classid == 3 ||classid == 4|| classid == 5 || classid == 6 || classid == 7 || classid == 8 || classid == 9)
    {
        SetupPlayerForClassSelection(playerid);
        GameTextForPlayer(playerid, "~w~CIVILLIAN", 500, 3);
        gTeam[playerid] = 0;
    }
    if(classid == 10 || classid == 11 || classid == 12 || classid == 13 || classid == 14)
    {
        SetupPlayerForClassSelection(playerid);
        GameTextForPlayer(playerid, "~y~ZOMBIE", 500, 3);
        gTeam[playerid] = 1;
    }
    if(classid == 15 || classid == 16 || classid == 17 || classid == 18 || classid == 19 || classid == 20 || classid == 21 || classid == 22 || classid == 23)
    {
        if(GetPlayerScore(playerid) >= 300)
        (
            SetupPlayerForClassSelection(playerid);
            GameTextForPlayer(playerid, "~b~THE LAW", 500, 3);
            gTeam[playerid] = 2;
        )
        else
        (
            SendClientMessage(playerid, COLOR_RED, "YOU NEED TO BE ABOVE 300 SCORE TO BE A COP");
        )
    }
}
And i get errors when i compile... please help.
pawn Код:
(1179 -- 1180) : error 001: expected token: ")", but found ";"
(1181) : warning 217: loose indentation
(1183) : warning 217: loose indentation
(1183) : error 029: invalid expression, assumed zero
(1183 -- 1184) : warning 215: expression has no effect
(1184) : error 001: expected token: ";", but found "else"
(1184) : error 029: invalid expression, assumed zero
(1184) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

Use { } not ( )

pawn Код:
if(classid == 15 || classid == 16 || classid == 17 || classid == 18 || classid == 19 || classid == 20 || classid == 21 || classid == 22 || classid == 23)
    {
        if(GetPlayerScore(playerid) >= 300)
        {
            SetupPlayerForClassSelection(playerid);
            GameTextForPlayer(playerid, "~b~THE LAW", 500, 3);
            gTeam[playerid] = 2;
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "YOU NEED TO BE ABOVE 300 SCORE TO BE A COP");
        }
    }
Reply
#3

Thank you sooo much sinner.
but is there any way to prevent players spawning.... anything i could add that could prevent a player whos score is ">300 " ?
pawn Код:
else
        {
            SendClientMessage(playerid, COLOR_RED, "YOU NEED TO BE ABOVE 300 SCORE TO BE A COP");
            // anything i could use here to prevent player from spawning as a cop?? //
        }
Reply
#4

pawn Код:
OnPlayerSpawn(playerid)
{
    if(GetPlayerScore(playerid) < 300 && gTeam[playerid] == 2) ForceClassSelection(playerid);
}
Assuming you're setting teams in the class selection
Reply
#5

Thanks Antonio That line worked nicely... but it was given like this....
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(GetPlayerScore(playerid) < 350 && gTeam[playerid] == 3)
    {
        ForceClassSelection(playerid);
        SetPlayerHealth(playerid,0);
        SendClientMessage(playerid,0xFFFFFFFF,"You Need 350 score to join this faction");
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)