Jump to content
  • 0

problema Safezone..


Cosmarul

Question

Problema intalnita (descriere): Poi, cand eu ma conectez intru in safe-zone, textdraw-ul apara si cand ies dispare, cum e si normal.. Dar daca se mai conecteaza un player, mie imi ramane activat textdrad-ul si doar celui care sa conectat ii mai dispare si apare textdraw-ul...
Ero(area / rile) / warning-(ul / urile): nu primesc warninguri.
Liniile de cod / sursa / script-ul(obligatoriu): 

forward SafeTimer();
public SafeTimer()
{
	foreach(new i : Player)
	{
	    new playerid;
	    if(IsPlayerConnected(playerid) && gLogged[playerid] == 1)
	    {
			for(new sf = 0; sf < MAX_SAFEZONES; sf++)
			{
				if(SafeZone[sf][szRange] >= 15)
				{
					if(PlayerToPoint(SafeZone[sf][szRange], i, SafeZone[sf][szX], SafeZone[sf][szY], SafeZone[sf][szZ]) && Showed[i] == 0)
					{
						Showed[i] = 1;
						SFID[i] = sf;
						TextDrawShowForPlayer(i, SafeTD[0]);
						return 1;
					}
					else if(!PlayerToPoint(SafeZone[SFID[i]][szRange], i, SafeZone[SFID[i]][szX], SafeZone[SFID[i]][szY], SafeZone[SFID[i]][szZ]) && Showed[i] == 1)
					{
						Showed[i] = 0;
						SFID[i] = 0;
						TextDrawHideForPlayer(i, SafeTD[0]);
						return 1;
					}
				}
			}
		}
	}
	return 1;
}


Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Da...

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

arata cum ai creat textdrawul SafeTD,

trebuie sa fie SafeTD[MAX_PLAYERS]

si cand folosesti textdrawhide/ sau show for player trebuie sa il faci pentru playerid,

 

Adica incearca sa inlocuiesti cu asta

 

public SafeTimer()
{
	foreach(new i : Player)
	{
	    new playerid;
	    if(IsPlayerConnected(playerid) && gLogged[playerid] == 1)
	    {
			for(new sf = 0; sf < MAX_SAFEZONES; sf++)
			{
				if(SafeZone[sf][szRange] >= 15)
				{
					if(PlayerToPoint(SafeZone[sf][szRange], i, SafeZone[sf][szX], SafeZone[sf][szY], SafeZone[sf][szZ]) && Showed[i] == 0)
					{
						Showed[i] = 1;
						SFID[i] = sf;
						TextDrawShowForPlayer(i, SafeTD[i]);
						return 1;
					}
					else if(!PlayerToPoint(SafeZone[SFID[i]][szRange], i, SafeZone[SFID[i]][szX], SafeZone[SFID[i]][szY], SafeZone[SFID[i]][szZ]) && Showed[i] == 1)
					{
						Showed[i] = 0;
						SFID[i] = 0;
						TextDrawHideForPlayer(i, SafeTD[i]);
						return 1;
					}
				}
			}
		}
	}
	return 1;
}
  • Upvote 1

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
2 hours ago, Mister said:

arata cum ai creat textdrawul SafeTD,

trebuie sa fie SafeTD[MAX_PLAYERS]

si cand folosesti textdrawhide/ sau show for player trebuie sa il faci pentru playerid,

 

Adica incearca sa inlocuiesti cu asta

 


public SafeTimer()
{
	foreach(new i : Player)
	{
	    new playerid;
	    if(IsPlayerConnected(playerid) && gLogged[playerid] == 1)
	    {
			for(new sf = 0; sf < MAX_SAFEZONES; sf++)
			{
				if(SafeZone[sf][szRange] >= 15)
				{
					if(PlayerToPoint(SafeZone[sf][szRange], i, SafeZone[sf][szX], SafeZone[sf][szY], SafeZone[sf][szZ]) && Showed[i] == 0)
					{
						Showed[i] = 1;
						SFID[i] = sf;
						TextDrawShowForPlayer(i, SafeTD[i]);
						return 1;
					}
					else if(!PlayerToPoint(SafeZone[SFID[i]][szRange], i, SafeZone[SFID[i]][szX], SafeZone[SFID[i]][szY], SafeZone[SFID[i]][szZ]) && Showed[i] == 1)
					{
						Showed[i] = 0;
						SFID[i] = 0;
						TextDrawHideForPlayer(i, SafeTD[i]);
						return 1;
					}
				}
			}
		}
	}
	return 1;
}

Tot nu merge, textdraw-ul cu SafeTD nu il am pe Max_players, cand incerc sa il pun imi da foarte multe erori..

new Text:SafeTD[1];
	SafeTD[0] = TextDrawCreate(269.853546, 4.500005, "Safe-Zone");
	TextDrawLetterSize(SafeTD[0], 0.573821, 1.844999);
	TextDrawAlignment(SafeTD[0], 1);
	TextDrawColor(SafeTD[0], 1509249535);
	TextDrawSetShadow(SafeTD[0], 0);
	TextDrawSetOutline(SafeTD[0], 1);
	TextDrawBackgroundColor(SafeTD[0], 255);
	TextDrawFont(SafeTD[0], 3);
	TextDrawSetProportional(SafeTD[0], 1);
	TextDrawSetShadow(SafeTD[0], 0);

 

Link to comment
Share on other sites

  • 0
On ‎7‎/‎19‎/‎2016 at 16:03, Cosmarul said:

Tot nu merge, textdraw-ul cu SafeTD nu il am pe Max_players, cand incerc sa il pun imi da foarte multe erori..


new Text:SafeTD[1];
	SafeTD[0] = TextDrawCreate(269.853546, 4.500005, "Safe-Zone");
	TextDrawLetterSize(SafeTD[0], 0.573821, 1.844999);
	TextDrawAlignment(SafeTD[0], 1);
	TextDrawColor(SafeTD[0], 1509249535);
	TextDrawSetShadow(SafeTD[0], 0);
	TextDrawSetOutline(SafeTD[0], 1);
	TextDrawBackgroundColor(SafeTD[0], 255);
	TextDrawFont(SafeTD[0], 3);
	TextDrawSetProportional(SafeTD[0], 1);
	TextDrawSetShadow(SafeTD[0], 0);

 

new Text:SafeTD[1][MAX_PLAYERS];//la inceputul gm-ului

//la OnPlayerConnect
	SafeTD[0][playerid] = TextDrawCreate(269.853546, 4.500005, "Safe-Zone");
	TextDrawLetterSize(SafeTD[0][playerid], 0.573821, 1.844999);
	TextDrawAlignment(SafeTD[0][playerid], 1);
	TextDrawColor(SafeTD[0][playerid], 1509249535);
	TextDrawSetShadow(SafeTD[0][playerid], 0);
	TextDrawSetOutline(SafeTD[0][playerid], 1);
	TextDrawBackgroundColor(SafeTD[0][playerid], 255);
	TextDrawFont(SafeTD[0][playerid], 3);
	TextDrawSetProportional(SafeTD[0][playerid], 1);
	TextDrawSetShadow(SafeTD[0][playerid], 0);

TextDrawShowForPlayer(playerid, SafeTD[0][playerid]);//unde ai nevoie
TextDrawShowForPlayer(playerid, SafeTD[0][playerid]);//unde ai nevoie

La fel faci si la alte td-ri daca este cazul.

  • Upvote 1

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0

nu, nu are legatura, este greseala mea, el foloseste [MAX_PLAYERS] atunci cand textdrawul este un string iar el n uare nevoie de string, 

Deci nu trebuie sa modifice cum i-ai dat tu, doar ca este prost scris codul asta

for(new sf = 0; sf < MAX_SAFEZONES; sf++)
			{
				if(SafeZone[sf][szRange] >= 15)
				{
					if(PlayerToPoint(SafeZone[sf][szRange], i, SafeZone[sf][szX], SafeZone[sf][szY], SafeZone[sf][szZ]) && Showed[i] == 0)
					{
						Showed[i] = 1;
						SFID[i] = sf;
						TextDrawShowForPlayer(i, SafeTD[i]);
						return 1;
					}
					if(!PlayerToPoint(SafeZone[SFID[i]][szRange], i, SafeZone[SFID[i]][szX], SafeZone[SFID[i]][szY], SafeZone[SFID[i]][szZ]) && Showed[i] == 1)
					{
						Showed[i] = 0;
						SFID[i] = 0;
						TextDrawHideForPlayer(i, SafeTD[i]);
						return 1;
					}
				}
			}

 

 

 

 

  • Upvote 1

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
4 hours ago, DaEdRiC-FoX said:

new Text:SafeTD[1][MAX_PLAYERS];//la inceputul gm-ului

//la OnPlayerConnect
	SafeTD[0][playerid] = TextDrawCreate(269.853546, 4.500005, "Safe-Zone");
	TextDrawLetterSize(SafeTD[0][playerid], 0.573821, 1.844999);
	TextDrawAlignment(SafeTD[0][playerid], 1);
	TextDrawColor(SafeTD[0][playerid], 1509249535);
	TextDrawSetShadow(SafeTD[0][playerid], 0);
	TextDrawSetOutline(SafeTD[0][playerid], 1);
	TextDrawBackgroundColor(SafeTD[0][playerid], 255);
	TextDrawFont(SafeTD[0][playerid], 3);
	TextDrawSetProportional(SafeTD[0][playerid], 1);
	TextDrawSetShadow(SafeTD[0][playerid], 0);

TextDrawShowForPlayer(playerid, SafeTD[0][playerid]);//unde ai nevoie
TextDrawShowForPlayer(playerid, SafeTD[0][playerid]);//unde ai nevoie

La fel faci si la alte td-ri daca este cazul.

A mers, v-am dat un +1 pentru ajutor, multumesc.

Link to comment
Share on other sites

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.