Labeling script buged, what's wrong?
#1

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;
}
Reply
#2

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 : >
Reply
#3

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 =]
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)