Faisal_khan

PizzaJob

Dec 31st, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.10 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7. new pizza = 0;
  8.  
  9. new Float:PizzaDelivery[3][4] = {//change 3 to the no. of checkpoints
  10. {651.8204,-1619.4867,15.0000,1.0},
  11. {795.1389,-1691.2811,14.4633,1.0},
  12. {1237.6108,-1582.6001,13.4683,1.0}
  13. };
  14. new PizzaJob[sizeof(PizzaDelivery)];
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\n--------------------------------------");
  19.     print(" Blank Filterscript by your name here");
  20.     print("--------------------------------------\n");
  21.     return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26.     return 1;
  27. }
  28.  
  29. main()
  30. {
  31.     print("\n----------------------------------");
  32.     print(" Blank Gamemode by your name here");
  33.     print("----------------------------------\n");
  34. }
  35.  
  36. public OnPlayerDeath(playerid, killerid, reason)
  37. {
  38.     return 1;
  39. }
  40.  
  41. public OnVehicleSpawn(vehicleid)
  42. {
  43.     return 1;
  44. }
  45.  
  46. public OnVehicleDeath(vehicleid, killerid)
  47. {
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerCommandText(playerid, cmdtext[])
  52. {
  53.     if (strcmp("/pizzajob", cmdtext, true) == 0)
  54.     {
  55.         if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
  56.         {
  57.             pizza = 1;
  58.             new checkpoint, job = 0;
  59.             do{
  60.                 for(new i=0; i<sizeof(PizzaJob); i++)
  61.                     if(PizzaJob[i] != 0)
  62.                         job++;
  63.                 if(job == sizeof(PizzaJob))
  64.                     for(new i=0; i<sizeof(PizzaJob); i++)
  65.                         PizzaJob[i] = 0;
  66.                 checkpoint = random(sizeof(PizzaDelivery));
  67.             }while(PizzaJob[checkpoint]);
  68.             SetPlayerCheckpoint(playerid,PizzaDelivery[checkpoint][0],PizzaDelivery[checkpoint][1],PizzaDelivery[checkpoint][2],PizzaDelivery[checkpoint][3]);
  69.             GameTextForPlayer(playerid, "~g~You are now pizza delivery boy!", 3000, 3);
  70.             new name[MAX_PLAYER_NAME], string[48];
  71.             GetPlayerName(playerid, name, sizeof(name));
  72.             format(string, sizeof(string), "%s is now a pizza delivery boy.", name );
  73.             SendClientMessageToAll(-1, string);
  74.             return 1;
  75.         }
  76.         SendClientMessage(playerid, -1,"You have to be in a Pizzaboy bike delivery.");
  77.     }
  78.     if (strcmp("/pizza", cmdtext, true) == 0)
  79.     {
  80.         new Float:X, Float:Y, Float:Z;
  81.         GetPlayerPos(playerid, X, Y, Z);
  82.         AddStaticVehicleEx(448, X, Y, Z, 1, 1, 1, 0);
  83.         return 1;
  84.     }
  85.     return 0;
  86. }
  87.  
  88. public OnPlayerEnterVehicle(playerid, vehicleid)
  89. {
  90.     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448 && pizza == 1)
  91.     {
  92.         new checkpoint, job = 0;
  93.         do{
  94.             for(new i=0; i<sizeof(PizzaJob); i++)
  95.                 if(PizzaJob[i] != 0)
  96.                     job++;
  97.             if(job == sizeof(PizzaJob))
  98.                 for(new i=0; i<sizeof(PizzaJob); i++)
  99.                     PizzaJob[i] = 0;
  100.             checkpoint = random(sizeof(PizzaDelivery));
  101.         }while(PizzaJob[checkpoint]);
  102.         SetPlayerCheckpoint(playerid,PizzaDelivery[checkpoint][0],PizzaDelivery[checkpoint][1],PizzaDelivery[checkpoint][2],PizzaDelivery[checkpoint][3]);
  103.         PizzaJob[checkpoint] = 1;
  104.         SendClientMessage(playerid, -1, "You got a delivery mission.");
  105.         SendClientMessage(playerid, -1, "Check the map for the location");
  106.     }
  107.     return 1;
  108. }
  109.  
  110. public OnPlayerExitVehicle(playerid, vehicleid)
  111. {
  112.     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448 && pizza == 1)
  113.     {
  114.         pizza = 0;
  115.         SendClientMessage(playerid, -1, "You exited the vehicle!");
  116.         SendClientMessage(playerid, -1, "Delivery Mission failed!");
  117.         DisablePlayerCheckpoint(playerid);
  118.     }
  119.     return 1;
  120. }
  121.  
  122. public OnPlayerEnterCheckpoint(playerid)
  123. {
  124.     DisablePlayerCheckpoint(playerid);
  125.     SendClientMessage(playerid, -1, "You have sucessfuly delivered the pizza");
  126.     GivePlayerMoney(playerid, 1000);
  127.     SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
  128.     new checkpoint, job = 0;
  129.     do{
  130.         for(new i=0; i<sizeof(PizzaJob); i++)
  131.             if(PizzaJob[i] != 0)
  132.                 job++;
  133.         if(job == sizeof(PizzaJob))
  134.             for(new i=0; i<sizeof(PizzaJob); i++)
  135.                 PizzaJob[i] = 0;
  136.         checkpoint = random(sizeof(PizzaDelivery));
  137.     }while(PizzaJob[checkpoint]);
  138.     SetPlayerCheckpoint(playerid,PizzaDelivery[checkpoint][0],PizzaDelivery[checkpoint][1],PizzaDelivery[checkpoint][2],PizzaDelivery[checkpoint][3]);
  139.     PizzaJob[checkpoint] = 1;
  140.     return 1;
  141. }
Advertisement
Add Comment
Please, Sign In to add comment