SA-MP Forums Archive
Updating SetPlayerMarkerForPlayer - 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)
+--- Thread: Updating SetPlayerMarkerForPlayer (/showthread.php?tid=536077)



Updating SetPlayerMarkerForPlayer - iOxide - 07.09.2014

Hi,

Can anyone help me with SetPlayerMarkerForPlayer function? I currently a timer running to update the marker on radar. Like:
pawn Код:
//OnPlayerSpawn: SetTimerEx("Police_CheckWanted", 1000, true, "d", playerid);
forward Police_CheckWanted(playerid);
public Police_CheckWanted(playerid)
{
    foreach(Player, i)
    {
        if (GetPlayerWantedLevel(i) > 0)
            SetPlayerMarkerForPlayer(playerid, i, RED);
        else
        {
            switch (pInfo[i][Class])
            {
                case TRUCKER: SetPlayerMarkerForPlayer(playerid, i, COLOR_TRUCKER);
                case PILOT: SetPlayerMarkerForPlayer(playerid, i, COLOR_PILOT);
                case POLICE: SetPlayerMarkerForPlayer(playerid, i, COLOR_POLICE);
                case MECHANIC: SetPlayerMarkerForPlayer(playerid, i, COLOR_MECHANIC);
            }
        }
    }
}
And its kinda buggy like if i set another marker, the marker is flashing with 2 or 3 colors. Are there any ways that i can update it without having to set a timer? Or i must use a timer to keep updating it on radar?


Re: Updating SetPlayerMarkerForPlayer - iOxide - 08.09.2014

/bump


Re: Updating SetPlayerMarkerForPlayer - Pottus - 08.09.2014

Makes absolutely no sense to use a timer for this for one.


Re: Updating SetPlayerMarkerForPlayer - DavidBilla - 08.09.2014

Is it possible for your players to change class without having to spawn again ? If not,then there is no need for using a timer,you can just use the Onplayerrequestclass area to put your codes.
Just imagine what happens if a server with about 50 players keeps updating each player's marker every second.


Re: Updating SetPlayerMarkerForPlayer - iOxide - 08.09.2014

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Makes absolutely no sense to use a timer for this for one.
Well, without a timer i had a problem like, the marker was resetting to normal player color after the player has been streamed out. Thats why i had to set a timer to keep updating the marker whenever player streams out, but setting a timer was pretty buggy so i came here for help.