/engine question -
Qur - 30.11.2011
Hey.. I'm trying to make that you wont have to type /engine if you drive bicycles... well I tried to make a foward + public of the vehiclemodel but it didnt help.. the last thing I tried is that:
pawn Код:
on:
public OnPlayerStateChange(playerid, newstate, oldstate)
if(GetVehicleModel(newcar) == 481 || GetVehicleModel(newcar) == 509 || GetVehicleModel(newcar) == 510)//BMX
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
return 1;
}
and my /engine command:
pawn Код:
if(!strcmp(cmd, "/engine", true))
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s puts the keys and turn on the engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(engine == 1)
{
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s Turn off the engine and take the keys.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}
Re: /engine question -
=WoR=Varth - 30.11.2011
You mean you still have to type /engine to drive bicycle?
Re: /engine question -
AstonDA-G - 30.11.2011
Try this;
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510)//BMX
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/engine", true))
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s puts the keys and turn on the engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(engine == 1)
{
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s Turn off the engine and take the keys.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}
return 0;
}
Hope this helps/works
Re: /engine question -
Qur - 30.11.2011
I tried it,thanks but wasnt working
and yea.. if you enter a bicycles you have to type /engine to start drive it...
more ideas?
Re: /engine question -
AstonDA-G - 30.11.2011
You mean you want to do /engine for EVERY vehicle in the game?
Re: /engine question -
=WoR=Varth - 30.11.2011
What is "newcar"?
If that's the vehicle's ID, why you get the ID again in "vehicleid"?
Re: /engine question -
Qur - 30.11.2011
Right now.. every vehicle you enter.. doesnt matter what kind it is.. you have to type /engine to start drive..
but I DONT want bicycles to work this way.... so I took only bicycles ids ...
now expalin it better?: )
And I dont take the vehicleid... I use the vehicle model..
cuz I dont wanna check every bicycle id..
Re: /engine question -
=WoR=Varth - 30.11.2011
pawn Код:
GetVehicleModel(vehicleid);
That's what I mean.
Perhaps show us some code below that code where you get the ID?
Re: /engine question -
Qur - 30.11.2011
Below this part? I showed you, and blow that its the rest of the public..
Re: /engine question -
=WoR=Varth - 30.11.2011
I mean above (Damn, my bad), where you get the vehicle ID and store it in "newcar".