Class selection help
#1

Hey guys, well I'm currently working on a Gangwars server and I have added the LSPD into the class selection, but for players to be able to play as the police they need a score of 200.

Now I have made it detect if the user has a score of 200 and it sends them a message saying they cannot play as the LSPD since they do not have the required score, but you can still spawn as them. Any idea on how to stop them simply clicking spawn and letting them play? I know there's a way to deactivate the spawn button on that class if they cannot play as them, I just need some help on finding out how.

Thanks in advance.
Reply
#2

Under
Код:
public OnPlayerRequestClass
Check if they're requesting the LSPD class. If so do like

Код:
if(GetPlayerScore >= 200)
{
     SetPlayerClass(blahblahblah);
}
else
{
     SendClientMessage(playerid, blah blah blah);
     Return 1;
}
Reply
#3

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(GetPlayerScore(playerid) < 200)
    {
        return 0;
    }else{
        return 1;
    }
}
Reply
#4

Quote:
Originally Posted by Sascha
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(GetPlayerScore(playerid) < 200)
    {
        return 0;
    }else{
        return 1;
    }
}
You really don't need an else here.
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    if( GetPlayerScore( playerid ) < 200 ) return 0;
    return 1;
}
ALSO: It should be OnPlayerRequestSpawn:
pawn Код:
public OnPlayerRequestSpawn( playerid )
{
    if( GetPlayerScore( playerid ) < 200 ) return 0;
    return 1;
}
Reply
#5

I dont think this will work, I forgot to mention I use this

Код:
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 0 || classid == 1 || classid == 2)
	{
		TextDrawShowForPlayer(playerid, grovemessage);
		TextDrawHideForPlayer(playerid, ballamessage);
		TextDrawHideForPlayer(playerid, copmessage);
		TextDrawHideForPlayer(playerid, civilmessage);
		gTeam[playerid] = TEAM_GROVE;
	}
	else if (classid == 3 || classid == 4 || classid == 5)
	{
		TextDrawHideForPlayer(playerid, grovemessage);
		TextDrawShowForPlayer(playerid, ballamessage);
		TextDrawHideForPlayer(playerid, copmessage);
		TextDrawHideForPlayer(playerid, civilmessage);
		gTeam[playerid] = TEAM_BALLA;
	}
	else if (classid == 6 || classid == 7 || classid == 8)
	{
	    TextDrawHideForPlayer(playerid, grovemessage);
	    TextDrawHideForPlayer(playerid, ballamessage);
	    TextDrawShowForPlayer(playerid, copmessage);
	    TextDrawHideForPlayer(playerid, civilmessage);
	    new scorelevel = GetPlayerScore(playerid);
	    if(scorelevel < 200)
		{
		SCM(playerid, COLOR_RED, "You cannot use this class! (Score needed of 200)");
		}
		gTeam[playerid] = TEAM_COP;
	}
	else
	{
 		TextDrawHideForPlayer(playerid, grovemessage);
	    TextDrawHideForPlayer(playerid, ballamessage);
	    TextDrawHideForPlayer(playerid, copmessage);
	    TextDrawShowForPlayer(playerid, civilmessage);
	    gTeam[playerid] = TEAM_CIVIL;
	}
}
and under OnPlayerRequestClass I just have SetPlayerTeamFromClass. But how can I make it so people cant pick to become LSPD without the right score without affecting other classes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)