open.mp forum
[Pawn] Does the fire truck's water launcher haves sync with the server? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Does the fire truck's water launcher haves sync with the server? (/showthread.php?tid=1723)



Does the fire truck's water launcher haves sync with the server? - Marllun - 2021-03-01

Does the fire truck's water launcher haves sync with the server?


RE: Does the fire truck's water launcher haves sync with the server? - destiezk - 2021-03-01

What do you mean by that?


RE: Does the fire truck's water launcher haves sync with the server? - Marllun - 2021-03-01

Do you know the water launcher on the fire truck? has some way of detecting that it is being used, and the position that the water is falling?


RE: Does the fire truck's water launcher haves sync with the server? - destiezk - 2021-03-01

I'm not sure if that's possible


RE: Does the fire truck's water launcher haves sync with the server? - Pinch - 2021-03-01

Check if Weapon Shot callback is called (it's probably not), see key changes and if they're in a firetruck as a driver and holding LMB - that's it.


RE: Does the fire truck's water launcher haves sync with the server? - destiezk - 2021-03-01

Actually, I have an idea for you. (Although, I'm not sure if it will work). There is no need to do anything in OnPlayerWeaponShot.

Code:
new gFireTruckID = 407;

#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if (IsPlayerInVehicle(playerid, gFireTruckID))
     {
        if (HOLDING(KEY_FIRE) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
           SendClientMessage(playerid, -1, "You are currently spreading water from a Firetruck.");
        }
     }

     return 1;
}



RE: Does the fire truck's water launcher haves sync with the server? - Marllun - 2021-03-01

(2021-03-01, 03:24 PM)destiezk Wrote: Actually, I have an idea for you. (Although, I'm not sure if it will work). There is no need to do anything in OnPlayerWeaponShot.



Code:
new gFireTruckID = 407;



#define HOLDING(%0) \

((newkeys & (%0)) == (%0))



public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

{

? ? if (IsPlayerInVehicle(playerid, gFireTruckID))

? ? {

? ? ? ? if (HOLDING(KEY_FIRE) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)

? ? ? ? {

? ? ? ? ? SendClientMessage(playerid, -1, "You are currently spreading water from a Firetruck.");

? ? ? ? }

? ? }



? ? return 1;

}



I've used this script, but it's inaccurate because I can't know where the player is pointing.


RE: Does the fire truck's water launcher haves sync with the server? - destiezk - 2021-03-01

(2021-03-01, 03:35 PM)Marllun Wrote:
(2021-03-01, 03:24 PM)destiezk Wrote: Actually, I have an idea for you. (Although, I'm not sure if it will work). There is no need to do anything in OnPlayerWeaponShot.



Code:
new gFireTruckID = 407;



#define HOLDING(%0) \

((newkeys & (%0)) == (%0))



public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

{

? ? if (IsPlayerInVehicle(playerid, gFireTruckID))

? ? {

? ? ? ? if (HOLDING(KEY_FIRE) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)

? ? ? ? {

? ? ? ? ? SendClientMessage(playerid, -1, "You are currently spreading water from a Firetruck.");

? ? ? ? }

? ? }



? ? return 1;

}



I've used this script, but it's inaccurate because I can't know where the player is pointing.



I'm not sure why it is inaccurate? It writes if you're spreading water, getting the position where the water is falling is not possible I think, but correct me somebody


RE: Does the fire truck's water launcher haves sync with the server? - rasheed - 2021-03-01

Im not sure but you can try theese functions:



Code:
GetPlayerCameraPos

Code:
GetPlayerCameraFrontVector



RE: Does the fire truck's water launcher haves sync with the server? - Marllun - 2021-03-02

(2021-03-01, 07:10 PM)rasheed Wrote: Im not sure but you can try theese functions:



Code:
GetPlayerCameraPos

Code:
GetPlayerCameraFrontVector



Thanks, using this, to be able to make an object in front of the camera (where it is looking at) and compare the distance with the coordinate.