26.03.2013, 09:38
...: Easy Mini System 'Engine Broken':...
(BASE)
Script:(BASE)
pawn Код:
/*
BY OTACON ;)
...: Easy Mini System 'Engine Broken':...
*/
#include <a_samp>
#define VALUE_MOTOR 350.0 //Stop the engine in Smoke Grey.
new MatarMotor[MAX_PLAYERS];
static Float:VidaMotor[MAX_VEHICLES];
public OnPlayerStateChange(playerid, newstate, oldstate) {
switch(GetPlayerState(playerid)) {
case PLAYER_STATE_DRIVER: { //State 'vehicle driver'
MatarMotor[playerid] = SetTimerEx("MotorRoto", 1000, true, "ii", playerid, GetPlayerVehicleID(playerid)); //Creamos el SetTimerEx obteniendo el Id del player y vehiculos Correspondiente.
}
case PLAYER_STATE_ONFOOT: { //State to 'walk'
KillTimer(MatarMotor[playerid]); //We killed the Corresponding SetTimer.
}
}
return true;
}
public OnPlayerSpawn(playerid) {
KillTimer(MatarMotor[playerid]); //We killed the Corresponding SetTimer when the player spawns.
return true;
}
public OnVehicleDeath(vehicleid, killerid) {
KillTimer(MatarMotor[killerid]); //Corresponding SetTimer killed the vehicle when the driver is destroyed.
return true;
}
forward MotorRoto(playerid, vehicleid);
public MotorRoto(playerid, vehicleid) {
if(IsPlayerConnected(playerid) && IsPlayerInVehicle(playerid, vehicleid)) { //We check if the player is connected and the corresponding vehicle.
GetVehicleHealth(vehicleid, VidaMotor[vehicleid]); /get corresponding vehicle life.
if(VidaMotor[vehicleid] <= VALUE_MOTOR) { //check if the life of the vehicle is less than or equal to the set.
SetVehicleHealth(vehicleid, VidaMotor[vehicleid]=VALUE_MOTOR); //establish the life of the vehicle that defined to avoid problems ;).
//Here the function you want to do when you have the engine broken.
//Here the function you want to do when you have the engine broken.
}
}
return true;
}
/*
BY OTACON ;)
...: Easy Mini System 'Engine Broken':...
*/
OTACON (I am¬¬)