Creating a Textdraw on PlayerRequestClass
#1

Hello,
I was wondering how I would make text show in the middle of the screen saying : Civilian, or Mafia for when they are hovering over a certain person?

Can someone show me an example.
Reply
#2

I suggest you use GameTextForPlayer instead of textdraws. It's easier and you don't have to create anything. Here's an example:

pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 1, 2, 3: GameTextForPlayer(playerid, "~w~Civilan", 3000, 4);
        case 4, 5, 6: GameTextForPlayer(playerid, "~b~Police", 3000, 4);
        case 6, 7, 8: GameTextForPlayer(playerid, "~r~Mafia", 3000, 4);
    }
    //The class id will depend on the order you add the classes under OnGameModeInit.
    //The first AddPlayerClass will have the classid 0 the second will have the classid 1 and so on.
    return 1;
}
Reply
#3

pawn Code:
public OnGameModeInit()
{
    AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); //Civilian - classid = 0
    AddPlayerClass(1, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); //Mafia - classid = 1
    return 1;
}
public OnPlayerRequestClass(playerid,classid)
{
     //Create the TextDraw on OnPlayerConnect.
    //---
    if(classid == 0)
    {
        TextDrawSetString(TextDrawName, "Civilian");
    }
    else if(classid == 1)
    {
        TextDrawSetString(TextDrawName, "Mafia");
    }
    TextDrawShowForPlayer(playerid, TextDrawName);
    return 1;
}
public OnPlayerRequestSpawn(playerid)
{
    TextDrawHideForPlayer(playerid, TextDrawName);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)