Advertisement
Guest User

Script

a guest
Jul 22nd, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.79 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Galaxy Stunting By Avi
  4. // Created From Scratch V.1
  5. //
  6. ///////////////////////////////////////////////////////////////////////////////////////////
  7.  
  8.  
  9. ////////////////////////////////////////Includes////////////////////////////////////////
  10.  
  11. #include <a_samp>
  12. #include <dutils>
  13. #include <Dini>
  14.  
  15. #pragma unused ret_memcpy
  16. ///////////////////////////////////////////////////////////////////////////////////////////////////////
  17.  
  18. ////////////////////////////////////////Defines///////////////////////////////////////////////
  19.  
  20. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  21. #define lgreen "{6EF83C}"
  22. #define lwhite "{FFFFFF}"
  23. #define lyellow "{FFFF22}"
  24. #define lblue "{33BBCC}"
  25. #define lpink "{FF0077}"
  26. #define lorange "{FF6622}"
  27. #define lred "{FF0000}"
  28. #define lgrey "{BEBEBE}"
  29. #define lyellow2 "{E1DE1C}"
  30. #define lgreen2 "{AFFF00}"
  31. #define green 0x00DE28FF
  32. #define green2 0xAFFF00FF
  33. #define darkgreen 0x5FB700FF
  34. #define lightgreen 0x23FF00FF
  35. #define red 0xFF0000FF
  36. #define yellow 0xF5FF00FF
  37. #define darkyellow 0xF5DE00FF
  38. #define orange 0xF5A300FF
  39. #define darkblue 0x0037FFFF
  40. #define blue 0x009BFFFF
  41. #define lightblue 0x00FFF0FF
  42. #define grey 0xB4B4B4FF
  43. #define white 0xF0F0F0FF
  44. #define purple 0x9C00AFFF
  45. #define Registerdialog 1
  46. #define Logindialog 2
  47. #define Helpdialog 3
  48. #define Commanddialog 4
  49. #define Rulesdialog 5
  50. #define Commondialog 6
  51. #define Vipdialog 7
  52. #define Admindialog 8
  53.  
  54. ///////////////////////////////////////////////////////////////////////////////////////////////////////
  55.  
  56. /////////////////////////////////////////////ENUM/////////////////////////////////////////////////////
  57.  
  58. enum pInfo {
  59. Logged,
  60. Password,
  61. AdminLevel,
  62. Viplevel,
  63. Cash,
  64. Score,
  65. Ip[20],
  66. IsBanned
  67. }
  68. new PlayerInfo[MAX_PLAYERS][pInfo];
  69.  
  70. //////////////////////////////////////////////////////////////////////////////////////////////////////
  71.  
  72. main()
  73. {
  74. print("\n----------------------------------");
  75. print(" Galaxy Stunting");
  76. print("----------------------------------\n");
  77. }
  78.  
  79. public OnGameModeInit()
  80. {
  81. // Don't use these lines if it's a filterscript
  82. SetGameModeText("Galaxy Stunting");
  83. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  84. return 1;
  85. }
  86.  
  87. public OnGameModeExit()
  88. {
  89. return 1;
  90. }
  91.  
  92. public OnPlayerRequestClass(playerid, classid)
  93. {
  94. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  95. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  96. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  97. return 1;
  98. }
  99.  
  100. public OnPlayerConnect(playerid)
  101. {
  102. GetPlayerIp(playerid,PlayerInfo[playerid][Ip],20);
  103. SendClientMessage(playerid, green, "Welcome to Galaxy Stunting");
  104. SendClientMessage(playerid, green, "Hope you enjoy!");
  105. SendClientMessage(playerid, green, "Type /commands for a list of commands");
  106. new name[MAX_PLAYER_NAME], file[128]; // the name and the file
  107. GetPlayerName(playerid, name, MAX_PLAYER_NAME); // getting client's name
  108. format(file, sizeof(file), "Admin/Users/%s.ini", name); // the location of the file
  109. if(!fexist(file)) { // if the file does not exists
  110. SendClientMessage(playerid, yellow, "You are not registered, please register");
  111. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Please Register", "Enter Your Password Below", "Register", "Cancel"); // this is the dialog type
  112. }
  113. else {
  114. new str[128]; // if the player IS registered
  115. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  116. format(str, sizeof(str), "Welcome Back %s. Enjoy!", name);
  117. SendClientMessage(playerid, yellow, str);
  118. new ip[20];
  119. format(ip,sizeof(ip),"%s",dini_Get(file,"Ip"));
  120. if(strcmp(ip,PlayerInfo[playerid][Ip],true)==0)
  121. {
  122. SendClientMessage(playerid, yellow, "You have been logged in automatically.");
  123. PlayerInfo[playerid][Password] = dini_Int(file,"Password");
  124. PlayerInfo[playerid][Viplevel] = dini_Int(file, "Viplevel");
  125. PlayerInfo[playerid][Cash] = dini_Int(file, "Cash");
  126. GivePlayerMoney(playerid, dini_Int(file, "cash"));
  127. PlayerInfo[playerid][Score] = dini_Int(file, "Score");
  128. PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  129. }
  130. else ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
  131. }
  132. return 1;
  133. }
  134.  
  135. public OnPlayerDisconnect(playerid, reason)
  136. {
  137. new file[128], name[MAX_PLAYER_NAME];
  138. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  139. format(file, sizeof(file), "Admin/Users/%s.ini", name);
  140.  
  141. if(dini_Exists(file)) {
  142. dini_IntSet(file, "Password", PlayerInfo[playerid][Password]);
  143. dini_IntSet(file, "IsBanned", PlayerInfo[playerid][IsBanned]);
  144. dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
  145. dini_IntSet(file, "Cash", PlayerInfo[playerid][Cash]);
  146. dini_IntSet(file, "Viplevel", PlayerInfo[playerid][Viplevel]);
  147. dini_IntSet(file, "Score", PlayerInfo[playerid][Score]);
  148. dini_Set(file, "Ip", PlayerInfo[playerid][Ip]);
  149. }
  150. return 1;
  151. }
  152.  
  153. public OnPlayerSpawn(playerid)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerDeath(playerid, killerid, reason)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnVehicleSpawn(vehicleid)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnVehicleDeath(vehicleid, killerid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerText(playerid, text[])
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnPlayerCommandText(playerid, cmdtext[])
  179. {
  180. //////////////////////////COMMON CMDS////////////////////////////////////////////
  181. if (strcmp("/help", cmdtext, true, 4) == 0)
  182. {
  183. ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Help", "Commands Help\nRules Help", "Open", "Close");
  184. return 1;
  185. }
  186. if (strcmp("/commands", cmdtext, true, 8) == 0)
  187. {
  188. ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Server Commands", "Common Commands\nVip Commands\nAdmin Commands\nOther", "Open", "Close");
  189. return 1;
  190. }
  191. if (strcmp("/rules", cmdtext, true, 5) == 0)
  192. {
  193. ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n- Dont Ask to Be Admin\n\n{ff0000}Do you agree to these rules?", "Yes", "No");
  194. return 1;
  195. }
  196. //////////////////////////////VIP CMDS/////////////////////////////////////
  197. if (strcmp("/vheal", cmdtext, true, 5) == 0)
  198. {
  199. SetPlayerHealth(playerid, 100);
  200. SendClientMessage(playerid, white, "You Have Been Healed !");
  201. return 1;
  202. }
  203. if (strcmp("/vcar", cmdtext, true, 4) == 0)
  204. {
  205. new Float:x,Float:y,Float:z;
  206. GetPlayerPos(playerid,x,y,z);
  207. new infernus;
  208. infernus=CreateVehicle(411,x,y+2,z,0,0,0,0);
  209. PutPlayerInVehicle(playerid,infernus,0);
  210. SendClientMessage(playerid, white, "You Have Spawned VIP Car!");
  211. return 1;
  212. }
  213. if (strcmp("/vplane", cmdtext, true, 6) == 0)
  214. {
  215. new Float:x,Float:y,Float:z;
  216. GetPlayerPos(playerid,x,y,z);
  217. new infernus;
  218. infernus=CreateVehicle(520,x,y+2,z,0,0,0,0);
  219. PutPlayerInVehicle(playerid,infernus,0);
  220. SendClientMessage(playerid, white, "You Have Spawned VIP Plane!");
  221. return 1;
  222. }
  223. if (strcmp("/vcolor", cmdtext, true, 4) == 0)
  224. {
  225. SetPlayerColor(playerid, 0x23FF00FF);
  226. SendClientMessage(playerid, white, "You Have Changed your Map Icon color to VIP Color!");
  227. return 1;
  228. }
  229. return 0;
  230. }
  231.  
  232. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  233. {
  234. return 1;
  235. }
  236.  
  237. public OnPlayerExitVehicle(playerid, vehicleid)
  238. {
  239. return 1;
  240. }
  241.  
  242. public OnPlayerStateChange(playerid, newstate, oldstate)
  243. {
  244. return 1;
  245. }
  246.  
  247. public OnPlayerEnterCheckpoint(playerid)
  248. {
  249. return 1;
  250. }
  251.  
  252. public OnPlayerLeaveCheckpoint(playerid)
  253. {
  254. return 1;
  255. }
  256.  
  257. public OnPlayerEnterRaceCheckpoint(playerid)
  258. {
  259. return 1;
  260. }
  261.  
  262. public OnPlayerLeaveRaceCheckpoint(playerid)
  263. {
  264. return 1;
  265. }
  266.  
  267. public OnRconCommand(cmd[])
  268. {
  269. return 1;
  270. }
  271.  
  272. public OnPlayerRequestSpawn(playerid)
  273. {
  274. return 1;
  275. }
  276.  
  277. public OnObjectMoved(objectid)
  278. {
  279. return 1;
  280. }
  281.  
  282. public OnPlayerObjectMoved(playerid, objectid)
  283. {
  284. return 1;
  285. }
  286.  
  287. public OnPlayerPickUpPickup(playerid, pickupid)
  288. {
  289. return 1;
  290. }
  291.  
  292. public OnVehicleMod(playerid, vehicleid, componentid)
  293. {
  294. return 1;
  295. }
  296.  
  297. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  298. {
  299. return 1;
  300. }
  301.  
  302. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  303. {
  304. return 1;
  305. }
  306.  
  307. public OnPlayerSelectedMenuRow(playerid, row)
  308. {
  309. return 1;
  310. }
  311.  
  312. public OnPlayerExitedMenu(playerid)
  313. {
  314. return 1;
  315. }
  316.  
  317. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  318. {
  319. return 1;
  320. }
  321.  
  322. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  323. {
  324. return 1;
  325. }
  326.  
  327. public OnRconLoginAttempt(ip[], password[], success)
  328. {
  329. return 1;
  330. }
  331.  
  332. public OnPlayerUpdate(playerid)
  333. {
  334. return 1;
  335. }
  336.  
  337. public OnPlayerStreamIn(playerid, forplayerid)
  338. {
  339. return 1;
  340. }
  341.  
  342. public OnPlayerStreamOut(playerid, forplayerid)
  343. {
  344. return 1;
  345. }
  346.  
  347. public OnVehicleStreamIn(vehicleid, forplayerid)
  348. {
  349. return 1;
  350. }
  351.  
  352. public OnVehicleStreamOut(vehicleid, forplayerid)
  353. {
  354. return 1;
  355. }
  356.  
  357. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  358. {
  359. if(dialogid == Registerdialog) {
  360. new file[128], name[MAX_PLAYER_NAME], str[128];
  361. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  362. format(file, sizeof(file), "Admin/Users/%s.ini", name);
  363. if(response) {
  364. if(strlen(inputtext)) {
  365. dini_Create(file);
  366. dini_IntSet(file, "Password", num_hash(inputtext));
  367. dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
  368. dini_IntSet(file, "Score", PlayerInfo[playerid][Score]);
  369. dini_IntSet(file, "Cash", PlayerInfo[playerid][Cash]);
  370. dini_Set(file, "Ip", PlayerInfo[playerid][Ip]);
  371. dini_IntSet(file, "IsBanned", PlayerInfo[playerid][IsBanned]);
  372. dini_IntSet(file, "Viplevel", PlayerInfo[playerid][Viplevel]);
  373. format(str, sizeof(str), "You are registered as %s. Your password is %s.", name, inputtext);
  374. SendClientMessage(playerid, red, str);
  375. PlayerInfo[playerid][Viplevel] = dini_Int(file, "Viplevel");
  376. PlayerInfo[playerid][Cash] = dini_Int(file, "Cash");
  377. PlayerInfo[playerid][Score] = dini_Int(file, "Score");
  378. PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  379.  
  380. PlayerInfo[playerid][Password] = num_hash(inputtext);
  381. }
  382. }
  383. else {
  384. Kick(playerid);
  385. }
  386. }
  387. if(dialogid == Logindialog) {
  388. new file[128], name[MAX_PLAYER_NAME];
  389. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  390. format(file, sizeof(file), "Admin/Users/%s.ini", name);
  391. if(response) {
  392. if(strlen(inputtext)) {
  393. if(num_hash(inputtext) != dini_Int(file,"Password")) {
  394. SendClientMessage(playerid, red, "Wrong Password");
  395. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
  396. }
  397. else {
  398. SendClientMessage(playerid, yellow, "Succesfuly logged in");
  399. PlayerInfo[playerid][Password] = dini_Int(file,"Password");
  400. PlayerInfo[playerid][Viplevel] = dini_Int(file, "Viplevel");
  401. PlayerInfo[playerid][Cash] = dini_Int(file, "Cash");
  402. GivePlayerMoney(playerid, dini_Int(file, "cash"));
  403. PlayerInfo[playerid][Score] = dini_Int(file, "Score");
  404. PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  405. }
  406. }
  407. }
  408. else
  409. {
  410. Kick(playerid);
  411. }
  412. }
  413. if(dialogid == Rulesdialog)
  414. {
  415. if(response) // If they clicked 'Yes' or pressed enter
  416. {
  417. SendClientMessage(playerid, green, "Thank you for agreeing to the server rules! You Get $5000 For It !");
  418. GivePlayerMoney(playerid,5000);
  419. }
  420. else // Pressed ESC or clicked cancel
  421. {
  422. SendClientMessage(playerid, red, "You MUST agree to the server rules to play here.");
  423. Kick(playerid);
  424. }
  425. return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  426. }
  427. if(dialogid == Commanddialog)
  428. {
  429. if(response) // If they clicked 'Select' or double-clicked a weapon
  430. {
  431. if(listitem == 0) // They selected the first item - Desert Eagle
  432. {
  433. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX, "Common Commands", "/help - To Get More Help About Server\n/colors - To See List of Colors\n/Teles - To See all the Current Teles\n/admins - To see Online Admins\n/pm - To Send a Personal Message\n/afk - To Be AFK\n/back - To come Back From AFK", "Ok", "Cancel");
  434. }
  435. if(listitem == 1) // They selected the second item - AK-47
  436. {
  437. ShowPlayerDialog(playerid, 7, DIALOG_STYLE_MSGBOX, "Vip Commands", "/vneons - To get Neon on Your Car\n/vheal - To Heal Yourself\n/vcar - To Spawn a VIP Car\n/vplane - To Spawn a VIP Plane\n/vcolor - To get VIP Color in Map ( Green )\n! - To Vip Chat", "Ok", "Cancel");
  438. }
  439. if(listitem == 2) // They selected the third item - Desert Eagle
  440. {
  441. ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "Admin Commands", "/", "Ok", "Cancel");
  442. }
  443. return 1;
  444. }
  445. return 1;
  446. }
  447. return 0;
  448. }
  449.  
  450. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  451. {
  452. return 1;
  453. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement