Function Near other players
#1

I need a function, that a text appears on the screen when a police vehicle have the /siren on command. This text on the screen should only be flashing when the players are near that vehicle. Please help
Reply
#2

I'm not understanding.. You mean by using the GameTextForPlayer function?
Reply
#3

The police vehicles will have a function with a command, called /sirens. When a police vehicle with the sirens on, all nearby players will get a textdraw on the screen, with two stars flashing blue and red.
Reply
#4

It will be better if you can write your faction syntax. The place where you define police faction.
Reply
#5

if i get it rigth you need script like this:

pawn Код:
if (strcmp("/siren", cmdtext, true, 6) == 0)
    {
        new
            Float:Coord[ 3 ];
        GetPlayerPos( playerid, Coord[ 0 ], Coord[ 1 ], Coord[ 2 ] );
        for( new i = 0; i < MAX_PLAYERS; i++ )
        {
            if( IsPlayerConnected( i ) )
            {
                if( IsPlayerInRangeOfPoint( i, 20.0, Coord[ 0 ], Coord[ 1 ], Coord[ 2 ] ) )
                {
                    GameTextForPlayer(playerid, "~r~]~b~]", 3000, 1);
                }
            }
        }
        return 1;
    }
Reply
#6

Yes, something like that... but I also need it to be turned on while the vehicle is driving. So when the police is responding to a place it's easier for people to clear the road.
I guess you need to add a "public" or something?
Reply
#7

Quote:
Originally Posted by ancezas
Посмотреть сообщение
if i get it rigth you need script like this:

pawn Код:
if (strcmp("/siren", cmdtext, true, 6) == 0)
    {
        new
            Float:Coord[ 3 ];
        GetPlayerPos( playerid, Coord[ 0 ], Coord[ 1 ], Coord[ 2 ] );
        for( new i = 0; i < MAX_PLAYERS; i++ )
        {
            if( IsPlayerConnected( i ) )
            {
                if( IsPlayerInRangeOfPoint( i, 20.0, Coord[ 0 ], Coord[ 1 ], Coord[ 2 ] ) )
                {
                    GameTextForPlayer(playerid, "~r~]~b~]", 3000, 1);
                }
            }
        }
        return 1;
    }
Thosen't this just make the stars pop up on the player typing the /siren command? Shouldn't it be like this?

pawn Код:
GameTextForPlayer(playerid, "~r~]~b~]", 3000, 1);
Reply
#8

Quote:
Originally Posted by Christoffer
Посмотреть сообщение
Thosen't this just make the stars pop up on the player typing the /siren command? Shouldn't it be like this?

pawn Код:
GameTextForPlayer(playerid, "~r~]~b~]", 3000, 1);
my mistake, sorry about that:


when in car:

pawn Код:
if (strcmp("/siren", cmdtext, true, 6) == 0)
    {
        if( IsPlayerInAnyVehicle( playerid ) ) // in any vehicle
        {
            new
                Float:Coord[ 3 ];
            GetPlayerPos( playerid, Coord[ 0 ], Coord[ 1 ], Coord[ 2 ] );
            for( new i = 0; i < MAX_PLAYERS; i++ )
            {
                if( IsPlayerConnected( i ) )
                {
                    if( IsPlayerInRangeOfPoint( i, 20.0, Coord[ 0 ], Coord[ 1 ], Coord[ 2 ] ) )
                    {
                        GameTextForPlayer( i, "~r~]~b~]", 3000, 1 );
                    }
                }
            }
        }
        return 1;
    }
Reply
#9

como puedo entrar a jugar
Reply
#10

Quote:
Originally Posted by InActtive™
Посмотреть сообщение
I'm not understanding.. You mean by using the GameTextForPlayer function?
xcomo puedo jugar
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)