SA-MP Forums Archive
Function Near other players - 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: Function Near other players (/showthread.php?tid=405281)



Function Near other players - Christoffer - 06.01.2013

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


Re: Function Near other players - InActtive™ - 06.01.2013

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


Re: Function Near other players - Christoffer - 06.01.2013

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.


Re: Function Near other players - nilanjay - 06.01.2013

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


Re: Function Near other players - ancezas - 06.01.2013

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;
    }



Re: Function Near other players - Christoffer - 06.01.2013

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?


Re: Function Near other players - Christoffer - 06.01.2013

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);



Re: Function Near other players - ancezas - 06.01.2013

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;
    }



Respuesta: Function Near other players - felipe123456 - 06.01.2013

como puedo entrar a jugar


Respuesta: Re: Function Near other players - felipe123456 - 06.01.2013

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