SA-MP Forums Archive
Labeling script buged, what's wrong? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Labeling script buged, what's wrong? (/showthread.php?tid=107454)



Labeling script buged, what's wrong? - DiDok - 09.11.2009

Hi!
I made labeling script for my server, optimised is as much as possible, but it's not working properly - sometimes it creates labels for wrong players (not for cops or mafia), makes them without reason (player is not suspect) or it doesn't create any labels at all... What is wrong with this script? Thanks in advance for help!

Code is called by timer every 2 seconds:

Код:
public AttachLabels()
{
	for(new i=0; i<=SLOTS; i++)
	{
	  if (PlayerLabels[i] != 0)
		{
			for(new l=1; l<=PlayerLabels[i]; l++)
			{
				DeletePlayer3DTextLabel(i,Label[i][l]);
			}
			PlayerLabels[i] = 0;
		}
		if (IsPlayerConnected(i) == 1)
		{
			if (gTeam[i] == TEAM_MAFIA)
			{
				for(new v=0; v<=CARS; v++)
				{
		  		if (MafiaTarget[v] == 1)
		  		{
		  	 		PlayerLabels[i]++;
		    		Label[i][PlayerLabels[i]] = CreatePlayer3DTextLabel(i,"HIJACK THIS TRAILER!",COLOR_RED,0.0,0.0,1.0,100.0,INVALID_PLAYER_ID,v,1);
		    	}
		  	}
			}
			if (gTeam[i] == TEAM_COP)
			{
				for(new s=0; s<=SLOTS; s++)
				{
				  if (IsPlayerConnected(s) == 1)
					{
		  			if (GetPlayerWantedLevel(s) != 0)
		  			{
		  	 			PlayerLabels[i]++;
		    			Label[i][PlayerLabels[i]] = CreatePlayer3DTextLabel(i,"SUSPECT",COLOR_BLUE,0.0,0.0,1.0,100.0,s,INVALID_VEHICLE_ID,1);
		    		}
					}
		  	}
			}
		}
	}
	return 1;
}



Re: Labeling script buged, what's wrong? - LarzI - 09.11.2009

This should be in 0.3 Scripting.

And sorry I can't help ya :P
Haven't gotten into the 0.3 scripting features yet : >


Re: Labeling script buged, what's wrong? - DiDok - 09.11.2009

Oh damn, maybe you're right, but I think the problems is with executing the functions only, not their behaviour so it belongs to both categories =]


Re: Labeling script buged, what's wrong? - DiDok - 11.11.2009

Bump, noone can help me? I tried to fix it on my own and failed...