Character selection text
#1

Hello,
Is it possible to draw the text 'CJ' when I select CJ in class selection? Or 'Sweet' when I select Sweet?
Superthijs
Reply
#2

Yeah, you can use a textdraw (TextDrawCreate) or a gametext (GameTextForPlayer) under a callback called OnPlayerRequestClass in the following manner:

pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    switch(classid)//Gets the current classid
    {
        case 0: do_something;//First class, switch statement always starts with 0
        case 1: do_something;//2nd class, continue this untill you reach the number you want
        default: do_something;//Keep this underneath the code, you can also remove this if you want
    }
    return 1;
}
Untested.
Reply
#3

Thanks, but when I try it, it says 'unreachable code' on the 'switch(classid)' line. What's the problem?
Reply
#4

Weird, it compiles fine for me...
Could you perhaps show us the code?
Reply
#5

Yeah, but now it just selects the first class to play, without class selection...
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(IsPlayerNPC(playerid)) return 1;

	if(gPlayerHasCitySelected[playerid]) {
		ClassSel_SetupCharSelection(playerid);
		return 1;
	} else {
		if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
			TogglePlayerSpectating(playerid,1);
    		TextDrawShowForPlayer(playerid, txtClassSelHelper);
    		gPlayerCitySelection[playerid] = -1;
		}
  	}

    switch(classid) //Gets the current classid
	{
        case 0: GameTextForPlayer(playerid,"This is class 0",300,1);
        case 1: GameTextForPlayer(playerid,"This is class 1",300,1);
	}
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)