Anti Car Parking - 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: Anti Car Parking (
/showthread.php?tid=583887)
Anti Car Parking -
BruLaX - 31.07.2015
Hello, Im trying to make an anti car parking and i searched everywhere but didn't find anything.
So now what dit i try ? THIS is onplayertakedamage:
Код:
if(playerState == PLAYER_STATE_DRIVER)
{
GetAnimationName(GetPlayerAnimationIndex(playerid),l_animlib,32,l_animname,32);
if(weaponid == 49 || strcmp(l_animlib, "KO", true) == 0 && strcmp(l_animname, "SPIN_R", true) == 0)
{
GameTextForPlayer(issuerid,"~w~Car Parking is ~r~forbiden !", 3000, 3);
}
}
Re: Anti Car Parking -
BruLaX - 31.07.2015
Somebody ?
Re: Anti Car Parking -
Abagail - 31.07.2015
Something such as this should work:
pawn Код:
#include <a_samp>
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid == INVALID_PLAYER_ID || issuerid == playerid) return true;
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerState(issuerid) == PLAYER_STATE_DRIVER)
{
new Float: x, Float: y, Float: z, Float: vx, Float: vy, Float: vz;
GetPlayerPos(playerid, x, y, z);
GetVehiclePos(GetPlayerVehicleID(issuerid), vx, vy, vz);
if(vz - z <= 0)
{
// the player may be car parking
}
}
return 1;
}
Though for death reasons, death reason 49 will detect if the player has killed the player with their vehicle, you can use this and Z positions to determine if they car parked or not.