11.07.2015, 00:47
Please DON'T Use OnPlayerEnterVehicle In This case...
i'll Give you an example look at it and learn how i used timers, variables and SAMP functions from Wiki
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
https://sampwiki.blast.hk/wiki/GetVehicleModel
https://sampwiki.blast.hk/wiki/SetVehicleHealth
change X in this line: "#define YOUR_VEHICLE_MODEL X" to your vehicle model
good luck
i'll Give you an example look at it and learn how i used timers, variables and SAMP functions from Wiki
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
https://sampwiki.blast.hk/wiki/GetVehicleModel
https://sampwiki.blast.hk/wiki/SetVehicleHealth
Код:
#define YOUR_VEHICLE_MODEL X new ExplodeTimer[MAX_PLAYERS]; new bool:IsPlayerInExplodeVehicle[MAX_PLAYERS]; public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) { new VehicleID = GetPlayerVehicleID(playerid); if(GetVehicleModel(VehicleID) == YOUR_VEHICLE_MODEL) { IsPlayerInExplodeVehicle[playerid] = true; ExplodeTimer[playerid] = SetTimerEx("ShowExplodeMessage", 20000, false, "i", playerid); } } if(oldstate == PLAYER_STATE_DRIVER && IsPlayerInExplodeVehicle[playerid] == true) { IsPlayerInExplodeVehicle[playerid] = false; KillTimer(ExplodeTimer[playerid]); } return 1; } forward ShowExplodeMessage(playerid); public ShowExplodeMessage(playerid) { if(IsPlayerInExplodeVehicle[playerid] == true) { SendClientMessage(playerid, -1, "Your Message Here"); ExplodeTimer[playerid] = SetTimerEx("ExplodeVehicle", 5000, false, "i", playerid); } return 1; } forward ExplodeVehicle(playerid); public ExplodeVehicle(playerid) { if(IsPlayerInExplodeVehicle[playerid] == true) { new pVehicleID = GetPlayerVehicleID(playerid) SetVehicleHealth(pVehicleID, 0.0); IsPlayerInExplodeVehicle[playerid] = false; } return 1; }
good luck