Guest User

Gamemode made by Elsarty

a guest
Sep 10th, 2013
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. This gamemode is made by Elsarty, don't even think of removing credits.
  3. */
  4. #include <a_samp>
  5. #include <dini>
  6. #include <zcmd>
  7. #include <dudb>
  8. #include <sscanf>
  9. #include <acuf>
  10. #include <streamer>
  11.  
  12.  
  13. enum pInfo
  14. {
  15.     TimePast,
  16.     Hours,
  17.     Minutes,
  18. }
  19.  
  20. #define LOGIN       1
  21. #define REGISTER    2
  22. #define TUNE        3
  23. #define COLORCHAT   4
  24. #define COLORCAR    5
  25. #define PBALL       6
  26. #define PBINFO      7
  27. #define PB_PLAYERS  8
  28.  
  29.  
  30. #define MAX_COMP 40
  31.  
  32.  
  33. #define COLOR_WHITE     0xFFFFFFAA
  34. #define COLOR_GREY      0xCCCCCCFF
  35. #define COLOR_YELLOW    0xFFFF00AA
  36. #define COLOR_SYSTEM    0x58ACFAAA
  37. #define COLOR_LIGHTBLUE 0x33CCFFAA
  38. #define COLOR_GREEN     0x01DF01AA
  39. #define COLOR_RED       0xFF0000AA
  40. #define COLOR_TEAL      0xA9C4E4FF
  41. #define COLOR_ORANGE    0xFF8000AA
  42. #define COLOR_LIME      0x10F441AA
  43. #define COLOR_MAGENTA   0xFF00FFFF
  44. #define COLOR_MAROON    0x800000AA
  45. #define COLOR_BLUE      0x0000BBAA
  46. #define COLOR_AQUA      0xF0F8FFAA
  47.  
  48. forward SetupPlayerForClassSelection(playerid);
  49. forward SaveIn(filename[],text[]);
  50. forward LoadingArea(playerid);
  51.  
  52. new name[MAX_PLAYER_NAME];
  53. new OnlineTimer[MAX_PLAYERS];
  54. new IsLogged[MAX_PLAYERS];
  55. new PlayerInfo[MAX_PLAYERS][pInfo];
  56. new registered[MAX_PLAYERS];
  57. new God[MAX_PLAYERS] = 0;
  58. new paintball;
  59. new VGod[MAX_PLAYERS] = 0;
  60. //blackmarket gates
  61. new Gate1;
  62. new Gate2;
  63. new countVehicle[MAX_PLAYERS];
  64. new componentsid[MAX_PLAYERS][MAX_COMP];
  65. new PB[MAX_PLAYERS];
  66. new bool:flying[MAX_PLAYERS];
  67. new pblv;
  68. new Float:PBSpawn[][] =
  69. {
  70.     {2532.9934,2834.7104,10.8203,183.8086}, // Randomspawn
  71.     {2578.1511,2807.3320,10.8203,303.1663}, // Randomspawn
  72.     {2651.2966,2763.5530,10.8203,1.1102}, // Randomspawn
  73.     {2626.1477,2779.5415,23.8222,128.6146}, // Randomspawn
  74.     {2565.8464,2718.0959,22.9507,308.7598}, // Randomspawn
  75.     {2596.3523,2718.1089,25.8222,339.7568}
  76. };
  77.  
  78.  
  79. main()
  80.  
  81. public OnGameModeInit()
  82. {
  83.     pblv     = CreateDynamicCP(2014.2784,1104.2804,10.8203,1.0,-1,-1,-1,15.0);
  84.     paintball = CreateDynamicPickup(1239,1,2015.5741,1106.1957,10.8203,-1);
  85.     SetGameModeText("Freeroam/Drifting");
  86.     //gate blackmarket
  87.     Gate1 = CreateObject(975, 2237.5, -2218.6001, 14.2, 0, 0, 314);
  88.     Gate2 = CreateObject(975, 2231.3999, -2212.5, 14.2, 0, 0, 315);
  89.     if(!fexist("Records.txt"))return dini_Create("Records.txt");
  90.     AddPlayerClass(1,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  91.     print("Skin ID 1");
  92.     AddPlayerClass(2,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  93.     print("Skin ID 2");
  94.     AddPlayerClass(3,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  95.     print("Skin ID 3");
  96.     AddPlayerClass(4,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  97.     print("Skin ID 4");
  98.     AddPlayerClass(5,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  99.     print("Skin ID 5");
  100.     AddPlayerClass(6,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  101.     print("Skin ID 6");
  102.     AddPlayerClass(7,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  103.     print("Skin ID 7");
  104.     AddPlayerClass(8,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  105.     print("Skin ID 8");
  106.     AddPlayerClass(9,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  107.     print("Skin ID 9");
  108.     AddPlayerClass(10,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  109.     print("Skin ID 10");
  110.     AddPlayerClass(11,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  111.     print("Skin ID 11");
  112.     AddPlayerClass(12,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  113.     print("Skin ID 12");
  114.     AddPlayerClass(13,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  115.     print("Skin ID 13");
  116.     AddPlayerClass(14,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  117.     print("Skin ID 14");
  118.     AddPlayerClass(15,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  119.     print("Skin ID 15");
  120.     AddPlayerClass(16,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  121.     print("Skin ID 16");
  122.     AddPlayerClass(17,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  123.     print("Skin ID 17");
  124.     AddPlayerClass(18,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  125.     print("Skin ID 18");
  126.     AddPlayerClass(19,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  127.     print("Skin ID 19");
  128.     AddPlayerClass(20,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  129.     print("Skin ID 20");
  130.     AddPlayerClass(21,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  131.     print("Skin ID 21");
  132.     AddPlayerClass(22,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  133.     print("Skin ID 22");
  134.     AddPlayerClass(23,1310.1309,-1370.0226,13.5700,180.4759,0,0,0,0,0,0); // spawning
  135.     print("________________");
  136.     print("Classes successfully loaded");
  137.     return 1;
  138. }
  139.  
  140. public OnGameModeExit()
  141. {
  142.     SStats(MAX_PLAYERS);
  143.     return 1;
  144. }
  145. //This gamemode is made by Elsarty.
  146. //This gamemode is made by Elsarty!
  147.  
  148. public OnPlayerRequestClass(playerid, classid)
  149. {
  150.     SetPlayerPos(playerid, 1256.7449,-1439.0409,18.8538);
  151.     SetPlayerFacingAngle(playerid,259.4132);
  152.     SetPlayerCameraPos(playerid, 1259.5579,-1439.0704,19.8866);
  153.     SetPlayerCameraLookAt(playerid, 1256.7449,-1439.0409,18.8538);
  154.     return 1;
  155. }
  156. new randomMessages[][] =
  157.     {
  158.         "[SERVER MESSAGE] This gamemode is made by Elsarty, see /credits.",
  159.         "[SERVER MESSAGE] See /web to see this server's website, also don't forget to see /credits",
  160.         "[SERVER MESSAGE] See /rules, also don't forget to see /credits."
  161.     };
  162. forward RandomMessages();
  163. public RandomMessages()
  164. {
  165. new randomMsg = random(sizeof(randomMessages));
  166.     SendClientMessageToAll(COLOR_YELLOW, randomMessages[randomMsg]); This gamemode is made by Elsarty, see /credits.
  167. }
  168. public SetupPlayerForClassSelection(playerid)
  169. {
  170.     SetPlayerInterior(playerid,14);
  171.     SetPlayerFacingAngle(playerid, 270.0);
  172.     PlayerPlaySound(playerid, 1186, 0.0, 0.0, 5.0);
  173.     SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  174.     SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
  175.     SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
  176. }
  177. public OnPlayerConnect(playerid)
  178. {
  179.     PB[playerid]=0;
  180.     if(dini_Exists(Pos(playerid)))
  181.     {
  182.         new str1[128];
  183.         format(str1, 500, "{FFFFFF}Welcome back to the server!\n\nUsername: %s\nAccount Status: {ADFF2F}Registered\n{FFFFFF}Please punch in your password in order to play.",name);
  184.         ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Membership Area", str1, "Login", "");
  185.     }
  186.     if (!dini_Exists(Pos(playerid)))
  187.     {
  188.         new str1[128];
  189.         format(str1, 500, "{FFFFFF}Welcome to Fg!\n\nUsername: %s\nAccount Status: {FE9A2E}Unregistered\n{FFFFFF}Choose an account password for registration. \nYou have to remember your password for all of your play time.", name);
  190.         ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Registration", str1, "Register", "");
  191.     }
  192.     SendClientMessage(playerid,COLOR_WHITE, "You need to login in order to play.");
  193.     OnlineTimer[playerid] = SetTimerEx("OnlineTime", 60000, 1, "i", playerid);
  194.     return 1;
  195. }
  196.  
  197. public OnPlayerDisconnect(playerid, reason)
  198. {
  199.     if(IsLogged[playerid] == 1)
  200.     {
  201.         SStats(playerid);
  202.     }
  203.     new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
  204.     GetPlayerName(playerid, pname, sizeof(pname));
  205.     switch(reason)
  206.     {
  207.         case 0: format(string, sizeof(string), "~ %s has left the server. (Timeout)", pname);
  208.         case 1: format(string, sizeof(string), "*%s has left the server.", pname);
  209.         case 2: return 0;
  210.     }
  211.     SendClientMessageToAll(COLOR_GREY,string);
  212.     KillTimer(OnlineTimer[playerid]);
  213.     return 1;
  214. }
  215.  
  216. public OnPlayerSpawn(playerid)
  217. {
  218.     if(PB[playerid] == 1)
  219.     {
  220.         new Random = random(sizeof(PBSpawn));
  221.         SetPlayerInterior(playerid,0);
  222.         GivePlayerWeapon(playerid, 29, 2500);
  223.         SetPlayerPos(playerid, PBSpawn[Random][0], PBSpawn[Random][1], PBSpawn[Random][2]);
  224.         return 1;
  225.     }
  226.     if(registered[playerid] == 1)
  227.     {
  228.         registered[playerid]=0;
  229.         ResetPlayerWeapons(playerid);
  230.         SetPlayerInterior(playerid,0);
  231.         GivePlayerMoney(playerid, 25000);
  232.         SetPlayerVirtualWorld(playerid,0);
  233.         dini_IntSet(Pos(playerid), "Skin",GetPlayerSkin(playerid));
  234.     }
  235.     SetPlayerVirtualWorld(playerid, 0);
  236.     return 1;
  237. }
  238.  
  239. public OnPlayerDeath(playerid, killerid, reason)
  240. {
  241.     if(PB[playerid]==1)
  242.         {
  243.             new str[128],nam[24];
  244.             GetPlayerName(playerid, nam, 24);
  245.             GetPlayerName(killerid, name, 24);
  246.             format(str,sizeof(str),"%s has hunted %s down",name,nam);
  247.             GivePlayerMoney(playerid,250);
  248.             GameTextForPlayer(playerid,"~g~+$250", 3000, 1);
  249.             for(new i=0; i<MAX_PLAYERS; i++)
  250.             {
  251.                 if(PB[playerid] == 1)
  252.                 {
  253.                     SendClientMessage(i,COLOR_ORANGE,str);
  254.                 }
  255.             }
  256.             return 1;
  257.         }
  258.     return 1;
  259. }
  260.  
  261. public OnVehicleSpawn(vehicleid)
  262. {
  263.     return 1;
  264. }
  265.  
  266. public OnVehicleDeath(vehicleid, killerid)
  267. {
  268.     return 1;
  269. }
  270.  
  271. public OnPlayerText(playerid, text[])
  272. {
  273.     return 1;
  274. }
  275.  
  276. public OnPlayerCommandText(playerid, cmdtext[])
  277. {
  278.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  279.     {
  280.         // Do something here
  281.         return 1;
  282.     }
  283.     return 0;
  284. }
  285.  
  286. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  287. {
  288.     return 1;
  289. }
  290.  
  291. public OnPlayerExitVehicle(playerid, vehicleid)
  292. {
  293.     return 1;
  294. }
  295.  
  296. public OnPlayerStateChange(playerid, newstate, oldstate)
  297. {
  298.     return 1;
  299. }
  300.  
  301. public OnPlayerEnterCheckpoint(playerid)
  302. {
  303.     return 1;
  304. }
  305.  
  306. public OnPlayerLeaveCheckpoint(playerid)
  307. {
  308.     return 1;
  309. }
  310.  
  311. public OnPlayerEnterRaceCheckpoint(playerid)
  312. {
  313.     return 1;
  314. }
  315.  
  316. public OnPlayerLeaveRaceCheckpoint(playerid)
  317. {
  318.     return 1;
  319. }
  320.  
  321. public OnRconCommand(cmd[])
  322. {
  323.     return 1;
  324. }
  325.  
  326. public OnPlayerRequestSpawn(playerid)
  327. {
  328.     return 1;
  329. }
  330.  
  331. public OnObjectMoved(objectid)
  332. {
  333.     return 1;
  334. }
  335.  
  336. public OnPlayerObjectMoved(playerid, objectid)
  337. {
  338.     return 1;
  339. }
  340.  
  341. public OnPlayerPickUpPickup(playerid, pickupid)
  342. {
  343.     return 1;
  344. }
  345.  
  346. public OnVehicleMod(playerid, vehicleid, componentid)
  347. {
  348.     return 1;
  349. }
  350.  
  351. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  352. {
  353.     return 1;
  354. }
  355.  
  356. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  357. {
  358.     return 1;
  359. }
  360.  
  361. public OnPlayerSelectedMenuRow(playerid, row)
  362. {
  363.     return 1;
  364. }
  365.  
  366. public OnPlayerExitedMenu(playerid)
  367. {
  368.     return 1;
  369. }
  370.  
  371. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  372. {
  373.     return 1;
  374. }
  375.  
  376. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  377. {
  378.     return 1;
  379. }
  380.  
  381. public OnRconLoginAttempt(ip[], password[], success)
  382. {
  383.     return 1;
  384. }
  385.  
  386. public OnPlayerUpdate(playerid)
  387. {
  388.     return 1;
  389. }
  390.  
  391. public OnPlayerStreamIn(playerid, forplayerid)
  392. {
  393.     return 1;
  394. }
  395.  
  396. public OnPlayerStreamOut(playerid, forplayerid)
  397. {
  398.     return 1;
  399. }
  400.  
  401. public OnVehicleStreamIn(vehicleid, forplayerid)
  402. {
  403.     return 1;
  404. }
  405.  
  406. public OnVehicleStreamOut(vehicleid, forplayerid)
  407. {
  408.     return 1;
  409. }
  410.  
  411. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  412. {
  413.     if(dialogid == PBALL)
  414.     {
  415.         if(!response) return 1;
  416.         switch (listitem)
  417.         {
  418.             case 0:
  419.             {
  420.                 new string[128];
  421.                 new Random = random(sizeof(PBSpawn));
  422.                 if(GetPlayerWantedLevel(playerid) >= 1)return SendClientMessage(playerid,COLOR_GREY,"You're a suspect!");
  423.                 SetPlayerPos(playerid, PBSpawn[Random][0], PBSpawn[Random][1], PBSpawn[Random][2]);
  424.                 SetPlayerFacingAngle(playerid, PBSpawn[Random][3]);
  425.                 SendClientMessage(playerid,COLOR_YELLOW,"Type /paintball again in order to stop paintballing.");
  426.                 GivePlayerWeapon(playerid, 29, 2500);
  427.                 GetPlayerName(playerid,name,sizeof(name));
  428.                 format(string,sizeof(string),"%s has joined paintball.",name);
  429.                 PB[playerid]=1;
  430.                 for(new i = 0; i < MAX_PLAYERS; i++)
  431.                 {
  432.                     if(PB[i] == 1)
  433.                     {
  434.                         SendClientMessage(i,0x04B4AEAA,string);
  435.                         return 1;
  436.                     }
  437.                 }
  438.             }
  439.             case 1:
  440.             {
  441.                 SendClientMessage(playerid,COLOR_WHITE,"Welcome to Las Ventures Paintball! This game is developed for the entertainment");
  442.                 SendClientMessage(playerid,COLOR_WHITE,"of the players around the server. You got one M4 Gun inside and it's taken away as");
  443.                 SendClientMessage(playerid,COLOR_WHITE,"soon as you exit the paintball The area completely closed and doesn't have any way");
  444.                 SendClientMessage(playerid,COLOR_WHITE,"out during the game, that is to prevent the DM \nYou spawn in the paintball field");
  445.                 SendClientMessage(playerid,COLOR_WHITE,"randomly to prevent spawn kill Paintball don't restrict you from deathmatch but we");
  446.                 SendClientMessage(playerid,COLOR_WHITE,"appreciate you don't become violent on events occur in the paintball");
  447.                 SendClientMessage(playerid,COLOR_WHITE,"Have a nice time!");
  448.                 return 1;
  449.             }
  450.             case 3:
  451.             {
  452.                 new count = 0;
  453.                 new string[128];
  454.                 new name1[MAX_PLAYER_NAME];
  455.                 for(new i = 0; i < MAX_PLAYERS; i++)
  456.                 {
  457.                     if(PB[i] == 1)
  458.                     {
  459.                         GetPlayerName(i,name1,MAX_PLAYER_NAME);
  460.                     }
  461.                 }
  462.                 format(string,sizeof(string), "%s", name1);
  463.                 ShowPlayerDialog(playerid,PB_PLAYERS,DIALOG_STYLE_MSGBOX,"Current Players",string,"Close","");
  464.                 count++;
  465.  
  466.             }
  467.         }
  468.     }
  469.  
  470.     if(dialogid == COLORCHAT)
  471.     {
  472.         if(!response) return 1;
  473.         switch(listitem)
  474.         {
  475.             case 0:
  476.             {
  477.                 SetPlayerColor(playerid,COLOR_BLUE);
  478.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to blue.");
  479.                 return 1;
  480.             }
  481.             case 1:
  482.             {
  483.                 SetPlayerColor(playerid,0xF5A9A9FF);
  484.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to pink.");
  485.                 return 1;
  486.             }
  487.             case 2:
  488.             {
  489.                 SetPlayerColor(playerid,COLOR_RED);
  490.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to red.");
  491.                 return 1;
  492.             }
  493.             case 3:
  494.             {
  495.                 SetPlayerColor(playerid,COLOR_YELLOW);
  496.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to yellow.");
  497.                 return 1;
  498.             }
  499.             case 4:
  500.             {
  501.                 SetPlayerColor(playerid,COLOR_ORANGE);
  502.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to orange.");
  503.                 return 1;
  504.             }
  505.             case 5:
  506.             {
  507.                 SetPlayerColor(playerid,COLOR_AQUA);
  508.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to aqua.");
  509.                 return 1;
  510.             }
  511.             case 6:
  512.             {
  513.                 SetPlayerColor(playerid,COLOR_LIME);
  514.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to lime.");
  515.                 return 1;
  516.             }
  517.             case 7:
  518.             {
  519.                 SetPlayerColor(playerid,COLOR_MAROON);
  520.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to maroon.");
  521.                 return 1;
  522.             }
  523.             case 8:
  524.             {
  525.                 SetPlayerColor(playerid,COLOR_MAGENTA);
  526.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to magenta.");
  527.                 return 1;
  528.             }
  529.             case 9:
  530.             {
  531.                 SetPlayerColor(playerid,COLOR_TEAL);
  532.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to teal.");
  533.                 return 1;
  534.             }
  535.             case 10:
  536.             {
  537.                 SetPlayerColor(playerid,COLOR_WHITE);
  538.                 SendClientMessage(playerid,COLOR_WHITE,"You've set your color to white.");
  539.                 return 1;
  540.             }
  541.         }
  542.     }
  543.  
  544.     if(dialogid == COLORCAR)
  545.     {
  546.         if(!response) return 1;
  547.         switch(listitem)
  548.         {
  549.             case 0:
  550.             {
  551.                 new veh;
  552.                 veh = GetPlayerVehicleID(playerid);
  553.                 ChangeVehicleColor(veh,0,0);
  554.                 SendClientMessage(playerid,COLOR_WHITE,"You've set the car's color to black.");
  555.                 return 1;
  556.             }
  557.             case 1:
  558.             {
  559.                 new veh;
  560.                 veh = GetPlayerVehicleID(playerid);
  561.                 ChangeVehicleColor(veh,1,1);
  562.                 SendClientMessage(playerid,COLOR_WHITE,"You've set the car's color to white.");
  563.                 return 1;
  564.             }
  565.         }
  566.     }
  567.     if(dialogid == TUNE)
  568.      if(response)
  569.      {
  570.         for(new i=0;i<=countVehicle[playerid];i++)
  571.         {
  572.             if(listitem == i)
  573.             {
  574.                 if(IsVehicleUpgradeCompatible(GetVehicleModel(GetPlayerVehicleID(playerid)),componentsid[playerid][i]))
  575.                 {
  576.                     AddVehicleComponent(GetPlayerVehicleID(playerid), componentsid[playerid][i]);
  577.                     new string[128];
  578.                     format(string, sizeof(string),"New component %s added!", GetComponentName(componentsid[playerid][i]));
  579.                     SendClientMessage(playerid,COLOR_WHITE,string);
  580.                     return cmd_tune(playerid, " ");
  581.                 }
  582.                 else SendClientMessage(playerid,COLOR_GREY, "This component is not compitable with your vehicle model.");
  583.             }
  584.         }
  585.     }
  586.  
  587.     if (dialogid == REGISTER)
  588.     {
  589.         new string[128], str[128], str1[128];
  590.         GetPlayerName(playerid, name, sizeof(name));
  591.         if(!response) return Kick(playerid);
  592.         format(str1, 128, "{FFFFFF}Welcome to the server\n\n{DDCA22}Account:{FFFFFF} %s\n\nPlease Enter Your Password Below", name);if(!strlen(inputtext)) return
  593.         ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "Registration", str1, "Register", "");
  594.         dini_Create(Pos(playerid));
  595.         IsLogged[playerid] = 1;
  596.         registered[playerid] = 1;
  597.         PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  598.         dini_IntSet(Pos(playerid), "Password", udb_hash(inputtext));
  599.         dini_IntSet(Pos(playerid), "Banned", 0);
  600.         format(string, 128, "Your registration was successfull! Username: %s || Password: %s.", name, inputtext);
  601.         format(str, 128, "Looks like you are new here.");
  602.         SendClientMessage(playerid, COLOR_YELLOW, string);
  603.         SendClientMessage(playerid,COLOR_WHITE, str);
  604.         SendClientMessage(playerid,COLOR_WHITE, "This is a Freeroam server.");
  605.         SendClientMessage(playerid,COLOR_WHITE, "You can do whatever you want in the server as");
  606.         SendClientMessage(playerid, COLOR_WHITE, "long as you are within the server rules.");
  607.         SendClientMessage(playerid, COLOR_WHITE, "For the server rules, type /rules.");
  608.         return 1;
  609.     }
  610.  
  611.     if (dialogid == LOGIN)
  612.     {
  613.       new str1[128], tmp=dini_Int(Pos(playerid), "Password");
  614.       if(!response) return Kick(playerid);
  615.       GetPlayerName(playerid, name, sizeof(name));
  616.       format(str1, 128, "{FFFFFF}Welcome to the Clan\n\n{DDCA22}Account:{FFFFFF} %s\n\nPlease Enter Your Password Below", name);
  617.       if (!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login Account",str1, "Login", "");
  618.       if(udb_hash(inputtext) == tmp)
  619.       {
  620.         LoadStats(playerid);
  621.         IsLogged[playerid] = 1;
  622.         PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  623.         GetPlayerName(playerid, name, sizeof(name));
  624.         format(str1, 128, "Welcome back %s! your statistics have been successfully restored.", name);
  625.         SendClientMessage(playerid,COLOR_WHITE,str1);
  626.         SetSpawnInfo(playerid,0,dini_Int(Pos(playerid),"Skin"),dini_Int(Pos(playerid), "X1"),dini_Int(Pos(playerid), "Y1"), dini_Int(Pos(playerid), "Z1"),0, 0, 0, 0, 0, 0, 0 );
  627.         SpawnPlayer(playerid);
  628.         PlayerConnect(playerid);
  629.       else
  630.       {
  631.             SendClientMessage(playerid,-1, "Login failed.");
  632.             ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Membership Area", "{FFFFFF}Your entered password was incorrect\n\nPlease try again.", "Login", "");
  633.       }
  634.       return 1;
  635.     }
  636.     return 1;
  637. }
  638. public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
  639. {
  640.     {
  641.  
  642.     SetPlayerPosFindZ(playerid, fX, fY, fZ);
  643.     return 1;
  644.     }
  645.     return 1;
  646. }
  647. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  648. {
  649.     return 1;
  650. }
  651. stock Pos(playerid)
  652. {
  653. new x[128]; format(x, sizeof(x), "Accounts/%s.ini",GetPlayerName(playerid,name,sizeof(name)));
  654. return x;
  655. }
  656. SStats(playerid)
  657. {
  658.   new Float:x,Float:y,Float:z,Float:armour;
  659.   GetPlayerPos(playerid, x, y, z);
  660.   GetPlayerArmour(playerid, armour);
  661.   dini_IntSet(Pos(playerid),"Armor", floatround(armour));
  662.   dini_IntSet(Pos(playerid),"Money",GetPlayerMoney(playerid));
  663.   dini_IntSet(Pos(playerid),"Score",GetPlayerScore(playerid));
  664.   dini_IntSet(Pos(playerid),"TimePast",PlayerInfo[playerid][TimePast]);
  665.   dini_IntSet(Pos(playerid),"Interior", GetPlayerInterior(playerid));
  666.   dini_IntSet(Pos(playerid),"HoursPlayed",PlayerInfo[playerid][Hours]);
  667.   dini_IntSet(Pos(playerid),"MinutesPlayed",PlayerInfo[playerid][Minutes]);
  668.   return 1;
  669. }
  670. LoadStats(playerid)
  671. {
  672.   SetPlayerArmour(playerid,dini_Int(Pos(playerid),"Armor"));
  673.   SetPlayerScore(playerid, dini_Int(Pos(playerid),"Score"));
  674.   PlayerInfo[playerid][TimePast]      = dini_Int(Pos(playerid),"TimePast");
  675.   PlayerInfo[playerid][Hours]=dini_Int(Pos(playerid),"HoursPlayed");
  676.   PlayerInfo[playerid][Minutes] = dini_Int(Pos(playerid),"MinutesPlayed");
  677. }
  678. stock PlayerConnect(playerid)
  679. {
  680.     new tmp3[50],PlayerName[MAX_PLAYER_NAME],string[128];
  681.     GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
  682.     GetPlayerIp(playerid,tmp3,50);
  683.     if(strlen(dini_Get("Records.txt", tmp3)) == 0)
  684.     dini_Set("Records.txt", tmp3, PlayerName);
  685.     else
  686.     {
  687.         if( strfind( dini_Get("Records.txt", tmp3), PlayerName, true) == -1 )
  688.         {
  689.         format(string,sizeof(string),"%s,%s", dini_Get("Records.txt",tmp3), PlayerName);
  690.         dini_Set("Records.txt", tmp3, string);
  691.         }
  692.     }
  693.     return 1;
  694. }
  695. CMD:compound(playerid, params[])
  696. {
  697.     SetPlayerPos(playerid,2178.9536,-2255.7134,14.7734);
  698.     return 1;
  699. }
  700. CMD:help(playerid, params[])
  701.     {
  702.         SendClientMessage(playerid, COLOR_TEAL, "To view the existing server commands, type /cmds");
  703.         return 1;
  704.     }
  705.  
  706. CMD:web(playerid, params[])
  707.     {
  708.         SendClientMessage(playerid, COLOR_TEAL, "Server's website!");
  709.         SendClientMessage(playerid, COLOR_YELLOW, "Change this to your website.");
  710.         return 1;
  711.     }
  712. CMD:open(playerid, params[])
  713. {
  714.     if(IsPlayerInRangeOfPoint(playerid, 15.0, 2237.5, -2218.6001, 14.2))
  715.     {
  716.     MoveObject(Gate1,2242.69995, -2223.80005, 14.2,1);
  717.     MoveObject(Gate2,2226.1001, -2207.6001, 14.2,1);
  718.     SendClientMessage(playerid, COLOR_GREEN, "Gate has been opened");
  719.     return 1;
  720.     }
  721.     return 1;
  722. }
  723. CMD:close(playerid, params[])
  724.     {
  725.     new Closed =MoveObject(Gate1,2237.5, -2218.6001, 14.2,1);
  726.     new Closed1 =MoveObject(Gate2,2231.3999, -2212.5, 14.2,1);
  727.     if(IsPlayerInRangeOfPoint(playerid, 15.0, 2237.5, -2218.6001, 14.2))
  728.     if (Closed == 1)
  729.     if (Closed1 == 1)
  730.     {
  731.     MoveObject(Gate1,2237.5, -2218.6001, 14.2,1);
  732.     MoveObject(Gate2,2231.3999, -2212.5, 14.2,1);
  733.     SendClientMessage(playerid, COLOR_GREEN, "Gate has been closed");
  734.     return 1;
  735.     }
  736.     else {
  737.     SendClientMessage(playerid, COLOR_TEAL, "Gate already closed.");
  738.     return 1;
  739. }
  740.     return 1;
  741.     }
  742. CMD:rules(playerid, params[])
  743.     {
  744.         SendClientMessage(playerid, COLOR_TEAL, "Server Rules");
  745.         SendClientMessage(playerid, COLOR_YELLOW, "No spam/IP spam/ Web spam you can use /web.");
  746.         SendClientMessage(playerid, COLOR_YELLOW, "No ads. Never say IP, website, even ours.");
  747.         SendClientMessage(playerid, COLOR_Yellow, "No insult.");
  748.         SendClientMessage(playerid, COLOR_Yellow, "No drive by/Car ram.");
  749.         SendClientMessage(playerid, COLOR_Yellow, "Always obey the admins, if the did abuse, report them on /web");
  750.         SendClientMessage(playerid, COLOR_Yellow, "Don't ban evade if you got banned, apply on /web and you can get unbanned, if you did ban evade, you won't be unbanned, for ever!");
  751.         return 1;
  752.  
  753.     }
  754. CMD:cmds(playerid, params[])
  755.     {
  756.         SendClientMessage(playerid, COLOR_YELLOW, "Command List");
  757.         SendClientMessage(playerid, COLOR_WHITE, "/help - /kill - /rules - /web");
  758.         SendClientMessage(playerid, COLOR_WHITE, "/credits - /drift1 - /drift2 - /drift3 - ");
  759.         SendClientMessage(playerid, COLOR_WHITE, "/open - /close");
  760.         SendClientMessage(playerid, COLOR_YELLOW, "Please, always read /rules, /web, /credits.");
  761.         return 1;
  762.     }
  763. CMD:kill(playerid, params[])
  764.     {
  765.         SetPlayerHealth(playerid,0);
  766.         SendClientMessage(playerid, COLOR_RED, "You have killed yourself");
  767.         return 1;
  768.     }
  769. CMD:credits(playerid, params[])
  770.     {
  771.             SendClientMessage(playerid, COLOR_YELLOW, "This gamemode is scripted by: Elsarty, DON'T remove credits.");
  772.     }
  773. CMD:stats(playerid, params[])
  774.     {
  775.         new str[128],PName[MAX_PLAYER_NAME];
  776.         GetPlayerName(playerid, PName, MAX_PLAYER_NAME);
  777.         SendClientMessage(playerid,0x80DD22C8,"______________________________");
  778.         format(str,sizeof(str),"|_______|%sStats|________|",PName);
  779.         SendClientMessage(playerid,0x80DD22C8,str);
  780.         format(str,sizeof(str),"Score: {FFFFFF}%d",GetPlayerScore(playerid));
  781.         SendClientMessage(playerid,0x40BFA600,str);
  782.         format(str,sizeof(str),"Cash: {FFFFFF} $%d",GetPlayerMoney(playerid));
  783.         SendClientMessage(playerid,0xEEE8AA00,str);
  784.         return 1;
  785.     }
  786. CMD:drift(playerid,params[])
  787. {
  788.     new did;
  789.     if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_GREY,"You have to be in vehicle.");
  790.     if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,COLOR_GREY,"You've to be the driver of a car.");
  791.     if(sscanf(params,"d",did)) return SendClientMessage(playerid,COLOR_GREY,"/drift [id]") && SendClientMessage(playerid,COLOR_GREY,"Current IDs [1-3]");
  792.     if(did < 1 || did > 3) return SendClientMessage(playerid,COLOR_GREY,"Invalid ID");
  793.     if(did == 1)
  794.     {
  795.         new string[128], pName[MAX_PLAYER_NAME];
  796.         SetVehiclePos(GetPlayerVehicleID(playerid), -358.1943,1531.2909,75.1698 );
  797.         SetVehicleZAngle(GetPlayerVehicleID(playerid), 264.7289);
  798.         SetCameraBehindPlayer(playerid);
  799.         format(string, sizeof(string), "%s [ID:%d] has gone to Drift 1 (/drift1)", pName, playerid);
  800.         SendClientMessageToAll(COLOR_YELLOW, string);
  801.         GameTextForPlayer(playerid, "~w~Welcome To Drift 1! ~G~", 5000, 5);
  802.     }
  803.     else if(did == 2)
  804.     {
  805.         new string[128], pName[MAX_PLAYER_NAME];
  806.         SetVehiclePos(GetPlayerVehicleID(playerid), 2265.3010,1399.5085,42.8203);
  807.         SetVehicleZAngle(GetPlayerVehicleID(playerid), 269.7637);
  808.         SetCameraBehindPlayer(playerid);
  809.         format(string, sizeof(string), "%s [ID:%d] has gone to Drift 2 (/drift2)", pName, playerid);
  810.         SendClientMessageToAll(COLOR_YELLOW, string);
  811.         GameTextForPlayer(playerid, "~w~Welcome To Drift 2! ~G~", 5000, 5);
  812.  
  813.     }
  814.     else if(did == 3)
  815.     {
  816.         new string[128], pName[MAX_PLAYER_NAME];
  817.         SetVehiclePos(GetPlayerVehicleID(playerid),835.6555,-878.2632,68.0216);
  818.         SetVehicleZAngle(GetPlayerVehicleID(playerid), 238.8432);
  819.         SetCameraBehindPlayer(playerid);
  820.         format(string, sizeof(string), "%s [ID:%d] has gone to Drift 53 (/drift3)", pName, playerid);
  821.         SendClientMessageToAll(COLOR_YELLOW, string);
  822.         GameTextForPlayer(playerid, "~w~Welcome To Drift 3! ~G~", 5000, 5);
  823.     }
  824.     return 1;
  825. }
  826. CMD:paintball(playerid,params[])
  827.     {
  828.     if(PB[playerid]==0)
  829.     {
  830.         if(!IsPlayerInRangeOfPoint(playerid, 10,2015.5741,1106.1957,10.8203)) return SendClientMessage(playerid,COLOR_GREY,"You're no where close to paintball.");
  831.         new Random = random(sizeof(PBSpawn));
  832.         if(GetPlayerWantedLevel(playerid) >= 1)return SendClientMessage(playerid,COLOR_GREY,"You're a suspect!");
  833.         SetPlayerPos(playerid, PBSpawn[Random][0], PBSpawn[Random][1], PBSpawn[Random][2]);
  834.         SetPlayerFacingAngle(playerid, PBSpawn[Random][3]);
  835.         SetTimer("LoadingArea",5000,0);
  836.         TogglePlayerControllable(playerid,0);
  837.         GameTextForPlayer(playerid,"Loading Area...",5200,5);
  838.     }
  839.     else if(PB[playerid] == 1)
  840.     {
  841.         new string[128];
  842.         SetPlayerPos(playerid,2015.5741,1106.1957,10.8203);
  843.         SendClientMessage(playerid,COLOR_WHITE,"Thanks for playing paintball.");
  844.         ResetPlayerWeapons(playerid);
  845.         SetPlayerHealth(playerid,100);
  846.         GetPlayerName(playerid,name,sizeof(name));
  847.         format(string,sizeof(string),"%s has left paintball.",name);
  848.         PB[playerid]=0;
  849.         for(new i = 0; i < MAX_PLAYERS; i++)
  850.         {
  851.             if(PB[i] == 1)
  852.             {
  853.                 SendClientMessage(i,0x04B4AEAA,string);
  854.                 return 1;
  855.             }
  856.         }
  857.     }
  858.     return 1;
  859.     }
  860.  
  861. GetPName(playerid)
  862. {
  863.     new PName[MAX_PLAYER_NAME];
  864.     GetPlayerName(playerid, PName, sizeof(PName));
  865.     return PName;
  866. }
  867. forward KickPublic(playerid);
  868. public KickPublic(playerid) { Kick(playerid); }
  869.  
  870. stock KickWithMessage(playerid)
  871. {
  872.     SetTimerEx("KickPublic", 300, 0, "d", playerid);   //Delay of 1 second before kicking the player so he recieves the message
  873. }
  874. forward BanPublic(playerid);
  875. public BanPublic(playerid) { Ban(playerid); }
  876.  
  877. stock BanWithMessage(playerid)
  878. {
  879.     SetTimerEx("BanPublic", 300, 0, "d", playerid);   //Delay of 2 second before kicking the player so he recieves the message
  880. }
  881. public SaveIn(filename[],text[])
  882. {
  883.     new File:Lfile;
  884.     new filepath[256];
  885.     new string[256];
  886.     new year,month,day;
  887.     getdate(year,month,day);
  888.     format(filepath,sizeof(filepath),"%s.txt",filename);
  889.     Lfile = fopen(filepath,io_append);
  890.     format(string,sizeof(string),"[%02d/%02d/%02d] %s\r\n",day,month,year,text);
  891.     fwrite(Lfile,string);
  892.     fclose(Lfile);
  893.     return 1;
  894. }
  895. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  896. {
  897.     if(checkpointid == pblv)
  898.     {
  899.         ShowPlayerDialog(playerid,PBALL,DIALOG_STYLE_LIST,"Paintball","Join\nInformation\nCurrent Players","Okay","");
  900.     }
  901.     return 1;
  902. }
  903.  
  904. public LoadingArea(playerid)
  905. {
  906.     new string[128];
  907.     SendClientMessage(playerid,COLOR_YELLOW,"Type /paintball again in order to stop paintballing.");
  908.     GivePlayerWeapon(playerid, 29, 2500);
  909.     GetPlayerName(playerid,name,sizeof(name));
  910.     format(string,sizeof(string),"%s has joined paintball.",name);
  911.     PB[playerid]=1;
  912.     for(new i = 0; i < MAX_PLAYERS; i++)
  913.     {
  914.         if(PB[i] == 1)
  915.         {
  916.             SendClientMessage(i,0x04B4AEAA,string);
  917.             return 1;
  918.         }
  919.     }
  920.     TogglePlayerControllable(playerid,1);
  921.     return 1;
  922.  
  923. }
  924. public OnPlayerPickUpDynamicPickup(playerid, pickupid)
  925. {
  926.     if(pickupid == paintball)
  927.     {
  928.         SendClientMessage(playerid,COLOR_YELLOW,"Welcome to Paintball.");
  929.         SendClientMessage(playerid,-1,"Type /paintball to start paintballing.");
  930.         return 1;
  931.     }
  932.     return 1;
  933. }
Advertisement
Add Comment
Please, Sign In to add comment