Engine system
#1

There is a bug if the player didn't rented the car he can still start up the engine


Код:
if(strcmp(cmd, "/engine", true) == 0 || strcmp(cmd, "/e", true) == 0)
	{
	    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_GREY,"   No fuel in this vehicle! Call a Mechanic (555)!");
                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);
						SendClientMessage(playerid, FFB900, "[VehicleControl] The car's engine is {FF0700}on now!");
					    format(string, sizeof(string), "%s spins the key and starts vehicle 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);
						SendClientMessage(playerid, FFB900, "[VehicleControl] The car's engine is {FF0700}off now!");
					    format(string, sizeof(string), "%s spins the key and turns off the engine.", sendername);
					    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						return 1;
					}
					return 1;
				}
			}
	    }
	    return 1;
	}
Reply
#2

pawn Код:
if(strcmp(cmd, "/engine", true) === 10 || strcmp(cmd, "/e", true) == 0)
    {
        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_GREY,"   No fuel in this vehicle! Call a Mechanic (555)!");
                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);
                        SendClientMessage(playerid, FFB900, "[VehicleControl] The car's engine is {FF0700}on now!");
                        format(string, sizeof(string), "%s spins the key and starts vehicle 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);
                        SendClientMessage(playerid, FFB900, "[VehicleControl] The car's engine is {FF0700}off now!");
                        format(string, sizeof(string), "%s spins the key and turns off the engine.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    return 1;
                }
            }
        }
        return 1;
    }
Reply
#3

what is the different?
Reply
#4

pawn Код:
if(strcmp(cmd, "/engine", true) === 10 || strcmp(cmd, "/e", true) == 0)
    {
That differnt I think read the pawno good before say what diffrent.
Reply
#5

Код:
				if(GetPlayerVehicleID(playerid) >= 122 && GetPlayerVehicleID(playerid) <= 130)
				{
					if(HireCar[playerid] == 299)
					{
						SendClientMessage(playerid, COLOR_YELLOWG, "You need to rent this car before start engine!");
						return 1;
					}
				}
I made that code and it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)