SA-MP Forums Archive
G abuse - 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: G abuse (/showthread.php?tid=557017)



G abuse - Cerealguy - 12.01.2015

Hi, friend , I could help or give an idea of how you could do that when a vehicle without a driver and this is a passenger in the passenger lay their weapons with 0 bullets or not generate any damage


Re: G abuse - rickisme - 12.01.2015

pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new
            driver = INVALID_PLAYER_ID,
            vehid = GetPlayerVehicleID(playerid);
        for(new i; i < GetMaxPlayers(); i++)
        {
            if(GetPlayerVehicleID(i) == vehid && GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                driver = i;
                break;
            }
        }
        if(driver == INVALID_PLAYER_ID && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return 0;
    }
    return 1;
}



Re: G abuse - M4D - 12.01.2015

In OnPlayerWeaponShot check:
Player is in any vehicle ?
If yes, player state is passenger ? (GetPlayerState)
If yes, then check that vehicle id has driver ?
If no, remove him from vehicle
But i think this isn't good idea because it will make a loop between player for each shot
I saw an include on the forum for 'G Bug abuse'
Search it (i'm on my phone i can't search sorry)

EDIT: i was slow, the guy above me replied faster
Sorry


Respuesta: G abuse - Cerealguy - 12.01.2015

thanks for the help, if it was faster has also happened to me haha