SA-MP Forums Archive
Creating a Textdraw on PlayerRequestClass - 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: Creating a Textdraw on PlayerRequestClass (/showthread.php?tid=332536)



Creating a Textdraw on PlayerRequestClass - HazardGaming - 08.04.2012

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.


Re: Creating a Textdraw on PlayerRequestClass - SpiritEvil - 08.04.2012

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;
}



Re: Creating a Textdraw on PlayerRequestClass - [DOG]irinel1996 - 08.04.2012

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;
}