Detecting someone punching a vehicle?
#1

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

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).
Reply
#3

Use OnPlayerKeyStateChange to check if a player is close to a vehicle and presses the attack key.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)