SA-MP Forums Archive
Showing spectator info textdraw while using /spec - 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: Showing spectator info textdraw while using /spec (/showthread.php?tid=649546)



Showing spectator info textdraw while using /spec - ivndosos - 10.02.2018

I've made a simple textdraw to show player's information when the admins spectate them,

Код:
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;
new Text:Textdraw5;
new Text:Textdraw6;

// In OnGameModeInit prefferably, we procced to create our textdraws:
Textdraw0 = TextDrawCreate(14.000000, 250.000000, "_");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 6.499998);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 70);
TextDrawTextSize(Textdraw0, 140.000000, 0.000000);

Textdraw1 = TextDrawCreate(14.000000, 251.000000, "NAME:");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.310000, 0.799999);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetShadow(Textdraw1, 1);

Textdraw2 = TextDrawCreate(14.000000, 262.000000, "ID:");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.310000, 0.799999);
TextDrawColor(Textdraw2, -1);
TextDrawSetOutline(Textdraw2, 0);
TextDrawSetProportional(Textdraw2, 1);
TextDrawSetShadow(Textdraw2, 1);

Textdraw3 = TextDrawCreate(13.000000, 273.000000, "FPS:");
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 1);
TextDrawLetterSize(Textdraw3, 0.310000, 0.799999);
TextDrawColor(Textdraw3, -1);
TextDrawSetOutline(Textdraw3, 0);
TextDrawSetProportional(Textdraw3, 1);
TextDrawSetShadow(Textdraw3, 1);

Textdraw4 = TextDrawCreate(14.000000, 284.000000, "PING:");
TextDrawBackgroundColor(Textdraw4, 255);
TextDrawFont(Textdraw4, 1);
TextDrawLetterSize(Textdraw4, 0.310000, 0.799999);
TextDrawColor(Textdraw4, -1);
TextDrawSetOutline(Textdraw4, 0);
TextDrawSetProportional(Textdraw4, 1);
TextDrawSetShadow(Textdraw4, 1);

Textdraw5 = TextDrawCreate(14.000000, 296.000000, "PACKETLOSS:");
TextDrawBackgroundColor(Textdraw5, 255);
TextDrawFont(Textdraw5, 1);
TextDrawLetterSize(Textdraw5, 0.310000, 0.799999);
TextDrawColor(Textdraw5, -1);
TextDrawSetOutline(Textdraw5, 0);
TextDrawSetProportional(Textdraw5, 1);
TextDrawSetShadow(Textdraw5, 1);

Textdraw6 = TextDrawCreate(22.000000, 232.000000, "SPECTATOR INFO");
TextDrawBackgroundColor(Textdraw6, 255);
TextDrawFont(Textdraw6, 1);
TextDrawLetterSize(Textdraw6, 0.379999, 1.499999);
TextDrawColor(Textdraw6, -1);
TextDrawSetOutline(Textdraw6, 0);
TextDrawSetProportional(Textdraw6, 1);
TextDrawSetShadow(Textdraw6, 1);
I already have the spec, specoff command, I wanted to know if anyone can explain to me how do I show them while an admin is spectating?

(p.s I've tried to search for a tutorial and I couldn't really find any.)


Re: Showing spectator info textdraw while using /spec - PepsiCola23 - 10.02.2018

You create the textdraws,and you show them when the admin uses /spec cmd and destroy the textdraws when he stops spectating.

you also need to use
PHP код:
TextDrawSetString 
to be able to get his information * health,armour etc


Re: Showing spectator info textdraw while using /spec - ivndosos - 10.02.2018

Can you explain and show a little bit further?


Re: Showing spectator info textdraw while using /spec - Mugala - 10.02.2018

this textdraws are globals and will not be shown a 2 different person a different variables.
create a PlayerTextDraw-s for each player to be shown in later.

just edit these textdraws to PlayerTextDraws

when admin uses a command /spec
you must set strings and then show to the admin.

example: /spec
PHP код:
new text[8];
format(text,sizeof(text),"ID: %d",targetid);
PlayerTextDrawSetString(playeridTextdraw2[playerid], text);
PlayerTextDrawShow(playerid,Textdraw2[playerid]); 
example: /specoff
PHP код:
PlayerTextDrawHide(playerid,Textdraw2[playerid]); 
you must also use a variables for players (new Textdraw2[MAX_PLAYERS]; and Textdraw2[playerid] = CreatePlayerTextDraw...)


Re: Showing spectator info textdraw while using /spec - Astralis - 11.02.2018

I'd suggest using something already-made:

https://sampforum.blast.hk/showthread.php?tid=635750


Re: Showing spectator info textdraw while using /spec - ivndosos - 11.02.2018

Quote:
Originally Posted by Astralis
Посмотреть сообщение
I'd suggest using something already-made:

https://sampforum.blast.hk/showthread.php?tid=635750
I'd rather not, I like making things my self