Engines wont start! -
Oscii - 26.07.2012
Hello.
When someone types /engine the engine doesn't actually start!
please help!
pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gEngine[playerid] == 0)
{
SCM(playerid, COLOR_PINK, "Car engine started.");
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(pveh, 1, lights, alarm, doors, bonnet, boot, objective);
gEngine[playerid] = 1;
engineOn[pveh] = 1;
format(string, sizeof(string), "%s starts the car's engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else if(gEngine[playerid] == 1)
{
SCM(playerid, COLOR_PINK, "Car engine stopped.");
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(pveh, 0, lights, alarm, doors, bonnet, boot, objective);
gEngine[playerid] = 0;
engineOn[pveh] = 0;
format(string, sizeof(string), "%s stops the car's engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else
{
SCM(playerid, COLOR_CREAM, "You cannot start the engine as passenger.");
return 1;
}
}
else
{
SCM(playerid, COLOR_CREAM, "You are not in a vehicle.");
return 1;
}
}
}
Re: Engines wont start! -
maramizo - 26.07.2012
Then get a new engine, ha. ha. ha.
No honestly, this should fix it.
pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gEngine[playerid] != 1)
{
SCM(playerid, COLOR_PINK, "Car engine started.");
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(pveh, 1, lights, alarm, doors, bonnet, boot, objective);
gEngine[playerid] = 1;
engineOn[pveh] = 1;
format(string, sizeof(string), "%s starts the car's engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else if(gEngine[playerid] == 1)
{
SCM(playerid, COLOR_PINK, "Car engine stopped.");
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(pveh, 0, lights, alarm, doors, bonnet, boot, objective);
gEngine[playerid] = 0;
engineOn[pveh] = 0;
format(string, sizeof(string), "%s stops the car's engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else
{
SCM(playerid, COLOR_CREAM, "You cannot start the engine as passenger.");
return 1;
}
}
else
{
SCM(playerid, COLOR_CREAM, "You are not in a vehicle.");
return 1;
}
}
}
EDIT:
I would suggest storing the gEngine onto the vehicleid, instead of playerid.
Re: Engines wont start! -
Oscii - 26.07.2012
Sorry, its still not working
Re: Engines wont start! -
Oscii - 26.07.2012
Also.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[128];
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new vehicle = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "i", playerid);
}
else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "i", playerid);
}
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetPlayerWeapon(playerid) == 29)
{
SetPlayerArmedWeapon(playerid, 0);
}
}
That might help?
Re: Engines wont start! -
maramizo - 26.07.2012
Quote:
Originally Posted by Oscii
Sorry, its still not working
|
No problem, what does it tell you when you use /engine?
Re: Engines wont start! -
Oscii - 26.07.2012
The engine just does not start. D:
Re: Engines wont start! -
maramizo - 26.07.2012
Any of the client messages appear?
Re: Engines wont start! -
Oscii - 26.07.2012
Yup.
Re: Engines wont start! -
maramizo - 26.07.2012
Change:
pawn Код:
SetVehicleParamsEx(pveh, 1, lights, alarm, doors, bonnet, boot, objective);
To
pawn Код:
SetVehicleParamsEx(pveh, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
Re: Engines wont start! -
Oscii - 26.07.2012
Damn
Still not working dude