31.08.2011, 22:07
Alguйm pode me ajudar para quando cair com o carro na бgua, ele automaticamente se destruir?
SetTimer("CheckVehiclePos", 1000, true); // dentro da public OnGameModeInit
forward CheckVehiclePos();// No fim do GM
public CheckVehiclePos()
{
new x, y, Float:z;
for(new i=0; i<MAX_PLAYERS; i++)
GetPlayerPos(i, x,y,z);
if(IsPlayerInAnyVehicle(i) && z <= 0)
{
DestroyVehicle(GetPlayerVehicleID(i));
}
}
}
Como shadow acabou de falar, qdo um carro cai na agua ele respawna sozinho, porem enquanto o player ta dentro do carro ele n respawna, portanto vc pode fazer desse jeito...
pawn Код:
|
stock IsVehicleInWater(vehicleid)
{
new Float:x,Float:y,Float:pz;
GetVehiclePos(vehicleid, x, y, pz);
if(IsVehicleInArea(vehicleid, 381.7009, 782.9656, 710.9611, 965.2859)) return 0;
if(
(IsVehicleInArea(vehicleid, 2032.1371, 1841.2656, 1703.1653, 1467.1099) && pz <= 9.0484)
|| (IsVehicleInArea(vehicleid, 2109.0725, 2065.8232, 1962.5355, 10.8547) && pz <= 10.0792)
|| (IsVehicleInArea(vehicleid, -492.5810, -1424.7122, 2836.8284, 2001.8235) && pz <= 41.06)
|| (IsVehicleInArea(vehicleid, -2675.1492, -2762.1792, -413.3973, -514.3894) && pz <= 4.24)
|| (IsVehicleInArea(vehicleid, -453.9256, -825.7167, -1869.9600, -2072.8215) && pz <= 5.72)
|| (IsVehicleInArea(vehicleid, 1281.0251, 1202.2368, -2346.7451, -2414.4492) && pz <= 9.3145)
|| (IsVehicleInArea(vehicleid, 2012.6154, 1928.9028, -1178.6207, -1221.4043) && pz <= 18.45)
|| (IsVehicleInArea(vehicleid, 2326.4858, 2295.7471, -1400.2797, -1431.1266) && pz <= 22.615)
|| (IsVehicleInArea(vehicleid, 2550.0454, 2513.7588, 1583.3751, 1553.0753) && pz <= 9.4171)
|| (IsVehicleInArea(vehicleid, 1102.3634, 1087.3705, -663.1653, -682.5446) && pz <= 112.45)
|| (IsVehicleInArea(vehicleid, 1287.7906, 1270.4369, -801.3882, -810.0527) && pz <= 87.123)
|| (pz < 1.5)
)
{
return 1;
}
return 0;
}