SA-MP Forums Archive
/engine - 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)
+--- Thread: /engine (/showthread.php?tid=336507)



/engine - Unknown1195 - 22.04.2012

When I add a rentcar and I do /rentcar it says that you cannot turn the engine on (taht was set for bikes) I can't understand where is the problem can anyone help? Even if your try, that means a lot because at least you gave some of your time to help me Rep+ to every member which tries to help Thanks!

Unknown1195

Код:
   if(!strcmp(cmd, "/engine", true))
	{
	    if(IsPlayerInAnyVehicle(playerid))
        {
			if(IsPlayerConnected(playerid))
			{
				if(!engineOn[GetPlayerVehicleID(playerid)])
				{
				    new idcar = GetPlayerVehicleID(playerid);
		            if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return 1;
					if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509) return 1;
					if(IsARentableVeh(idcar))
					{
					    if(HireCar[playerid] != idcar) return 1;
					}
					if(IsAHarvest(idcar)) return 1;
					if(IsADrugHarvest(idcar)) return 1;
					if(IsASweeper(idcar)) return 1;
					if(IsASalesVehicle(idcar)) return 1;

					if(CanTurnEngine[playerid] != idcar && CanTurnEngine[playerid] == 9999)
					    return SendClientMessage(playerid, COLOR_GREY,"* You cannot turn this car's engine!");

					new plname[MAX_PLAYER_NAME];
					GetPlayerName(playerid, plname, sizeof(plname));

					format(string, sizeof(string), "* %s twist the key, turning the vehicle engine on.", plname);
					ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
					if(PlayerInfo[playerid][pAdmin] < 1337 && PlayerInfo[playerid][pAdminDuty] == 1)
					{
					    SetTimerEx("StartingTheVehicle",1,0,"i",playerid);
					}
					else
					{
						SetTimerEx("StartingTheVehicle",3500,0,"i",playerid);
					}
					GameTextForPlayer(playerid, "~w~Starting vehicle engine...",3500,3);
					gEngine[playerid] = 1;
					new vid = GetPlayerVehicleID(playerid);
					new engine,lights,alarm,doors,bonnet,boot,objective;
					GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(vid,1,lights,alarm,doors,bonnet,boot,objective);
					engineOn[GetPlayerVehicleID(playerid)] = true;
					new y, m, d;
					new h,mi,s;
					getdate(y,m,d);
					gettime(h,mi,s);
					format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /engine",d,m,y,h,mi,s,sendername);
					CommandLog(string);
					return 1;
				}
				else if(engineOn[GetPlayerVehicleID(playerid)])
	    		{
	    		    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return 1;
					if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509) return 1;
					if(IsARentableVeh(idcar))
					if(IsASalesVehicle(idcar))
					{
					    if(HireCar[playerid] != idcar) return 1;
					}
					if(IsAHarvest(idcar)) return 1;
					if(IsADrugHarvest(idcar)) return 1;
					if(IsASweeper(idcar)) return 1;

					if(CanTurnEngine[playerid] != idcar && CanTurnEngine[playerid] == 9999)
						return SendClientMessage(playerid, COLOR_GREY,"* You cannot turn this car's engine!");

					format(string, sizeof(string), "* %s spins a key and turns off the engine", sendername);
					ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
					GameTextForPlayer(playerid, "~w~Engine Turned Off.",3500,3);
					gEngine[playerid] = 0;
					new vid = GetPlayerVehicleID(playerid);
					new engine,lights,alarm,doors,bonnet,boot,objective;
                    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective);
					engineOn[GetPlayerVehicleID(playerid)] = false;
					TogglePlayerControllable(playerid, 0);//// ath the dealship's in the game, you can go there and try to get a car, buy when you do /v it spawns you a car, but you can take it away, idk how you can buy it,can you fix it where they cant leave with the car, they have to buy it first?
					new y, m, d;
					new h,mi,s;
					getdate(y,m,d);
					gettime(h,mi,s);
					format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /engine",d,m,y,h,mi,s,sendername);
					CommandLog(string);
					return 1;
				}
			}
	    }
	    return 1;
	}
Код:
new rentcar[4];
Код:
public IsARentableCar(carid)
{
	for(new i = 0; i < sizeof(rentcar); i++)
	{
	    if(carid == rentcar[i]) return 1;
	}
	return 0;
}
Код:
if(strcmp(cmd, "/rentcar", true) == 0)
	{
        if(IsPlayerConnected(playerid))
		{
		    for(new i = 0; i < sizeof(rentcar); i++)
			{
				if(GetPlayerVehicleID(playerid) == rentcar[i]) continue;
			}
			new hirefee = HireCost(GetPlayerVehicleID(playerid));
			if(SBizzInfo[1][sbProducts] == 0)
			{
				GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
				return 1;
			}
			if (GetPlayerMoney(playerid) <  SBizzInfo[1][sbEntranceCost])
			{
				SendClientMessage(playerid, COLOR_GRAD2, "   You dont have that much cash !");
				return 1;
			}
			if(HireCar[playerid] != 299)
			{
				gCarLock[HireCar[playerid]] = 0;
				UnLockCar(HireCar[playerid]);
				SendClientMessage(playerid, COLOR_GREY, "You need unrent your current car/bike/boat first !");
				return 1;
			}
			for(new i=0; i<MAX_PLAYERS; i++)
			{
			    if(HireCar[i] == GetPlayerVehicleID(playerid))
			    {
			        SendClientMessage(playerid, COLOR_GREY, "    Someone already rents this car !");
			        return 1;
			    }
			}
			if(PlayerInfo[playerid][pPbiskey] == 1)
			{
				GameTextForPlayer(playerid, "~w~No charge for the boss", 5000, 3);
				TogglePlayerControllable(playerid, 1);
				return 1;
			}
			SafeGivePlayerMoney(playerid,-SBizzInfo[1][sbEntranceCost]);
			SBizzInfo[1][sbTill] += SBizzInfo[1][sbEntranceCost];
			ExtortionSBiz(1, SBizzInfo[1][sbEntranceCost]);
			SBizzInfo[1][sbProducts]--;
			HireCar[playerid] = GetPlayerVehicleID(playerid);
			OnPropUpdate(3,1);
			PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
			format(string, sizeof(string), "~w~Don't forget to ~r~/unrentcar~n~~g~/lock ~w~to lock your car.",hirefee);
			SendClientMessage(playerid, COLOR_YELLOW2, "You can start the engine up now !");
			gEngine[playerid] = 0;
			engineOn[GetPlayerVehicleID(playerid)] = false;
			//TogglePlayerControllable(playerid, 1);
			GameTextForPlayer(playerid, string, 5000, 3);
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /rentcar",d,m,y,h,mi,s,sendername);
			CommandLog(string);
		}
		return 1;
	}



Re: /engine - Unknown1195 - 22.04.2012

Fixed on my own Thanks anyways!


Re: /engine - IceCube! - 22.04.2012

Hmm, If this is your 'Unique' GM That your selling it doesnt look to 'Unique' to me.