Guest User

ST Paintball System

a guest
Jul 3rd, 2013
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.44 KB | None | 0 0
  1. /*
  2.  
  3. ST Paintball
  4. Copyright © SoomroTayab
  5. This script is made by SoomroTayab (Goldilox) from scratch.
  6. Please obey the terms of use.
  7.  
  8.         TERMS OF USE:
  9.         ø You should not remove this entire comment, it doens't costs you anything.
  10.         ø You can edit it anyway you want.
  11.         ø You shouldn't credit yourself of creating this script.
  12.         ø You can remove my name from entire script such as the prints as long as you keep this whole comment.
  13.  
  14. If you experience any bug or something, I can fix it for you. Just reply on the topic, PM me or even email me at [email protected].
  15. If you are releasing this script, you can also change the hostname if you like to.
  16.  
  17. Thanks for downloading.
  18.  
  19. */
  20.  
  21. #include <a_samp>
  22. #include <streamer>
  23. #include <zcmd>
  24.  
  25. //Forwards
  26.  
  27. forward Money(playerid);
  28. forward LoadingObjects(playerid);
  29. forward UnloadingObjects(playerid);
  30. forward PBCheck();
  31.  
  32.  
  33. //Defines
  34.  
  35. #define PBALL                   4
  36. #define PBINFO                  5
  37. #define PB_PLAYERS              6
  38.  
  39. #define COLOR_WHITE     0xFFFFFFAA
  40. #define COLOR_ORANGE    0xFF8000AA
  41. #define COLOR_YELLOW    0xFFFF00AA
  42. #define COLOR_GREY      0xCCCCCCAA
  43. #define COLOR_RED       0xFF0000AA
  44.  
  45.  
  46.  
  47.  
  48.  
  49. new paintball;
  50. new PBall[MAX_PLAYERS];
  51. new pblv;
  52. new Float:PBSpawn[][] =
  53. {
  54.     {2532.9934,2834.7104,10.8203,183.8086}, // Randomspawn
  55.     {2578.1511,2807.3320,10.8203,303.1663}, // Randomspawn
  56.     {2651.2966,2763.5530,10.8203,1.1102}, // Randomspawn
  57.     {2626.1477,2779.5415,23.8222,128.6146}, // Randomspawn
  58.     {2565.8464,2718.0959,22.9507,308.7598}, // Randomspawn
  59.     {2596.3523,2718.1089,25.8222,339.7568}
  60. };
  61.  
  62. public OnFilterScriptInit()
  63. {
  64.     pblv     = CreateDynamicCP(2633.4612,1721.8558,11.0234,1.0,-1,-1,-1,15.0);
  65.     paintball = CreateDynamicPickup(1239,1,2633.7639,1716.3861,11.0234,-1);
  66.     print("\n--------------------------------------");
  67.     print("Paintball System Loaded - Goldilox (Tayab Soomro)");
  68.     print("--------------------------------------\n");
  69.     return 1;
  70. }
  71. public OnPlayerConnect(playerid)
  72. {
  73.     PBall[playerid]=0;
  74.     SetTimer("PBCheck",60000,1);
  75.     return 1;
  76. }
  77. public OnPlayerSpawn(playerid)
  78. {
  79.     if(PBall[playerid] == 1)
  80.     {
  81.         new Random = random(sizeof(PBSpawn));
  82.         SetPlayerInterior(playerid,0);
  83.         GivePlayerWeapon(playerid, 29, 2500);
  84.         SetPlayerPos(playerid, PBSpawn[Random][0], PBSpawn[Random][1], PBSpawn[Random][2]);
  85.         return 1;
  86.     }
  87.     return 1;
  88. }
  89.  
  90. public OnPlayerDeath(playerid, killerid, reason)
  91. {
  92.     if(killerid != INVALID_PLAYER_ID)
  93.     {
  94.         if(PBall[playerid] == 1)
  95.         {
  96.             new str[128],string[128],name[24],nam[24];
  97.             GetPlayerName(playerid, nam, 24);
  98.             GetPlayerName(killerid, name, 24);
  99.             format(str,sizeof(str),"%s has hunted %s down",name,nam);
  100.             format(string,sizeof(string),"You've been hunted down by %s",name);
  101.             SendClientMessage(playerid,COLOR_RED,string);
  102.             GameTextForPlayer(playerid,"Wonderful!", 3000, 1);
  103.             SetTimer("Money",3200,0);
  104.             for(new i=0; i<MAX_PLAYERS; i++)
  105.             {
  106.                 if(PBall[playerid] == 1)
  107.                 {
  108.                     SendClientMessage(i,COLOR_ORANGE,str);
  109.                 }
  110.             }
  111.             return 1;
  112.         }
  113.     }
  114.     return 1;
  115. }
  116. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  117. {
  118.     if(dialogid == PBALL)
  119.     {
  120.         if(!response) return 1;
  121.         switch (listitem)
  122.         {
  123.             case 0:
  124.             {
  125.                 new Random = random(sizeof(PBSpawn));
  126.                 if(GetPlayerWantedLevel(playerid) >= 1)return SendClientMessage(playerid,COLOR_GREY,"You're a suspect!");
  127.                 SetPlayerPos(playerid, PBSpawn[Random][0], PBSpawn[Random][1], PBSpawn[Random][2]);
  128.                 SetPlayerFacingAngle(playerid, PBSpawn[Random][3]);
  129.                 SetTimer("LoadingObjects",5000,0);
  130.                 GameTextForPlayer(playerid,"Loading Playarea.",4900,5);
  131.                 TogglePlayerControllable(playerid,0);
  132.             }
  133.             case 1:
  134.             {
  135.                 SendClientMessage(playerid,COLOR_WHITE,"Thanks for using ST Paintball System, this game is developed for entertainment");
  136.                 SendClientMessage(playerid,COLOR_WHITE,"of the players around the server. It's perfect for the Freeroam and Role-Playing");
  137.                 SendClientMessage(playerid,COLOR_WHITE,"servers. This message is the example informational content you can add to ur script.");
  138.                 SendClientMessage(playerid,COLOR_WHITE,"This script is also strong anti paintball abuse, you can't use the paintball weapon");
  139.                 SendClientMessage(playerid,COLOR_WHITE,"outside of the paintball. The playing area is completely packed, without any way out,");
  140.                 SendClientMessage(playerid,COLOR_WHITE,"except for exiting with a command /paintball. I would appreciate your reputation");
  141.                 SendClientMessage(playerid,COLOR_WHITE,"to my account if you're using this script. You are fully permitted to edit the");
  142.                 SendClientMessage(playerid,COLOR_WHITE,"script however you like as long as you keep the credits somewhere in the script &");
  143.                 SendClientMessage(playerid,COLOR_WHITE,"and consider the fact that I am the creator of this script. Have a nice day!");
  144.                 return 1;
  145.             }
  146.             case 3:
  147.             {
  148.                 new count = 0;
  149.                 new string[128];
  150.                 new name1[MAX_PLAYER_NAME];
  151.                 for(new i = 0; i < MAX_PLAYERS; i++)
  152.                 {
  153.                     if(PBall[i] == 1)
  154.                     {
  155.                         GetPlayerName(i,name1,MAX_PLAYER_NAME);
  156.                     }
  157.                 }
  158.                 format(string,sizeof(string), "%s", name1);
  159.                 ShowPlayerDialog(playerid,PB_PLAYERS,DIALOG_STYLE_MSGBOX,"Current Players",string,"Close","");
  160.                 count++;
  161.  
  162.             }
  163.         }
  164.     }
  165.  
  166.     return 1;
  167. }
  168.  
  169. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  170. {
  171.     return 1;
  172. }
  173. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  174. {
  175.     if(checkpointid == pblv)
  176.     {
  177.         ShowPlayerDialog(playerid,PBALL,DIALOG_STYLE_LIST,"Paintball","Play\nInformation\nCurrent Players","Okay","");
  178.     }
  179.     return 1;
  180. }
  181. CMD:gotopaintball(playerid,params[])
  182. {
  183.     SendClientMessage(playerid,COLOR_ORANGE,"You've been teleported to paintball location.");
  184.     SetPlayerPos(playerid,2611.0798,1716.1072,10.8203);
  185.     return 1;
  186. }
  187. CMD:paintball(playerid,params[])
  188.     {
  189.     if(PBall[playerid]==0)
  190.     {
  191.         if(!IsPlayerInRangeOfPoint(playerid, 10,2633.7639,1716.3861,11.0234)) return SendClientMessage(playerid,COLOR_GREY,"You're no where close to paintball.");
  192.         new Random = random(sizeof(PBSpawn));
  193.         SetPlayerPos(playerid, PBSpawn[Random][0], PBSpawn[Random][1], PBSpawn[Random][2]);
  194.         SetPlayerFacingAngle(playerid, PBSpawn[Random][3]);
  195.         SetTimer("LoadingObjects",5000,0);
  196.         GameTextForPlayer(playerid,"Loading Playarea...",4900,5);
  197.         TogglePlayerControllable(playerid,0);
  198.     }
  199.     else if(PBall[playerid] == 1)
  200.     {
  201.         SetPlayerPos(playerid,2611.0798,1716.1072,10.8203);
  202.         ResetPlayerWeapons(playerid);
  203.         SetPlayerHealth(playerid,100);
  204.         SetTimer("UnloadingObjects",5000,0);
  205.         TogglePlayerControllable(playerid,0);
  206.         GameTextForPlayer(playerid,"Unloading Playarea...",5000,5);
  207.     }
  208.     return 1;
  209.     }
  210. public OnPlayerPickUpDynamicPickup(playerid, pickupid)
  211. {
  212.     if(pickupid == paintball)
  213.     {
  214.         SendClientMessage(playerid,COLOR_YELLOW,"Welcome to Paintball.");
  215.         SendClientMessage(playerid,COLOR_WHITE,"Type /paintball to start paintballing.");
  216.         return 1;
  217.     }
  218.     return 1;
  219. }
  220. public Money(playerid)
  221. {
  222.     GivePlayerMoney(playerid,500);
  223.     GameTextForPlayer(playerid,"~g~+$500",2000,1);
  224. }
  225. public LoadingObjects(playerid)
  226. {
  227.         new name[MAX_PLAYER_NAME],string[128];
  228.         TogglePlayerControllable(playerid,1);
  229.         SendClientMessage(playerid,COLOR_YELLOW,"Type /paintball again in order to stop paintballing.");
  230.         GivePlayerWeapon(playerid, 26, 2500);
  231.         GetPlayerName(playerid,name,sizeof(name));
  232.         format(string,sizeof(string),"%s has joined paintball.",name);
  233.         PBall[playerid]=1;
  234.         for(new i = 0; i < MAX_PLAYERS; i++)
  235.         {
  236.             if(PBall[i] == 1)
  237.             {
  238.                 SendClientMessage(i,0x04B4AEAA,string);
  239.                 return 1;
  240.             }
  241.         }
  242.         return 1;
  243. }
  244. public UnloadingObjects(playerid)
  245. {
  246.  
  247.         new name[MAX_PLAYER_NAME],string[128];
  248.         GetPlayerName(playerid,name,sizeof(name));
  249.         format(string,sizeof(string),"%s has left paintball.",name);
  250.         PBall[playerid]=0;
  251.         SendClientMessage(playerid,COLOR_WHITE,"Thanks for playing paintball, we hope you come next time!");
  252.         for(new i = 0; i < MAX_PLAYERS; i++)
  253.         {
  254.             if(PBall[i] == 1)
  255.             {
  256.                 SendClientMessage(i,0x04B4AEAA,string);
  257.                 return 1;
  258.             }
  259.         }
  260.         TogglePlayerControllable(playerid,1);
  261.         return 1;
  262.  
  263. }
  264. public PBCheck()
  265. {
  266.     for(new i = 0; i < MAX_PLAYERS; i++)
  267.     {
  268.         if(PBall[i] == 0)
  269.         {
  270.             if(GetPlayerWeapon(i) == 26)
  271.             {
  272.                 ResetPlayerWeapons(i);
  273.             }
  274.         }
  275.     }
  276. }
Advertisement
Add Comment
Please, Sign In to add comment