07.12.2011, 22:36
PHP код:
CMD:engine(playerid,params[])
{
for(new x; x < GetPlayerVehicleID(playerid); x++)
{
if(vehicleVariables[x][vEngine] == 0)
{
new vid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,1,lights,alarm,doors,bonnet,boot,objective);
timer69 = SetTimer("fueltimer",20000,true);
vehicleVariables[x][vEngine] = 1;
new str[128],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(str,sizeof(str),"%s turns the key of the engine to start the vehicle.",pName);
nearByMessage(playerid, COLOR_PURPLE, str, 5.0);
}
else if(vehicleVariables[x][vEngine] == 1)
{
new vid = GetPlayerVehicleID(playerid),str[128],pName[MAX_PLAYER_NAME];
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective);
KillTimer(timer69);
vehicleVariables[x][vEngine] = 0;
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(str,sizeof(str),"%s turns the key of the engine to stop the vehicle.",pName);
nearByMessage(playerid, COLOR_PURPLE, str, 5.0);
}
else if(vehicleVariables[x][vFuel] == 0)
{
SendClientMessage(playerid,COLOR_WHITE,"Vehicle is out of fuel.");
}
}
return 1;
}