| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- #include <YSI_Coding\y_hooks>
- static bool:HoldingPizza[MAX_PLAYERS];
- static PizzaBike[MAX_PLAYERS];
- hook OnPlayerConnect(playerid)
- {
- HoldingPizza[playerid] = false;
- PizzaBike[playerid] = INVALID_VEHICLE_ID;
- }
- timer NewPizzaOrder[5000](playerid)
- {
- if(IsPlayerWorking(playerid))
- {
- if(Iter_Count(House) <= 3)
- return SendErrorMessage(playerid, "There must be more than three houses on the server in order to do this job.");
- new houseid = Iter_Random(House);
- new Float:x, Float:y, Float:z, Float:a;
- Property_GetExtPos(houseid, x, y, z, a);
- JobCheckpoint[playerid] = CreateDynamicCP(x, y, z, 2.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), playerid);
- va_SendClientMessage(playerid, 0xffcc80ff, "(Job) You've recieved a new order. Deliver the pizza to %s.", Property_GetAddress(houseid));
- }
- return 1;
- }
- timer ApplyPizzaAnimation[500](playerid)
- {
- if(IsPlayerWorking(playerid))
- {
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
- SetPlayerAttachedObject(playerid, 9, 1582, 1, -0.026001, 0.363000, 0.000000, 0.000000, 93.700012, 0.000000, 0.712999, 0.649999, 1.000000, 0, 0);
- }
- }
- timer RemovePlayerPizza[1000](playerid)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
- }
- PizzaboyStartJob(playerid)
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 448) return SendErrorMessage(playerid, "You need to be driving a pizzaboy scooter in order to start working.");
- if(Iter_Count(House) <= 3) return SendErrorMessage(playerid, "There must be more than three houses on the server in order to do this job.");
- new houseid = Iter_Random(House);
- new Float:x, Float:y, Float:z, Float:a;
- Property_GetExtPos(houseid, x, y, z, a);
- PizzaBike[playerid] = GetPlayerVehicleID(playerid);
- JobCheckpoint[playerid] = CreateDynamicCP(x, y, z, 2.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), playerid);
- SetPlayerWorking(playerid, true);
- va_SendClientMessage(playerid, 0xffcc80ff, "(Job) You have to deliver the pizza to %s, hurry up!", Property_GetAddress(houseid));
- return 1;
- }
- PizzaboyEnterCheckpoint(playerid)
- {
- if(IsPlayerInAnyVehicle(playerid)) return 0;
- if(!HoldingPizza[playerid]) return SendErrorMessage(playerid, "You're not holding any pizzas. Get them from your scooter. (/loadpizza)");
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- ApplyAnimation(playerid, "BAR", "BARSERVE_GIVE", 4.1, 0, 1, 1, 0, 0, 1);
- new money = random(6) + 4;
- GivePlayerMoney(playerid, money);
- va_SendClientMessage(playerid, 0xffcc80ff, "(Job) You've got a $%d tip, go back to your scooter.", money);
- defer RemovePlayerPizza(playerid);
- defer NewPizzaOrder(playerid);
- DestroyDynamicCP(JobCheckpoint[playerid]);
- JobCheckpoint[playerid] = INVALID_STREAMER_ID;
- HoldingPizza[playerid] = false;
- return 1;
- }
- PizzaboyStopsWorking(playerid)
- {
- HoldingPizza[playerid] = false;
- PizzaBike[playerid] = INVALID_VEHICLE_ID;
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
- }
- CMD:loadpizza(playerid, params[])
- {
- if(HoldingPizza[playerid]) return SendErrorMessage(playerid, "You're already holding a pizza.");
- if(Player_GetJob(playerid) != JOB_PIZZABOY) return SendErrorMessage(playerid, "You need the pizza boy 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(PizzaBike[playerid]))
- {
- Job_StopWorking(playerid);
- return SendErrorMessage(playerid, "Your vehicle has disappeared so you stopped working.");
- }
- if(!IsPlayerNearBoot(playerid, PizzaBike[playerid])) return SendErrorMessage(playerid, "You need to be near the scooter's boot.");
- HoldingPizza[playerid] = true;
- new Float:x, Float:y, Float:z;
- GetVehiclePos(PizzaBike[playerid], x, y, z);
- SetPlayerToFacePoint(playerid, x, y);
- defer ApplyPizzaAnimation(playerid);
- ApplyAnimation(playerid, "CARRY", "liftup05", 4.1, 0, 1, 1, 0, 0, 1);
- SendInfoMessage(playerid, "You have loaded a pizza. Leave it at the property entrance.");
- return 1;
- }
|