Jump to content
  • 0

pomoc PlayerTextDraw


RoBiK

Dotaz

Ahoj, robil som PlayerTextDraw, neviem či bolo všetko správne ale je tu jedna chyba. Nejaký text chcem mať tou

farbou a nejaký inou, bohužial mi to ukázalo nejako takto: ?000000?Kills atd...

Neviete ako inak ?

format(string2,150,"{000000}I Kills: {23E11A}%d {000000}I Deaths: {23E11A}%d {000000}I EoS{23E11A} %d : {FF0000}%d {000000}Away I",kills[playerid],deaths[playerid],body_green,body_away);
Link to comment
Share on other sites

15 odpovědí na tuto otázku

Recommended Posts

  • 0

ok takze ukazuje good ale mam chybu, ID 0 ukazuje vsetko spravne, killy, deaths aj EoS body a Away body. Ale ! dalsim ID sa uz ani neobnovuje ten Textdraw(nezmizne a zase sa objavi) ani sa neukazuju tie čísla, kód:

 

Hore

new deaths[MAX_PLAYERS];new kills[MAX_PLAYERS];forward tabulka(playerid);forward tabulka2(playerid);

OnPlayerConnect

new string2[150];
	deaths[playerid]=0;
	kills[playerid]=0;
	format(string2,150,"~l~  I Kills: ~y~%d ~l~I Deaths: ~y~}%d ~l~I EoS ~g~%d : ~r~%d ~l~Away I",kills[playerid],deaths[playerid],body_green,body_away);
    Textdraw0 = CreatePlayerTextDraw(playerid,4.000000, 435.000000,string2);
	PlayerTextDrawBackgroundColor(playerid,Textdraw0, 255);
	PlayerTextDrawFont(playerid,Textdraw0, 2);
	PlayerTextDrawLetterSize(playerid,Textdraw0, 0.500000, 1.000000);
	PlayerTextDrawColor(playerid,Textdraw0, 255);
	PlayerTextDrawSetOutline(playerid,Textdraw0, 0);
	PlayerTextDrawSetProportional(playerid,Textdraw0, 0);
	PlayerTextDrawSetShadow(playerid,Textdraw0, 1);
	PlayerTextDrawUseBox(playerid,Textdraw0, 1);
	PlayerTextDrawBoxColor(playerid,Textdraw0, 16777215);
	PlayerTextDrawTextSize(playerid,Textdraw0, 636.000000, 419.000000);
	PlayerTextDrawSetSelectable(playerid,Textdraw0, 0);
	PlayerTextDrawShow(playerid, Textdraw0);

OnPlayerDeath

deaths[playerid]++;
kills[killerid]++;

a potom uz dole

 

 

public tabulka(playerid)
{
    PlayerTextDrawHide(playerid,Textdraw0);
    SetTimer("tabulka2",200,false);
    return 1;
}
 
public tabulka2(playerid)
{
new string2[150];
format(string2,150,"~l~  I Kills: ~y~%d ~l~I Deaths: ~y~}%d ~l~I EoS ~g~%d : ~r~%d ~l~Away I",kills[playerid],deaths[playerid],body_green,body_away);
    Textdraw0 = CreatePlayerTextDraw(playerid,4.000000, 435.000000,string2);
    PlayerTextDrawBackgroundColor(playerid,Textdraw0, 255);
PlayerTextDrawFont(playerid,Textdraw0, 2);
PlayerTextDrawLetterSize(playerid,Textdraw0, 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Textdraw0, 255);
PlayerTextDrawSetOutline(playerid,Textdraw0, 0);
PlayerTextDrawSetProportional(playerid,Textdraw0, 0);
PlayerTextDrawSetShadow(playerid,Textdraw0, 1);
PlayerTextDrawUseBox(playerid,Textdraw0, 1);
PlayerTextDrawBoxColor(playerid,Textdraw0, 16777215);
PlayerTextDrawTextSize(playerid,Textdraw0, 636.000000, 419.000000);
PlayerTextDrawSetSelectable(playerid,Textdraw0, 0);
    PlayerTextDrawShow(playerid, Textdraw0);
    SetTimer("tabulka",3500,false);
    return 1;
}

Link to comment
Share on other sites

  • 0

takže som to nejako urobil že hore kde boli tie forwardy som dal preč playerid a tu v tabulka2,tabulka tiež, nevyhadzuje errory ale server sa zapne asi na 5 sec ;(

public tabulka()
{
	for(new id; id<MAX_PLAYERS; id++)
	{
    PlayerTextDrawHide(id,Textdraw0);
    SetTimer("tabulka2",200,false);
    }
    return 1;
}

public tabulka2()
{
	for(new id; id<MAX_PLAYERS; id++)
	{
	new string2[150];
	format(string2,150,"~l~  I Kills: ~y~%d ~l~I Deaths: ~y~}%d ~l~I EoS ~g~%d : ~r~%d ~l~Away I",kills[id],deaths[id],body_green,body_away);
    Textdraw0 = CreatePlayerTextDraw(id,4.000000, 435.000000,string2);
    PlayerTextDrawBackgroundColor(id,Textdraw0, 255);
	PlayerTextDrawFont(id,Textdraw0, 2);
	PlayerTextDrawLetterSize(id,Textdraw0, 0.500000, 1.000000);
	PlayerTextDrawColor(id,Textdraw0, 255);
	PlayerTextDrawSetOutline(id,Textdraw0, 0);
	PlayerTextDrawSetProportional(id,Textdraw0, 0);
	PlayerTextDrawSetShadow(id,Textdraw0, 1);
	PlayerTextDrawUseBox(id,Textdraw0, 1);
	PlayerTextDrawBoxColor(id,Textdraw0, 16777215);
	PlayerTextDrawTextSize(id,Textdraw0, 636.000000, 419.000000);
	PlayerTextDrawSetSelectable(id,Textdraw0, 0);
    PlayerTextDrawShow(id, Textdraw0);
    SetTimer("tabulka",3500,false);
    }
    return 1;
}

s for() som nikdy nerobil takže neviem

Link to comment
Share on other sites

  • 0

problém bych viděl hlavně v tomhle

Textdraw0 = CreatePlayerTextDraw

Ukládáš všechny PTD do jedný proměný. Udělej si na to pole. :)

 

A ten kód co tu máš se nedivim že ti schazuje server. Ty v jednom publicu vytvoříš 500 TDcek, zároveň vytvoříš 500 timerů na 3,5 sekundy, následně 500x spustíš tabulka(), tim schováš hráčům TDčka. A následně ti to vytvoří 250 000 timerů na 200 milisekund aby to 250 000x spustilo tabulka2().

 

 

Hoooooooodně sebevražednej script. :d

Link to comment
Share on other sites

  • 0

PlayerTextDraw sa vytvára v OnPlayerConnect, potom ho už len zobrazuješ/vypínaš a upravuješ string :)

 

+ daj si tam ešte IsPlayerConnected za cyklus :)

Link to comment
Share on other sites

  • 0

Jsou tu na to návody. :) projdi si návod na Pole, Cyklus a nastuduj si PlayerTextDraw na sa-mp wiki. :) Uvidíš jak to pak bude snadný.

 

a než se do toho víc pustíš, zkus raději zjistit něco o "foreach" includu. :) Dost ti to usnadní práci s cykly. Jelikož používat na tyhle věci klasické "for" je dost zpátečnické a neoptimalizované.

Edited by Om3n
Link to comment
Share on other sites

  • 0

díky :) nejako som to opravil, niekedy sa stane ze sa nejaky hrac odpoji a mne sa nastavi vsetko na 0 jak keby, ale ked dam /kill (deaths[playerid]++;) tak mam to zase spatky

Link to comment
Share on other sites

  • 0

Proste myslenka:

 

textdraw vytvoris na zcatku, potom jak ti poradili pomoci TextDrawSetString mu muzes menit text. Ale priorita je ten textdraw vytvorti jen jednou nazacatku a potom to uz jen updatovat.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...