OnPlayerWeaponShot when shooting a driver/passenger
#7

Quote:
Originally Posted by RogueDrifter
View Post
lmao, what i meant was, his problem is when a player is shot in a vehicle only hittype 2 is called, so what i was saying is why's that a problem when you can loop on hittype 2 for the driver of hitid (vehicle id) right? like this:
PHP Code:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    switch(
hittype)
    {
        case 
1:
        {
            if(
GetPlayerState(playerid) == 1)
            {
                
//player hit on foot.
                
}
            }
        case 
2:
        {
            for(new 
iGetPlayerPoolSize(); <= ji++)
            {
                if(!
IsPlayerConnected(i) || GetPlayerState(i) == 1) continue;
                if(
GetPlayerVehicleID(i) == hitid && GetPlayerState(i) ==2)
                {
                    
//driver of the vehicle that was hit by another player is 'i'
                    
}
                if(
GetPlayerVehicleID(i) == hitid && GetPlayerState(i) ==3)
                {
                    
//passenger of the vehicle shot
                    
}
                }
            }
        }
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)