SA-MP Forums Archive
Is the car running - 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: Is the car running (/showthread.php?tid=83276)



Is the car running - FreeSoul - 24.06.2009

Ok,so I made like a thing.
Whenever a player enters a vehicle he must type /start to start the vehicle.
But I want it like,if any other player enters the vehicle that the first player typed /start in,it won't be necessary to type /start again,the car will already be running.

I have no idea how to do that.
Thanks in advance


Re: Is the car running - WoodPecker - 24.06.2009

Код:
	if(strcmp(cmdtext,"/engine",true)==0)
  {
  if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  {
	SendClientMessage(playerid,COLOR_GREY,"You are not in any vehicle");
  	return 1;
	}
  new newcar = GetPlayerVehicleID(playerid);
	if(engine[newcar] == 1)
  {
  SendClientMessage(playerid,COLOR_YELLOW,"Engine has been shutted off");
  engine[newcar] = 0;
  return 1;
  }
	if(engineturning[playerid] == 0)
  {
  SendClientMessage(playerid,COLOR_GREY,"You have not been asked to turn your engine on");
  return 1;
  }
  	GetPlayerName(playerid, sendername, sizeof(sendername));
  format(string, sizeof(string), "* %s is attempting to start the engine", sendername);
  ProxDetector(5.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
  engineturning[playerid] = 0;
  enginetimer[playerid] = 5;
  enginewire[playerid] = 1;
	return 1;
	}
use that Ese


Re: Is the car running - happyface - 24.06.2009

i am very amateurish when it comes to coding so i cant help much, but you simply check whether player is passenger or not, if player enter vehicle as passenger no /start option.


Re: Is the car running - Vince - 24.06.2009

You're lucky I use this myself.

pawn Код:
enum vInfo
{
  IsStarted
}

new VehicleInfo[MAX_VEHICLES][vInfo];

// /start command:
VehicleInfo[vehicleid][IsStarted] = 1;

// /stop command
VehicleInfo[vehicleid][IsStarted] = 0;

// OnPlayerStateChange
if(VehicleInfo[vehicleid][IsStarted] == 1) SendClientMessage(playerid, COLOR, "the car is running");
else SendClientMessage(playerid, COLOR, "Type /start to start the vehicle");