Will this work?
#1

Will this code work? I've scripted this but I can't test it with my self ^^
Player who will write /bk (backup) will be seen to other officers as purple marker on map? but other players won't see him?

pawn Код:
CMD:bk(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if (!IsPlayerCop(playerid))
        {
            SendClientMessage(playerid, 0xFF0000AA, "You are not authorized to use this command");
        }
        new string[100];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), ".:DISPATCH:.: ALL UNITS! %s is requesting immediate assistance, they have been marked on the radar.", pName);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerCop(i))
            {
                SendClientMessage(i,0x0FFDD349,string);
                SetPlayerMarkerForPlayer(i, playerid, COLOR_PURPLE);
            }
        }
    }
    return 1;
}
Reply
#2

I think it will work, tho you can set the marker as different color for the rest of the players..
Reply
#3

Make sure ShowPlayerMarkers was set to 1 (global) in order to be shown to whoever is cop but not streamed.

pawn Код:
public OnGameModeInit( )
{
    ShowPlayerMarkers( 1 );
    return 1;
}
Reply
#4

Well it's for RP script and I want only "cops" can see the guys who is requesting backup ^^ I guess I need to test it somehow :P, thanks for answer

@Konstan..: Umm I don't want that every player will be marked on map I only want a guy who is requesting backup will be seen by other officers? so will my code work like this or I need to change anything?
Reply
#5

I just tested it for you and it's working like charm.
Reply
#6

Quote:
Originally Posted by Lajko1
Посмотреть сообщение
@Konstan..: Umm I don't want that every player will be marked on map I only want a guy who is requesting backup will be seen by other officers? so will my code work like this or I need to change anything?
Your code allows only those players who are cops to see the marker; however if the function I posted was set to off or streamed then it won't show the marker. If it was set to off, it won't show the marker at all. If it was set to streamed, it will only show the marker to whoever cop is in range of 300 (streamed).

You must set it to global and then if you don't want players see everyone's marker, you disable it by setting the color's alpha to 00 (invisible).
Reply
#7

Umm thanks but how I can set it to streamed and set it to global? may you help me to figure out with this please ^^
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Make sure ShowPlayerMarkers was set to 1 (global) in order to be shown to whoever is cop but not streamed.

pawn Код:
public OnGameModeInit( )
{
    ShowPlayerMarkers( 1 );
    return 1;
}
Konstantinos already did that for ya...
Reply
#9

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
I just tested it for you and it's working like charm.
Your testing was insufficient. Even if the player is NOT a cop, the function will still go through because of a missing return in the IsCop check. By the way; IsPlayerConnected is completely redundant. The player that executes the command is always connected. Logic, you know.
Reply
#10

Quote:
Originally Posted by Vince
Посмотреть сообщение
Your testing was insufficient. Even if the player is NOT a cop, the function will still go through because of a missing return in the IsCop check. By the way; IsPlayerConnected is completely redundant. The player that executes the command is always connected. Logic, you know.
I don't get it, I tested it with three players, One is cop and one isn't, The cop saw the message and my marker's new color, and the normal player didn't see the message and my marker color was the same, Also when I tried to use it while I'm not a cop, it gave me "You are not authorized to use this command", So how my testing was insufficient ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)