Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <fixchars>
- #if !defined IsValidVehicle
- native IsValidVehicle(vehicleid);
- #endif
- new Object[MAX_VEHICLES][6];
- new ObjectMove;
- new VehicleJOB;
- new RacePoint[MAX_PLAYERS];
- new Timer[MAX_PLAYERS];
- new TimerCount[MAX_PLAYERS];
- new Text:TextWarn;
- new TimerWarnVar[MAX_PLAYERS];
- new TimerWarn[MAX_PLAYERS];
- new Vehicle;
- new bool:ItCanContinue[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- TextWarn = TextDrawCreate(155.000000, 388.000000, " ");
- TextDrawBackgroundColor(TextWarn, 255);
- TextDrawFont(TextWarn, 1);
- TextDrawLetterSize(TextWarn, 0.500000, 1.700000);
- TextDrawColor(TextWarn, -1);
- TextDrawSetOutline(TextWarn, 0);
- TextDrawSetProportional(TextWarn, 1);
- TextDrawSetShadow(TextWarn, 1);
- VehicleJOB = CreateVehicle(578, -2227.0730, 295.5872, 35.7419, 0.0777, 32,17, 30);
- Vehicle = CreateVehicle(506, -2227.0730, 295.5871, 35.7421, 0.0777, 32,17, -1);
- Object[VehicleJOB][0] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][0], VehicleJOB, 1.660000,0.834999,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][1] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][1], VehicleJOB, 1.660000,-1.994998,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][2] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][2], VehicleJOB, 1.660000,-4.094998,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][3] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][3], VehicleJOB, -1.310000,-4.094998,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][4] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][4], VehicleJOB, -1.310000,-1.254999,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][5] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][5], VehicleJOB, -1.310000,0.809999,0.410000,-0.360000,3.240001,96.659988);
- ObjectMove = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(ObjectMove, VehicleJOB, -0.049999,-5.694999,0.385000,-6.839998,4.500001,6.840000);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- ItCanContinue[playerid] = false;
- RacePoint[playerid] = 0;
- return 1;
- }
- //***** Commands *****//
- CMD:job(playerid, params[]) // Teleport
- {
- SetPlayerPos(playerid, -2229.4050, 298.6245, 35.1230);
- return 1;
- }
- CMD:abrir(playerid, params[]) // Open to 'ObjectMove'
- {
- DestroyObject(ObjectMove);
- ObjectMove = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(ObjectMove, VehicleJOB, -0.0000, -5.825006, -1.039999, 154.259918,6.300012,-9.000000);
- return 1;
- }
- //*******************//
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- switch(RacePoint[playerid])
- {
- case 1:
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- DisablePlayerRaceCheckpoint(playerid);
- SetPlayerRaceCheckpoint(playerid, 0, -2201.8064, 319.9278, 35.1719, -2181.4182, 320.1506, 35.7966, 10.0);
- RacePoint[playerid] = 2;
- ToVerify(playerid);
- }
- }
- case 2:
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- DisablePlayerRaceCheckpoint(playerid);
- SetPlayerRaceCheckpoint(playerid, 0, -2146.6902, 323.4319, 35.1641, -2146.5986, 330.7473, 35.1719, 10.0);
- RacePoint[playerid] = 3;
- ToVerify(playerid);
- }
- }
- case 3:
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- DisablePlayerRaceCheckpoint(playerid);
- SetPlayerRaceCheckpoint(playerid, 0, -2143.7305, 731.0673, 69.4104, -2153.7495, 731.0192, 69.4141, 10.0);
- RacePoint[playerid] = 4;
- ToVerify(playerid);
- }
- }
- case 4:
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- DisablePlayerRaceCheckpoint(playerid);
- SetPlayerRaceCheckpoint(playerid, 0, -2261.3171, 730.8754, 49.2969, -2261.3440, 740.1472, 49.2969, 10.0);
- RacePoint[playerid] = 5;
- ToVerify(playerid);
- }
- }
- case 5:
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- DisablePlayerRaceCheckpoint(playerid);
- SetPlayerRaceCheckpoint(playerid, 0, -2269.5669, 1237.2422, 45.8456, -2260.3965, 1247.1711, 44.1987, 10.0);
- RacePoint[playerid] = 6;
- ToVerify(playerid);
- }
- }
- case 6:
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- DisablePlayerRaceCheckpoint(playerid);
- SetPlayerRaceCheckpoint(playerid, 1, -2072.8286, 1275.1196, 10.1820, -2068.5383, 1276.0862, 9.3181, 10.0);
- RacePoint[playerid] = 7;
- ToVerify(playerid);
- }
- }
- case 7:
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- ToVerify(playerid);
- if(ItCanContinue[playerid] == true)
- {
- DisablePlayerRaceCheckpoint(playerid);
- new engine[2], lights[2], alarm[2], doors[2], bonnet[2], boot[2], objective[2];
- GivePlayerMoney(playerid, random(1500));
- RemovePlayerFromVehicle(playerid);
- RacePoint[playerid] = 0;
- GameTextForPlayer(playerid, "Befejezett küldetés.", 2000, 0);
- GetVehicleParamsEx(VehicleJOB, engine[0], lights[0], alarm[0], doors[0], bonnet[0], boot[0], objective[0]);
- SetVehicleParamsEx(VehicleJOB, engine[0], lights[0], alarm[0], true, bonnet[0], boot[0], objective[0]);
- GetVehicleParamsEx(Vehicle, engine[1], lights[1], alarm[1], doors[1], bonnet[1], boot[1], objective[1]);
- SetVehicleParamsEx(Vehicle, engine[1], lights[1], alarm[1], doors[1], bonnet[1], boot[1], false);
- for(new i = 0; i < 6; i++)
- {
- DestroyObject(Object[VehicleJOB][i]);
- }
- DestroyObject(ObjectMove);
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
- {
- if(IsPlayerInVehicle(playerid, VehicleJOB))
- {
- if(RacePoint[playerid] == 0)
- {
- ShowPlayerDialog(playerid, 654, DIALOG_STYLE_MSGBOX, "{00FFFF}Fuvar.", \
- "{FFFFFF}Szeretné elvállalni a fuvart? {FF0000}És dolgozni?", "Igen", "Nem");
- }
- else if(RacePoint[playerid] > 0)
- {
- TimerWarnVar[playerid] = 20;
- KillTimer(TimerWarn[playerid]);
- TextDrawHideForPlayer(playerid, TextWarn);
- }
- }
- }
- if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
- {
- if(RacePoint[playerid] >= 1)
- {
- TimerWarn[playerid] = SetTimerEx("TimerWarnCallback", 1000, true, "d", playerid);
- TextDrawShowForPlayer(playerid, TextWarn);
- TextDrawSetString(TextWarn, "~r~20 ~w~másodperced van~w~ hogy beülj a járműbe.");
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 654)
- {
- if(response)
- {
- Timer[playerid] = SetTimerEx("CountDown", 1000, true, "d", playerid);
- TogglePlayerControllable(playerid, false);
- SetCameraBehindPlayer(playerid);
- TimerCount[playerid] = 0;
- TimerWarnVar[playerid] = 20;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, true);
- PlayAudioStreamForPlayer(playerid, "http://tangible-technology.com/music/beatles/ppm/Track%2008.mp3");
- if(!IsValidVehicle(Vehicle))
- {
- Vehicle = CreateVehicle(506, -2227.0730, 295.5871, 35.7421, 0.0777, 32,17, -1);
- }
- }
- else
- {
- RemovePlayerFromVehicle(playerid);
- }
- }
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- if(vehicleid == VehicleJOB)
- {
- if(!IsValidVehicle(Vehicle))
- {
- Vehicle = CreateVehicle(506, -2227.0730, 295.5871, 35.7421, 0.0777, 32,17, -1);
- }
- for(new i = 0; i < 6; i++)
- {
- if(!IsValidObject(Object[VehicleJOB][i]))
- {
- Object[VehicleJOB][0] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][0], VehicleJOB, 1.660000,0.834999,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][1] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][1], VehicleJOB, 1.660000,-1.994998,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][2] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][2], VehicleJOB, 1.660000,-4.094998,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][3] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][3], VehicleJOB, -1.310000,-4.094998,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][4] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][4], VehicleJOB, -1.310000,-1.254999,0.410000,-0.360000,3.240001,96.659988);
- Object[VehicleJOB][5] = CreateObject(11474,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(Object[VehicleJOB][5], VehicleJOB, -1.310000, 0.809999, 0.410000, -0.360000, 3.240001, 96.659988);
- }
- }
- if(!IsValidObject(ObjectMove))
- {
- ObjectMove = CreateObject(11474, 0, 0, -1000, 0, 0, 0, 100);
- AttachObjectToVehicle(ObjectMove, VehicleJOB, -0.049999, -5.694999, 0.385000, -6.839998, 4.500001, 6.840000);
- }
- }
- if(vehicleid == Vehicle)
- {
- if(!IsValidVehicle(Vehicle))
- {
- if(IsValidVehicle(VehicleJOB))
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, true, bonnet, boot, true);
- }
- else return false;
- }
- else return false;
- }
- return 1;
- }
- forward CountDown(playerid);
- public CountDown(playerid)
- {
- TimerCount[playerid] ++;
- new string[15];
- format(string, sizeof(string), "%i.", TimerCount[playerid]);
- GameTextForPlayer(playerid, string, 999, 3);
- if(TimerCount[playerid] == 4)
- {
- GameTextForPlayer(playerid, "~r~Go~w~.", 999, 3);
- KillTimer(Timer[playerid]);
- TogglePlayerControllable(playerid, true);
- TimerCount[playerid] = 0;
- SetPlayerRaceCheckpoint(playerid, 0, -2201.8064, 319.9278, 35.1719, -2181.4182, 320.1506, 35.7966, 10.0);
- RacePoint[playerid] = 1;
- }
- return 1;
- }
- forward TimerWarnCallback(playerid);
- public TimerWarnCallback(playerid)
- {
- if(!IsPlayerInVehicle(playerid, VehicleJOB))
- {
- if(RacePoint[playerid] > 0)
- {
- TimerWarnVar[playerid] --;
- new string[55];
- format(string, sizeof(string), "~r~%i másodperced van~w~ hogy beülj a járműbe.", TimerWarnVar[playerid]);
- TextDrawSetString(TextWarn, string);
- if(TimerWarnVar[playerid] == -1)
- {
- KillTimer(TimerWarn[playerid]);
- TextDrawHideForPlayer(playerid, TextWarn);
- RacePoint[playerid] = 0;
- TimerWarnVar[playerid] = 20;
- TimerCount[playerid] = 0;
- for(new i = 0; i < 6; i++)
- {
- DestroyObject(Object[VehicleJOB][i]);
- }
- DestroyObject(ObjectMove);
- GameTextForPlayer(playerid, "~r~Elrontottad a munkát és így nem tudtad leszállítani az árut!~w~.", 2000, 0);
- SetVehicleToRespawn(VehicleJOB);
- SetVehicleToRespawn(Vehicle);
- DisablePlayerRaceCheckpoint(playerid);
- StopAudioStreamForPlayer(playerid);
- }
- }
- }
- return 1;
- }
- forward ToVerify(playerid);
- public ToVerify(playerid)
- {
- new Float:Pos[3];
- GetVehiclePos(Vehicle, Pos[0], Pos[1], Pos[2]);
- if(IsPlayerInRangeOfPoint(playerid, 10.0, Pos[0], Pos[1], Pos[2])) return ItCanContinue[playerid] = true;
- else
- {
- ItCanContinue[playerid] = false;
- GameTextForPlayer(playerid, "~r~Elrontottad a munkát és így nem tudtad leszállítani az árut~w~.", 2000, 0);
- RacePoint[playerid] = 0;
- DisablePlayerRaceCheckpoint(playerid);
- RemovePlayerFromVehicle(playerid);
- RacePoint[playerid] = 0;
- StopAudioStreamForPlayer(playerid);
- for(new i = 0; i < 6; i++)
- {
- DestroyObject(Object[VehicleJOB][i]);
- }
- SendClientMessage(playerid, -1, "{FF0000}[Üzenet] {FFFFFF}Nem kellett volna kiszállni a járműből/vagy át szállni másikba! .");
- DestroyObject(ObjectMove);
- SetVehicleToRespawn(VehicleJOB);
- SetVehicleToRespawn(Vehicle);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement