| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #include <YSI_Coding\y_hooks>
- static bool:HoldingBox[MAX_PLAYERS];
- static CourierVan[MAX_PLAYERS];
- hook OnPlayerConnect(playerid)
- {
- HoldingBox[playerid] = false;
- CourierVan[playerid] = INVALID_VEHICLE_ID;
- }
- CourierStartJob(playerid)
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 482) return SendErrorMessage(playerid, "You need to be driving a Burrito in order to start working.");
- if(Iter_Count(Business) <= 3 || Iter_Count(House) <= 3) return SendErrorMessage(playerid, "There must be more than three houses and businesses on the server in order to do this job.");
- new propertyid;
- switch(random(2))
- {
- case 0: propertyid = Iter_Random(House);
- case 1: propertyid = Iter_Random(Business);
- }
- new Float:x, Float:y, Float:z;
- Property_GetExtPos(propertyid, x, y, z);
- JobCheckpoint[playerid] = CreateDynamicCP(x, y, z, 4.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), playerid);
- CourierVan[playerid] = GetPlayerVehicleID(playerid);
- SetPlayerWorking(playerid, true);
- va_SendClientMessage(playerid, 0xffcc80ff, "(Job) You have to deliver some boxes to a %s at %s, hurry up!", (IsPropertyAHouse(propertyid)) ? ("house"): ("business"), Property_GetAddress(propertyid));
- return 1;
- }
- CourierEnterCheckpoint(playerid)
- {
- if(IsPlayerInAnyVehicle(playerid)) return 0;
- if(Iter_Count(Business) <= 3 || Iter_Count(House) <= 3)
- {
- Job_StopWorking(playerid);
- return SendErrorMessage(playerid, "There must be more than three houses and businesses on the server in order to do this job.");
- }
- if(!HoldingBox[playerid]) return SendErrorMessage(playerid, "You're not holding any boxes. Get them from the back of the vehicle. (/loadbox)");
- if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- ApplyAnimation(playerid, "CARRY", "putdwn", 4.1, 0, 1, 1, 0, 0, 1);
- DestroyDynamicCP(JobCheckpoint[playerid]);
- JobCheckpoint[playerid] = INVALID_STREAMER_ID;
- HoldingBox[playerid] = false;
- new propertyid;
- switch(random(2))
- {
- case 0: propertyid = Iter_Random(House);
- case 1: propertyid = Iter_Random(Business);
- }
- new Float:x, Float:y, Float:z;
- Property_GetExtPos(propertyid, x, y, z);
- JobCheckpoint[playerid] = CreateDynamicCP(x, y, z, 4.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), playerid);
- va_SendClientMessage(playerid, 0xffcc80ff, "(Job) You have to deliver some boxes to a %s at %s, hurry up!", (IsPropertyAHouse(propertyid)) ? ("house"): ("business"), Property_GetAddress(propertyid));
- return 1;
- }
- CourierStopsWorking(playerid)
- {
- HoldingBox[playerid] = false;
- CourierVan[playerid] = INVALID_VEHICLE_ID;
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
- }
- timer CloseVanDoors[1000](playerid)
- {
- new driver, passenger, backleft, backright;
- GetVehicleParamsCarDoors(CourierVan[playerid], driver, passenger, backleft, backright);
- SetVehicleParamsCarDoors(CourierVan[playerid], driver, passenger, 0, 0);
- }
- timer ApplyBoxAnimation[2000](playerid)
- {
- if(IsPlayerWorking(playerid))
- {
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
- SetPlayerAttachedObject(playerid, 9, 2694, 1, 0.170999, 0.363000, 0.000000, 0.000000, 93.700012, 0.000000, 0.713000, 0.650000, 1.000000, 0, 0);
- defer CloseVanDoors(playerid);
- }
- }
- CMD:loadbox(playerid, params[])
- {
- if(HoldingBox[playerid]) return SendErrorMessage(playerid, "You're already holding a box.");
- if(Player_GetJob(playerid) != JOB_COURIER) return SendErrorMessage(playerid, "You need the courier job in order to use this command.");
- if(!IsPlayerWorking(playerid)) return SendErrorMessage(playerid, "You need to be working in order to use this command.");
- if(!IsValidVehicle(CourierVan[playerid]))
- {
- Job_StopWorking(playerid);
- return SendErrorMessage(playerid, "Your vehicle has disappeared so you stopped working.");
- }
- if(!IsPlayerNearBoot(playerid, CourierVan[playerid])) return SendErrorMessage(playerid, "You need to be near the vehicle's trunk.");
- HoldingBox[playerid] = true;
- new Float:x, Float:y, Float:z;
- GetVehiclePos(CourierVan[playerid], x, y, z);
- SetPlayerToFacePoint(playerid, x, y);
- new driver, passenger, backleft, backright;
- GetVehicleParamsCarDoors(CourierVan[playerid], driver, passenger, backleft, backright);
- SetVehicleParamsCarDoors(CourierVan[playerid], driver, passenger, 1, 1);
- ApplyAnimation(playerid, "MISC", "Plunger_01", 4.1, 0, 1, 1, 0, 0, 1);
- defer ApplyBoxAnimation(playerid);
- SendInfoMessage(playerid, "You have loaded a box. Leave it at the property entrance.");
- return 1;
- }
|