Detecting someone punching a vehicle? - 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: Detecting someone punching a vehicle? (
/showthread.php?tid=608579)
Detecting someone punching a vehicle? -
Dokins - 03.06.2016
I realised that OnPlayerWeaponShot only accounts for bullet weapons.
Could someone please assist me with this matter?
I'm trying to use it to break into vehicles.
pawn Код:
if(hittype == 2 && weaponid == 0)
{
if(VehLock[hitid] == 0)return SendClientMessage(playerid, COLOUR_GREY, "This vehicle is already unlocked.");
if(VehicleFaction[hitid] > 0 && ThiefLevel[playerid] < 3)return SendClientMessage(playerid, COLOUR_GREY, "You must be thief level 3 to break into faction vehicles.");
if(VehJob[hitid] > 0)return SendClientMessage(playerid, COLOUR_GREY, "You cannot break into job vehicles.");
if(VehicleSQLID[hitid] < 1)return SendClientMessage(playerid, COLOUR_GREY, "You cannot break into Admin Spawned/Static Vehicles.");
new tstring[128];
new name = GetVehicleModel(hitid) - 400;
format(tstring, sizeof(tstring), "You still have %d minutes before you can use this command.", ThiefCooldown[playerid]);
if(ThiefCooldown[playerid] > 0) return SendClientMessage(playerid, COLOUR_GREY, tstring);
switch(ThiefLevel[playerid])
{
case 1:
{
VehicleHits[hitid] ++;
}
case 2:
{
VehicleHits[hitid] ++;
}
// blah..
Re: Detecting someone punching a vehicle? -
Abagail - 03.06.2016
You can use
this to calculate vehicle offsets and use it to compare the coordinates infront of the player(also take things such as the players facing angle into account).
Re: Detecting someone punching a vehicle? -
Onfroi - 03.06.2016
Use OnPlayerKeyStateChange to check if a player is close to a vehicle and presses the attack key.