Textdraw while in class selection?
#1

I've seen this done before, and I was just wondering how to do it? I've searched ****** for a good 30minutes now,
and I've just found random, completely useless stuff.

Here's the Textdraw I want to use
Код:
//On top of script:
new Text:Textdraw0;
 
//In OnPlayerClassSelection (or OnPlayerRequestClass?)
Textdraw0 = TextDrawCreate(387.000000,145.000000,"Surviver");
TextDrawAlignment(Textdraw0,3);
TextDrawBackgroundColor(Textdraw0,0x000000ff);
TextDrawFont(Textdraw0,3);
TextDrawLetterSize(Textdraw0,0.899999,1.700000);
TextDrawColor(Textdraw0,0x0000ffff);
TextDrawSetOutline(Textdraw0,1);
TextDrawSetProportional(Textdraw0,1);
TextDrawSetShadow(Textdraw0,1);
for now I just have CJ (ID 0) and the skin ID 170.

I want it to say "survivor" when you have CJ selected in class selection.
And it to say "survivor 2" when you have id170

But how?
Reply
#2

You will need to detect the class ID. Then that stuff goes into "OnGameModeInIt".
Then you will need to show the textdraw when the class ID is right, using "TextDrawShowForPlayer".
https://sampwiki.blast.hk/wiki/TextDrawShowForPlayer
Theres so such thing as "OnPlayerClassSelection". And you will also need to "TextDrawHideForPlayer" when
the class ID does not match they class they are currently looking at.
https://sampwiki.blast.hk/wiki/TextDrawHideForPlayer

If you don't mind, you can just use "GameTextForPlayer", to show a name, but if you wish to stick
to your textdraws, you can. https://sampwiki.blast.hk/wiki/GameTextForPlayer
Reply
#3

So I was looking between textdraw and "GameTextForPlayer"
and "GameTextForPlayer" looks ALOT shorter than TextDraw
(Besides isn't Textdraw mainly for showing server name/forums
at the bottom of the screen?)

SO, for "GameTextForPlayer" on the wiki it said

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new string[50];
    format(string, sizeof(string), "You entered vehicle: %i", vehicleid);
    GameTextForPlayer(playerid, string, 3000, 4);
    return 1;
}
And what I don't understand is the "new string[50];" .. what's that mean? (Link/Discription, anything really.)
And whats that "%i"?


If I was going to make this for Class Selection, would I just do the same as textdraw
to tell it to dissipear if its on the wrong ID? Or would I not need to because of the timer?

And where would I set it to appear on the ID?
-- How would I make "Survivor" only appear on CJ?
--and make "Survivor 2" only appear on ID 170?


Because If I don't have to make it not appear for the wrong ID, and just have it so it when you go over CJ (or ID 170) it would stay up for 5 seconds, or go away after you switch to ID 170(or CJ).


Thanks ^^
Reply
#4

String = format things.
If your just using premade text, such as "Grove", you don't need formatting or the strings.
Reply
#5

;] Got it working with GameTextForPlayer.

Problem solved ;]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)