CarJacking
#1

Hello, I'm trying to detect when someone car jacks a player. I tried detecting this by getting their animation and if it was the animation used to car jack the obviously they were carjacking.. but that was very buggy.

Does anyone know of a way to detect someone carjacking?
Reply
#2

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
          if(IsPlayerInVehicle(i, GetPlayerVehicleModel(GetPlayerVehicleID(playerid))) && playerid != i)
          {
                new iState = GetPlayerState(i);
                if(iState == PLAYER_STATE_DRIVER)
                {
                      // Do what's necessary to the carjacker (playerid) here.
                }
          }
    }
    return 1;
}
Not the most efficient way I can think of right now, but it is infact way better than the one you're currently using, hope this helps. (Compile error and in game errors may be presented, I haven't made this on pawn nor have I tested it, but should work fine.)
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=146885
Reply
#4

Quote:
Originally Posted by Sandiel
Посмотреть сообщение
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
          if(IsPlayerInVehicle(i, GetPlayerVehicleModel(GetPlayerVehicleID(playerid))) && playerid != i)
          {
                new iState = GetPlayerState(i);
                if(iState == PLAYER_STATE_DRIVER)
                {
                      // Do what's necessary to the carjacker (playerid) here.
                }
          }
    }
    return 1;
}
Not the most efficient way I can think of right now, but it is infact way better than the one you're currently using, hope this helps. (Compile error and in game errors may be presented, I haven't made this on pawn nor have I tested it, but should work fine.)
I don't want it in OnPlayerEnterVehicle as the player car jacking can "cancel" getting into the vehicle.. which I don't want.

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
That's to lock the car, not detect if it's being jacked.
Reply
#5

Quote:
Originally Posted by thefatshizms
Посмотреть сообщение
I don't want it in OnPlayerEnterVehicle as the player car jacking can "cancel" getting into the vehicle.. which I don't want.


That's to lock the car, not detect if it's being jacked.
https://sampforum.blast.hk/showthread.php?tid=278082
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)