09.11.2009, 20:09
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:
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; }