Anti Car Parking
#1

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);
				}
			}
Reply
#2

Somebody ?
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)