01.03.2012, 21:36
I have made pizza delivery job in LS. It is my first FliterScript
tell me what you think
Код:
#include <a_samp> #define COLOR_ORANGE 0xFF9900AA #define COLOR_RED 0xAA3333AA #define PizzaCheckPoint1 1946.1525,-2047.4603,12.9842 #define PizzaCheckPoint2 1887.2511,-2025.6620,12.9907 #define PizzaCheckPoint3 1801.9717,-2108.4243,12.9782 #define PizzaCheckPoint4 1712.8094,-2108.2202,12.9778 #define PizzaCheckPoint5 1758.9286,-2117.8645,13.1443 #define PizzaCheckPoint6 2249.7629,-1899.5115,13.1621 #define PizzaCheckPoint7 2273.7979,-1899.1754,12.9112 #define PizzaCheckPoint8 2464.2188,-2014.2488,12.8764 #define PizzaCheckPoint9 2487.6382,-2013.8530,12.8765 #define PizzaCheckPoint10 2508.4534,-2005.0922,12.8816 #define PizzaCheckPoint11 2394.3926,-1727.6661,12.9778 #define PizzaCheckPoint12 2385.1702,-1663.5616,12.9824 #define PizzaTakePoint 2093.0647,-1807.4172,13.1484 new pizza = 0; new pizzainfo; public OnFilterScriptInit() { AddStaticVehicleEx(448,2113.4265,-1783.2411,12.9881,0.4907,3,6,615); // pizza1 AddStaticVehicleEx(448,2119.3572,-1782.7574,12.9869,358.8506,3,6,615); // pizza2 AddStaticVehicleEx(448,2121.7573,-1783.6804,12.9824,175.0377,3,6,615); // pizza3 AddStaticVehicleEx(448,2121.7573,-1783.6804,12.9824,175.0377,3,6,615); // pizza4 pizzainfo = CreatePickup(1239, 1, 2093.0647,-1807.4172,13.1484, -1); } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/pizza", cmdtext, true, 10) == 0) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448) { pizza = 1; SetPlayerCheckpoint(playerid, PizzaCheckPoint1, 3.0); GameTextForPlayer(playerid, "~g~You are now pizza delivery boy!", 3000, 3); new name[MAX_PLAYER_NAME], string[48]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "%s is now a pizza delivery boy.", name ); SendClientMessageToAll(COLOR_ORANGE, string); return 1; } SendClientMessage(playerid, COLOR_ORANGE,"You have to be in a Pizzaboy bike delivery."); } if (strcmp("/Pizzainfo", cmdtext, true, 10) == 0) { SendClientMessage(playerid, COLOR_ORANGE, "You need to deliver pizza to houses."); SendClientMessage(playerid, COLOR_ORANGE, "You will get pay."); SendClientMessage(playerid, COLOR_ORANGE, "If you enter a Pizzaboy bike ,use /pizza to start job."); SendClientMessage(playerid, COLOR_ORANGE, "Just drive to the red markers and earn money."); return 1; } return 0; } public OnPlayerEnterCheckpoint(playerid) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448) { if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint1)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint2, 7.0); GameTextForPlayer(playerid, "~g~1 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint2)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint3, 7.0); GameTextForPlayer(playerid, "~g~2 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint3)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint4, 7.0); GameTextForPlayer(playerid, "~g~3 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint4)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint5, 7.0); GameTextForPlayer(playerid, "~g~4 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint5)) { SetPlayerCheckpoint(playerid, PizzaTakePoint, 7.0); GameTextForPlayer(playerid, "~g~5 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint6)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint7, 7.0); GameTextForPlayer(playerid, "~g~6 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint7)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint8, 7.0); GameTextForPlayer(playerid, "~g~7 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint8)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint9, 7.0); GameTextForPlayer(playerid, "~g~8 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint9)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint10, 7.0); GameTextForPlayer(playerid, "~g~9 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint10)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint11, 7.0); GameTextForPlayer(playerid, "~g~10 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint11)) { SetPlayerCheckpoint(playerid, PizzaCheckPoint12, 7.0); GameTextForPlayer(playerid, "~g~11 pizza delivered!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaCheckPoint12)) { SetPlayerCheckpoint(playerid, PizzaTakePoint, 7.0); GameTextForPlayer(playerid, "~g~12 pizza delivered, get back to for the payment!", 3000, 3); } if (IsPlayerInRangeOfPoint(playerid, 7.0,PizzaTakePoint)) { GivePlayerMoney(playerid, 3000); GameTextForPlayer(playerid, "~g~You collected a total of $3000,-!", 3000, 3); new veh; veh = GetPlayerVehicleID(playerid); SetVehicleToRespawn(veh); DisablePlayerCheckpoint(playerid); pizza = 0; } } } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448) { SendClientMessage(playerid, COLOR_ORANGE, "You can start the pizza delivery boy with /pizza"); } return 0; } public OnPlayerExitVehicle(playerid, vehicleid) { if((pizza) == 1) { pizza = 0; SendClientMessage(playerid, COLOR_RED, "You left your pizzaboy bike, get in again or you will get fired!"); }else if((pizza) == 0){ //Nothing } } public OnPlayerDeath(playerid, killerid, reason) { DisablePlayerCheckpoint(playerid); pizza = 0; return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { if(pickupid == pizzainfo) { GameTextForPlayer(playerid, "~g~Welcome to the Pizza delivery boy job, use /pizzainfo for more information", 3000, 3); } }