Hirecar or rentcar
#1

My friend made /upv or /startengine, but if u sit on rentcar vehicle, u can /upv it without /rentcar and start driving...



/upv:

Код:
	if(strcmp(cmd, "/upv", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(IsPlayerInAnyVehicle(playerid))
			{
	    		if(!engineOn[GetPlayerVehicleID(playerid)])
	    		{
	        		if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
					{
						return 1;
					}
					if(IsAnOwnableCar(idcar))
					{
						if(PlayerInfo[playerid][pPcarkey] == idcar) { }
						else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
						else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
						else { return 1; }
					}
					if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
					{
						return 1;
					}
					if(idcar == 59 || idcar == 60)
					{
						return 1;
					}
					if(idcar >= 135 && idcar <= 154)
					{
					    if(HireCar[playerid] != idcar)
					    {
							return 1;
						}
					    if(HireCar[playerid] == 999)
					    {
							SendClientMessage(playerid,-1,"Prvo morate rentati vozilo pa ga onda voziti");
							return 1;
						}
					}
					if(IsAPlane(idcar))
					{
					    return 1;
					}
					if(IsAHarvest(idcar))
					{
					    return 1;
					}
					if(IsADrugHarvest(idcar))
					{
					    return 1;
					}
					if(IsASweeper(idcar))
					{
					    return 1;
					}
					if(IsARaceCar(idcar))
					{
					    return 1;
					}
					if(gEngine[playerid] == 1) { return 1; }

					new playerveh = GetPlayerVehicleID(playerid);
					PutPlayerInVehicle(playerid, playerveh, 0);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s okrece kljuc i pokusava da upali motor.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					SetTimerEx("StartingTheVehicle",3500,0,"i",playerid);
					GameTextForPlayer(playerid, "~w~Motor se pokrece...",3500,3);
					gEngine[playerid] = 1;
					return 1;
				}
				if(engineOn[GetPlayerVehicleID(playerid)])
	    		{
	        		if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
					{
						return 1;
					}
					if(IsAnOwnableCar(idcar))
					{
					    if(PlayerInfo[playerid][pPcarkey] == idcar) { }
						else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
						else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
						else { return 1; }
					}
					if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
					{
						return 1;
					}
					if(idcar == 59 || idcar == 60)
					{
						return 1;
					}
					if(idcar >= 135 && idcar <= 154)
					{
					    if(HireCar[playerid] != idcar)
					    {
							return 1;
						}
					    if(HireCar[playerid] == 299)
					    {
							SendClientMessage(playerid,-1,"Prvo morate rentati vozilo pa ga onda voziti");
							return 1;
						}
					}
					if(IsAHarvest(idcar))
					{
					    return 1;
					}
					if(IsADrugHarvest(idcar))
					{
					    return 1;
					}
					if(IsAPlane(idcar))
					{
					    return 1;
					}
					if(IsASweeper(idcar))
					{
					    return 1;
					}
					if(IsARaceCar(idcar))
					{
					    return 1;
					}
					engineOn[GetPlayerVehicleID(playerid)] = false;
					//RemovePlayerFromVehicle(playerid);
					TogglePlayerControllable(playerid, 0);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s okrece kljuc i gasi motor.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					gEngine[playerid] = 0;
					new keycar = PlayerInfo[playerid][pPcarkey];
					new keycar2 = PlayerInfo[playerid][pPcarkey2];
					new keycar3 = PlayerInfo[playerid][pPcarkey3];
					if(IsAnOwnableCar(idcar))
					{
	   					if(keycar == idcar)
						{
							foreach (Player, i)
							{
			       				SetVehicleParamsForPlayer(keycar,i,0,1);
								GameTextForPlayer(playerid, "~w~Vozilo je~n~~r~Zakljucano", 4000, 3);
								CarInfo[keycar][cLock] = 1;
   							}
						}
						else if(keycar2 == idcar)
						{
							foreach (Player, i)
							{
			       				SetVehicleParamsForPlayer(keycar2,i,0,1);
								GameTextForPlayer(playerid, "~w~Vozilo je~n~~r~Zakljucano", 4000, 3);
								CarInfo[keycar2][cLock] = 1;
   							}
						}
						else if(keycar3 == idcar)
						{
							foreach (Player, i)
							{
			       				SetVehicleParamsForPlayer(keycar3,i,0,1);
								GameTextForPlayer(playerid, "~w~Vozilo je~n~~r~Zakljucano", 4000, 3);
								CarInfo[keycar3][cLock] = 1;
   							}
						}
					}
					return 1;
				}
			}
	    }
	    return 1;
	}

Код:
		if(newcar >= 130 && newcar <= 154)
		{
			if (HireCar[playerid] != newcar)
			{
			    TogglePlayerControllable(playerid, 0);
				format(string, sizeof(string), "~w~Mozete iznajmiti ovaj auto~n~Cijena:~g~$500~n~~w~Da iznajmite kucajte ~g~/rentcar~w~~n~da izadjete kucajte ~r~/exit");
				GameTextForPlayer(playerid, string, 5000, 3);
			}
		}
/rentcar:

Код:
	if(strcmp(cmd, "/rentcar", true) == 0)
	{
        if(IsPlayerConnected(playerid))
		{
			if(GetPlayerVehicleID(playerid) >= 128 && GetPlayerVehicleID(playerid) <= 152)
			{
				new hirefee = HireCost(GetPlayerVehicleID(playerid));
				if(SBizzInfo[0][sbProducts] == 0)
				{
					GameTextForPlayer(playerid, "~r~Nemamo vise zaliha", 5000, 1);
					return 1;
				}
				if (GetPlayerMoney(playerid) <  500)
				{
					SendClientMessage(playerid, COLOR_GRAD2, "   Nemate toliko novca !");
					return 1;
				}
				if(HireCar[playerid] != 299)
				{
					gCarLock[HireCar[playerid]] = 0;
					UnLockCar(HireCar[playerid]);
					SendClientMessage(playerid, COLOR_GREY, "Morate prvo da vratite iznajmljeni auto/motor/camac !");
					return 1;
				}
				foreach (Player, i)
				{
				    if(HireCar[i] == GetPlayerVehicleID(playerid))
				    {
				        SendClientMessage(playerid, COLOR_GREY, "    Neko je vec iznajmio ovaj auto !");
				        return 1;
				    }
				}
				/*if(PlayerInfo[playerid][pPbiskey] == 1)
				{
					GameTextForPlayer(playerid, "~w~No charge for the boss", 5000, 3);
					TogglePlayerControllable(playerid, 1);
					return 1;
				}*/
				GivePlayerMoney(playerid,-500);
				SBizzInfo[0][sbTill] += 500;
				ExtortionSBiz(0, SBizzInfo[0][sbEntranceCost]);
				SBizzInfo[0][sbProducts]--;
				HireCar[playerid] = GetPlayerVehicleID(playerid);
				OnPropUpdate();
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Nemojte zaboraviti da ~r~/unrentcar~n~~g~/lock ~w~da zakljucate auto.",hirefee);
				SendClientMessage(playerid, COLOR_YELLOW2, "Sada mozete upaliti motor sa /upv!");
				gEngine[playerid] = 1;
				engineOn[GetPlayerVehicleID(playerid)] = false;
				//TogglePlayerControllable(playerid, 1);
				GameTextForPlayer(playerid, string, 5000, 3);
			}
		}
		return 1;
	}
Reply


Messages In This Thread
Hirecar or rentcar - by undeR. - 13.04.2012, 18:34

Forum Jump:


Users browsing this thread: 1 Guest(s)