SA-MP Forums Archive
Who is driving the car I shoot - 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: Who is driving the car I shoot (/showthread.php?tid=559551)



Who is driving the car I shoot - Flokx - 23.01.2015

Thanks guys >..... Worked


Respuesta: Who is driving the car I shoot - Zume - 23.01.2015

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        /* Yes, shooting in car ..
        You can use GetPlayerVehicleID to be more ..
            accurate in ID, or your model with GetVehicleModel (GetPlayerVehicleID (playerid)) .. */

    }
    return 1;
}
I do not know if it's really what you meant, I do not speak English in its entirety.


Re: Who is driving the car I shoot - Abagail - 24.01.2015

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
      if(hittype == HIT_TYPE_VEHICLE)
      {
             if(hitid != INVALID_VEHICLE_ID)
             {
                      new driver = INVALID_PLAYER_ID;
                      foreach(new i: Player)
                      {
                              if(GetPlayerVehicleID(i) == hitid && GetPlayerState(i) == PLAYER_STATE_DRIVER)
                              {
                                      driver = i;
                                      break;
                              }
                      }
                       if(driver != INVALID_PLAYER_ID)
                       {
                           // Put your codes here.
                       }
                       else // do something here if there isn't a driver in said vehicle.
             }
     }
     return 1;
}



Re: Who is driving the car I shoot - Flokx - 24.01.2015

Thanks guys^^