CarJacking - 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: CarJacking (
/showthread.php?tid=444242)
CarJacking -
thefatshizms - 15.06.2013
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?
Re: CarJacking -
Sandiel - 15.06.2013
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.)
AW: CarJacking -
Blackazur - 15.06.2013
https://sampforum.blast.hk/showthread.php?tid=146885
Re: AW: CarJacking -
thefatshizms - 15.06.2013
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.
Re: AW: CarJacking -
Kyle - 16.06.2013
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