My engine command is bugged!
#1

So, my problem here is, when you enter the car it actually just sets you uncontrollable, then you do /engine, you can move etc, but then when you do /engine and get out of the car, the player just teleports next to the car, or to the cars roof, and I really would like to make it, so the player goes into the car, the lights start, and the engine sounds comes up, and the same other way around, so the player can leave the car normally!


Код:
if(!strcmp(cmd, "/engine", true))
	{
	    if(IsPlayerConnected(playerid))
     {
			if(IsPlayerInAnyVehicle(playerid))
			{
			    if(IsADmv(idcar) || IsAHarvest(idcar) || IsADrugHarvest(idcar) || IsAPlane(idcar) || IsASweeper(idcar) || pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
					return 1;
	        	if(Gas[idcar] == 0)
	        	    return SendClientMessage(playerid,COLOR_RED,"   No fuel in this vehicle!");
                if(dying[playerid] == 1)
                    return SendClientMessage(playerid,COLOR_GREY,"   Do not bug abuse!");
	    		if(!engineOn[idcar])
	    		{
         		if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
					{
					    new playerveh = GetPlayerVehicleID(playerid);
					    engineOn[idcar] = true;
					    PutPlayerInVehicle(playerid, playerveh, 0);
					    TogglePlayerControllable(playerid,1);
					    format(string, sizeof(string), "* %s spins the key and starts vehicle's engine.", sendername);
					    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						return 1;
					}
					return 1;
				}
				else if(engineOn[idcar])
	    		{
	        		if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
					{
					    engineOn[idcar] = false;
					    TogglePlayerControllable(playerid, 0);
					    format(string, sizeof(string), "* %s spins the key and turns off the engine of the vehicle.", sendername);
					    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						return 1;
					}
					return 1;
				}
			}
	    }
	    return 1;
	}
Thanks!

OH and I also have this on OnPlayerStateChange



Код:
 new string[256];
	new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
	new vehicle = GetPlayerVehicleID(playerid);
	if(oldstate == PLAYER_STATE_ONFOOT && (newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER))
	    AffectVehicleDamageToPlayer(playerid,vehicle,1);
	if((oldstate == PLAYER_STATE_PASSENGER || oldstate == PLAYER_STATE_DRIVER) && newstate == PLAYER_STATE_ONFOOT)
	    AffectVehicleDamageToPlayer(playerid,vehicle,0);
    if(newstate == PLAYER_STATE_DRIVER)
	{
		if(dying[playerid] == 1){RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 0); ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0); }
	}
	if(newstate == PLAYER_STATE_ONFOOT && SeatBelt[playerid]==true)
    {
    	SeatBelt[playerid]=false;
    	format(string, sizeof(string), "* %s unbuckles his/her seat belt", GetPlayerNameEx(playerid));
		ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	}
	if(IsADmv(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsAPlane(vehicle) || IsASweeper(vehicle) || pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
	{	}
	else if(newstate == PLAYER_STATE_DRIVER && engineOn[vehicle] == 1)
	{
		TogglePlayerControllable(playerid,1);//allow driving - engine on
	}
	else if(newstate == PLAYER_STATE_DRIVER && engineOn[vehicle] == 0)
	{
		TogglePlayerControllable(playerid,0);//dosn't allow driving - engine off
		SendClientMessage(playerid, COLOR_WHITE,"To start the engine use '/engine' ");
Reply


Messages In This Thread
HELP! My engine command is bugged! - by JoeySaladino - 04.11.2012, 11:05
Re: My engine command is bugged! - by verlaj - 04.11.2012, 13:45
Re: My engine command is bugged! - by JoeySaladino - 04.11.2012, 14:36
Re: My engine command is bugged! - by JoeySaladino - 04.11.2012, 15:20
Re: My engine command is bugged! - by JoeySaladino - 05.11.2012, 08:19

Forum Jump:


Users browsing this thread: 3 Guest(s)