SA-MP Forums Archive
Player Markers - 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: Player Markers (/showthread.php?tid=359632)



Player Markers - WinterAce - 14.07.2012

How do I make it so if an admin has "aDuty[playerid] == 1" then the admins marker shows in lime (COLOR_LIME) to all the players?


Re: Player Markers - RedJohn - 14.07.2012

If player is rcon admin then his name color and icon color will be lime color

pawn Код:
if(IsPlayerAdmin(playerid))
{
    SetPlayerColor(playerid, COLOR_LIME);
    return 1:
}



Re: Player Markers - WinterAce - 14.07.2012

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
If player is rcon admin then his name color and icon color will be lime color

pawn Код:
if(IsPlayerAdmin(playerid))
{
    SetPlayerColor(playerid, COLOR_LIME);
    return 1:
}
Thanks, where do I place this, OnGameModeInIt?
Also, does this show me on the map so other players can see where I am?


Re: Player Markers - Opah - 14.07.2012

if i was u i would on the command that sets aDuty[playerid] == 1 write
pawn Код:
new admincolor;
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/adutyon", true))
    {
        if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid,COLOR_RED,"You can't use this command !");
        aDuty[playerid] == 1
        admincolor = GetPlayerColor(playerid);
        SetPlayerColor(playerid,COLOR_LIME);
        return 1;
    }
    if(!strcmp(cmdtext, "/adutyoff", true))
    {
         if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid,COLOR_RED,"You can't use this command !");
        aDuty[playerid] == 0
        SetPlayerColor(playerid,admincolor);
        return 1;
    }
    return 0;
}
for the on radar thing if u want that all players don't appear on the radar but only if they have aDuty[playerid] == 1
then
pawn Код:
#define invisible 0xFFFFFF00

public OnPlayerUpdate(playerid)
{
    for(new i=0; i<MAXPLAYERS; i++)
    {
     if(aDuty[playerid] == 0){SetPlayerMarkerForPlayer(playerid, i, GetPlayerColor(playerid) & invisible);}
     else{SetPlayerMarkerForPlayer(playerid, i, COLOR_LIME & COLOR_LIME);}
    }
     return 1;
}



Re: Player Markers - SuperViper - 14.07.2012

Quote:
Originally Posted by Opah
Посмотреть сообщение
if i was u i would on the command that sets aDuty[playerid] == 1 write
pawn Код:
new admincolor;
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/adutyon", true))
    {
        if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid,COLOR_RED,"You can't use this command !");
        aDuty[playerid] == 1
        admincolor = GetPlayerColor(playerid);
        SetPlayerColor(playerid,COLOR_LIME);
        return 1;
    }
    if(!strcmp(cmdtext, "/adutyoff", true))
    {
         if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid,COLOR_RED,"You can't use this command !");
        aDuty[playerid] == 0
        SetPlayerColor(playerid,admincolor);
        return 1;
    }
    return 0;
}
for the on radar thing if u want that all players don't appear on the radar but only if they have aDuty[playerid] == 1
then
pawn Код:
#define invisible 0xFFFFFF00

public OnPlayerUpdate(playerid)
{
    for(new i=0; i<MAXPLAYERS; i++)
    {
     if(aDuty[playerid] == 0){SetPlayerMarkerForPlayer(playerid, i, GetPlayerColor(playerid) & invisible);}
     else{SetPlayerMarkerForPlayer(playerid, i, COLOR_LIME & COLOR_LIME);}
    }
     return 1;
}
Very bad idea to loop through all players under OnPlayerUpdate.


Re: Player Markers - TheArcher - 14.07.2012

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Very bad idea to loop through all players under OnPlayerUpdate.
Indeed, less than 1 second it loops 500 times which is very high.


- WinterAce - 14.07.2012

So would SetPlayerColor set a marker on the map for other players to see where I am?

Sorted, thanks.


Re: Player Markers - RedJohn - 15.07.2012

Quote:
Originally Posted by WinterAce
Посмотреть сообщение
Thanks, where do I place this, OnGameModeInIt?
Also, does this show me on the map so other players can see where I am?
You can place it
pawn Код:
public OnPlayerConnect(playerid)
Yes, they can see you but you need to have
pawn Код:
ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL)
under
pawn Код:
public OnGameModeInit()