SA-MP Forums Archive
Help With Engine Please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help With Engine Please (/showthread.php?tid=65634)



Help With Engine Please - wordas - 14.02.2009

Quote:

if(newkeys == KEY_WALK)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerConnected(playerid))
{
new Vehicle = GetPlayerVehicleID(playerid);
if(VehicleStarted[Vehicle] == 1)
{
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s turns the engine off", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
printf("%s", string);
VehicleStarted[Vehicle] = 0;
TogglePlayerControllable(playerid,1);
RemovePlayerFromVehicle(playerid);
}else{
SendClientMessage(playerid,0xAFAFAFAA,"[!] The engine is already off!");
}
}
}
}
if(newkeys == KEY_WALK)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerConnected(playerid))
{
new Vehicle = GetPlayerVehicleID(playerid);
if(VehicleStarted[Vehicle] == 0)
{
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s tries to start the vehicle", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
printf("%s", string);
GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~ g~Starting vehicle...",3000,3);
SetTimerEx("Starting",3500,0,"i",playerid);
}else{
SendClientMessage(playerid,COLOR_GRAD2,"[!] This vehicle is already started!");
}
}
}
}
return 0;
}

Here Is My Engine Command It Should Turn On Engine With Tab if you press 1 time ant if you press second time it should turn off it but it dosent turn off Why and how can i fix this please help !


Re: Help With Engine Please - yom - 14.02.2009

You never set VehicleStarted[Vehicle] to 1


Re: Help With Engine Please - wordas - 14.02.2009

i dont need it its a timerex
Quote:

SetTimerEx("Starting",3500,0,"i",playerid);

i think it does it at the same time i start the engine cuz it show engine altredy off too


Re: Help With Engine Please - wordas - 15.02.2009

Anyone?


Re: Help With Engine Please - Finn - 15.02.2009

Try this:

pawn Код:
if(newkeys == KEY_WALK)
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    new Vehicle = GetPlayerVehicleID(playerid), name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(VehicleStarted[Vehicle] == 1)
    {
      format(string, sizeof(string), "* %s turns the engine off", name);
      ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
      print(string);
      VehicleStarted[Vehicle] = 0;
      TogglePlayerControllable(playerid,1);
      RemovePlayerFromVehicle(playerid);
    }
    else
    {
      format(string, sizeof(string), "* %s tries to start the vehicle", name);
      ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
      print(string);
      GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~g~Starting vehicle...",3000,3);
      SetTimerEx("Starting",3500,0,"i",playerid); //I hope you have 'VehicleStarted[Vehicle] = 1;' somewhere in this timer.
    }
  }
}



Re: Help With Engine Please - tony_fitto - 16.02.2009

Hmm the script is nice but i cant get it to work hope some one do


Re: Help With Engine Please - MenaceX^ - 16.02.2009

In a loop, Check the EngineStarted or something like that, If it's false, Turn off the engine, and set the varieble to 0, If it's true turn if on and set the varieble to 1.


Re: Help With Engine Please - wordas - 21.02.2009

I Tryed All This Help But Nothings Helped