Player Markers
#1

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?
Reply
#2

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

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?
Reply
#4

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

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.
Reply
#6

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.
Reply
#7

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

Sorted, thanks.
Reply
#8

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()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)