Is the car running
#1

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
Reply
#2

Код:
	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
Reply
#3

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.
Reply
#4

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");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)