07.12.2014, 07:51
I have a RPG gamemode and I need an engine & lights system for vehicles.
I didn't find a well explained tutorial, so if anyone could help, it would be great.
What I want?
- When server starts, all engines should be turned OFF
- While turned off, the vehicle shouldn't use FUEL (I have a fuel system)
- Lights should turn on/off using a KEY (maybe CTRL??)
- Engine could have an /engine command, but a key would be also good.
Fuel:
I didn't find a well explained tutorial, so if anyone could help, it would be great.
What I want?
- When server starts, all engines should be turned OFF
- While turned off, the vehicle shouldn't use FUEL (I have a fuel system)
- Lights should turn on/off using a KEY (maybe CTRL??)
- Engine could have an /engine command, but a key would be also good.
Fuel:
Код:
public CheckGas()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
if(gGas[i] == 1) {
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsASC(vehicle))
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Fuel: ~g~None");
}
else
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Fuel: ~g~%d%",Gas[vehicle]);
GameTextForPlayer(i,string,15500,3); }
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsASC(vehicle)) { Gas[vehicle]++; }
Gas[vehicle]--;
}
else
{
NoFuel[i] = 1;
TogglePlayerControllable(i, 0);
GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~w~NO FUEL ~n~ USE /EXIT",1500,3);
}
}
}
}
return 1;
}



)