SetPlayerMarkerForPlayer, to update?
#1

Hello, i have gangchats in my roleplay server, when you type /joingang [number] it will show you a marker at the minimap for all the players in the gang, but after shortly time the marker will be gone, is there a way to update the marker every 2 second? or something like that


stock ShowGang(playah,gang)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][pGang] == gang && !PlayerInfo[i][pBanished])
{
SetPlayerMarkerForPlayer(i, playah, 0xAFAFAFAA);
SetPlayerMarkerForPlayer(playah, i, 0xAFAFAFAA);
}
}
return 1;
}
Reply
#2

pawn Code:
//Over ShowGang function
forward HideGang(playerid)

//find
SetPlayerMarkerForPlayer(playah, i, 0xAFAFAFAA);
//add below
SetTimerEx("HideGang", 2000, false, "ii", playah, gang);

//Create
public HideGang(playah,gang) {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][pGang] == gang && !PlayerInfo[i][pBanished])
        {
            SetPlayerMarkerForPlayer(i, playah, 0xFFFFFF00);
            SetPlayerMarkerForPlayer(playah, i, 0xFFFFFF00);
        }
    }
    return 1;
}
I think that storing gangs in separate arrays would be more efficient than looping through all players.
Reply
#3

Do i have to remove stock then?
Reply
#4

Do not delete anything, just follow instructions exactly as written. HideGang has to be public due to usage in timer callback
Reply
#5

Alright, i did as you said, but when im trying to compile it i get this error "error 025: function heading differs from prototype"
Reply
#6

ah, yes, my mistake

pawn Code:
//change
forward HideGang(playerid);
//to
forward HideGang(playah, gang)
Reply
#7

Thanks alot
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)