Advertisement
Guest User

Untitled

a guest
Apr 27th, 2014
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.73 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <YSI\y_ini>
  4. #include <sscanf>
  5. #include <core>
  6. #include <float>
  7.  
  8.  
  9. // God mode
  10. new Godmode[MAX_PLAYERS];
  11. // Health Pickups
  12. new HPickupls;
  13.  
  14.  
  15.  
  16. //------Defines---------------
  17. #define DIALOG_REGISTER 1
  18. #define DIALOG_LOGIN 2
  19. #define DIALOG_SUCCESS_1 3
  20. #define DIALOG_SUCCESS_2 4
  21. #define DIALOG_HELP 100
  22.  
  23. #define PATH "/Users/%s.ini"
  24. //Colors
  25. #define COLOR_GREY 0xAFAFAFAA
  26. #define COLOR_MALERT 0xDB4D33FF
  27. #define COLOR_LEAVE 0xC86D46FF
  28. #define COLOR_GREEN 0x33AA33AA
  29. #define COLOR_RED 0xAA3333AA
  30. #define COLOR_MOST_WANTED 0x9A0000E7
  31. #define COLOR_YELLOW 0xFFFF00AA
  32. #define COLOR_WHITE 0xFFFFFFAA
  33. #define COLOR_BLUE 0x0000BBAA
  34. #define COLOR_LIGHTBLUE 0x33CCFFAA
  35. #define COLOR_CALERT 0x78B6A8FF
  36. #define COLOR_ORANGE 0xFF9900AA
  37. #define COLOR_FADE1 0xE6E6E6E6
  38. #define COLOR_FADE2 0xC8C8C8C8
  39. #define COLOR_FADE3 0xAAAAAAAA
  40. #define COLOR_FADE4 0x8C8C8C8C
  41. #define COLOR_FADE5 0x6E6E6E6E
  42. #define COLOR_PURPLE 0xC2A2DAAA
  43. #define COLOR_LIME 0x10F441AA
  44. #define COLOR_MAGENTA 0xFF00FFFF
  45. #define COLOR_SEAGREEN 0x10F441AA
  46. #define COLOR_NAVY 0x000080AA
  47. #define COLOR_AQUA 0xF0F8FFAA
  48. #define COLOR_CRIMSON 0xDC143CAA
  49. #define COLOR_FLBLUE 0x6495EDAA
  50. #define COLOR_BISQUE 0xFFE4C4AA
  51. #define COLOR_BLACK 0x000000AA
  52. #define COLOR_REALRED 0xFF0606FF
  53. #define COLOR_LIGHTRED 0xFF6347AA
  54. #define COLOR_LIGHTBLUE 0x33CCFFAA
  55. #define COLOR_LIRED 0xAF0000B4
  56. #define COLOR_LIGHTGREEN 0x9ACD32AA
  57. #define COLOR_CHARTREUSE 0x7FFF00AA
  58. #define COLOR_BROWN 0XA52A2AAA
  59. #define COLOR_CORAL 0xFF7F50AA
  60. #define COLOR_GOLD 0xB8860BAA
  61. #define COLOR_GRAD1 0xB4B5B7FF
  62. #define COLOR_GRAD2 0xBFC0C2FF
  63. #define COLOR_GRAD3 0xCBCCCEFF
  64. #define COLOR_GRAD4 0xD8D8D8FF
  65. #define COLOR_GRAD5 0xE3E3E3FF
  66. #define COLOR_GRAD6 0xF0F0F0FF
  67. #define COL_WHITE "{FFFFFF}"
  68. #define COL_RED "{F81414}"
  69. #define COL_GREEN "{00FF22}"
  70. #define COL_LIGHTBLUE "{00CED1}"
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. enum pInfo
  78. {
  79. pPass,
  80. pCash,
  81. pAdmin,
  82. pKills,
  83. pDeaths
  84. }
  85. new PlayerInfo[MAX_PLAYERS][pInfo];
  86.  
  87. forward LoadUser_data(playerid,name[],value[]);
  88. public LoadUser_data(playerid,name[],value[])
  89. {
  90. INI_Int("Password",PlayerInfo[playerid][pPass]);
  91. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  92. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  93. INI_Int("Kills",PlayerInfo[playerid][pKills]);
  94. INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  95. return 1;
  96. }
  97.  
  98. stock udb_hash(buf[]) {
  99. new length=strlen(buf);
  100. new s1 = 1;
  101. new s2 = 0;
  102. new n;
  103. for (n=0; n<length; n++)
  104. {
  105. s1 = (s1 + buf[n]) % 65521;
  106. s2 = (s2 + s1) % 65521;
  107. }
  108. return (s2 << 16) + s1;
  109. }
  110.  
  111. stock UserPath(playerid)
  112. {
  113. new string[128],playername[MAX_PLAYER_NAME];
  114. GetPlayerName(playerid,playername,sizeof(playername));
  115. format(string,sizeof(string),PATH,playername);
  116. return string;
  117. }
  118.  
  119. main()
  120. {
  121. print("\n-------------------------------------------------");
  122. print(" [0.3z] S-G Freeroam |SG|V1.0 ");
  123. print("-------------------------------------------------\n");
  124. }
  125.  
  126.  
  127.  
  128. public OnGameModeInit()
  129. {
  130. // Don't use these lines if it's a filterscript
  131. SetGameModeText("S-G Freeroam");
  132. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  133. AddPlayerClass(281,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  134. AddPlayerClass(282,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  135. AddPlayerClass(283,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  136. AddPlayerClass(284,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  137. AddPlayerClass(285,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  138. AddPlayerClass(286,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  139. AddPlayerClass(287,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  140. AddPlayerClass(288,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  141. AddPlayerClass(289,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  142. AddPlayerClass(265,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  143. AddPlayerClass(266,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  144. AddPlayerClass(267,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  145. AddPlayerClass(268,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  146. AddPlayerClass(269,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  147. AddPlayerClass(270,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  148. AddPlayerClass(1,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  149. AddPlayerClass(2,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  150. AddPlayerClass(3,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  151. AddPlayerClass(4,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  152. AddPlayerClass(5,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  153. AddPlayerClass(6,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  154. AddPlayerClass(8,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  155. AddPlayerClass(42,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  156. AddPlayerClass(65,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  157. //AddPlayerClass(74,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  158. AddPlayerClass(86,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  159. AddPlayerClass(119,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  160. AddPlayerClass(149,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  161. AddPlayerClass(208,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  162. AddPlayerClass(273,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  163. AddPlayerClass(289,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  164.  
  165. AddPlayerClass(47,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  166. AddPlayerClass(48,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  167. AddPlayerClass(49,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  168. AddPlayerClass(50,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  169. AddPlayerClass(51,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  170. AddPlayerClass(52,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  171. AddPlayerClass(53,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  172. AddPlayerClass(54,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  173. AddPlayerClass(55,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  174. AddPlayerClass(56,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  175. AddPlayerClass(57,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  176. AddPlayerClass(58,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  177. AddPlayerClass(68,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  178. AddPlayerClass(69,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  179. AddPlayerClass(70,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  180. AddPlayerClass(71,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  181. AddPlayerClass(72,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  182. AddPlayerClass(73,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  183. AddPlayerClass(75,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  184. AddPlayerClass(76,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  185. AddPlayerClass(78,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  186. AddPlayerClass(79,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  187. AddPlayerClass(80,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  188. AddPlayerClass(81,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  189. AddPlayerClass(82,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  190. AddPlayerClass(83,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  191. AddPlayerClass(84,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  192. AddPlayerClass(85,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  193. AddPlayerClass(87,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  194. AddPlayerClass(88,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  195. AddPlayerClass(89,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  196. AddPlayerClass(91,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  197. AddPlayerClass(92,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  198. AddPlayerClass(93,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  199. AddPlayerClass(95,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  200. AddPlayerClass(96,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  201. AddPlayerClass(97,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  202. AddPlayerClass(98,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  203. AddPlayerClass(99,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
  204.  
  205. //---------------------------------------------- Pickups -------------------
  206. HPickupls = CreatePickup(1240, 2, 2640.0710,2326.6436,17.8203,-1); // Here we create our pickup
  207.  
  208.  
  209.  
  210.  
  211. return 1;
  212. }
  213.  
  214. public OnGameModeExit()
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnPlayerRequestClass(playerid, classid)
  220. {
  221. if(IsPlayerNPC(playerid)) return 1;
  222. SetPlayerPos(playerid, 2640.0710,2326.6436,17.8203);
  223. SetPlayerCameraPos(playerid, 2645.9104,2320.3469,17.8203);
  224. SetPlayerCameraLookAt(playerid, 2638.6704,2327.9124,20.5685);
  225. SetPlayerFacingAngle(playerid, 224);
  226.  
  227. return 1;
  228. }
  229.  
  230. public OnPlayerConnect(playerid)
  231. {
  232.  
  233.  
  234.  
  235. if(fexist(UserPath(playerid)))
  236. {
  237. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  238. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
  239. }
  240. else
  241. {
  242. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
  243. }
  244. return 1;
  245. }
  246.  
  247. public OnPlayerDisconnect(playerid, reason)
  248. {
  249. new INI:File = INI_Open(UserPath(playerid));
  250. INI_SetTag(File,"data");
  251. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  252. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  253. INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  254. INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  255. INI_Close(File);
  256. return 1;
  257. }
  258.  
  259. public OnPlayerSpawn(playerid)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnPlayerDeath(playerid, killerid, reason)
  265. {
  266. PlayerInfo[killerid][pKills]++;
  267. PlayerInfo[playerid][pDeaths]++;
  268. return 1;
  269. }
  270.  
  271. public OnVehicleSpawn(vehicleid)
  272. {
  273. return 1;
  274. }
  275.  
  276. public OnVehicleDeath(vehicleid, killerid)
  277. {
  278. return 1;
  279. }
  280.  
  281. public OnPlayerText(playerid, text[])
  282. {
  283. return 1;
  284. }
  285.  
  286. public OnPlayerCommandText(playerid, cmdtext[])
  287. {
  288. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  289. {
  290. // Do something here
  291. return 1;
  292. }
  293. return 0;
  294. }
  295.  
  296. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  297. {
  298. return 1;
  299. }
  300.  
  301. public OnPlayerExitVehicle(playerid, vehicleid)
  302. {
  303. return 1;
  304. }
  305.  
  306. public OnPlayerStateChange(playerid, newstate, oldstate)
  307. {
  308. return 1;
  309. }
  310.  
  311. public OnPlayerEnterCheckpoint(playerid)
  312. {
  313. return 1;
  314. }
  315.  
  316. public OnPlayerLeaveCheckpoint(playerid)
  317. {
  318. return 1;
  319. }
  320.  
  321. public OnPlayerEnterRaceCheckpoint(playerid)
  322. {
  323. return 1;
  324. }
  325.  
  326. public OnPlayerLeaveRaceCheckpoint(playerid)
  327. {
  328. return 1;
  329. }
  330.  
  331. public OnRconCommand(cmd[])
  332. {
  333. return 1;
  334. }
  335.  
  336. public OnPlayerRequestSpawn(playerid)
  337. {
  338. return 1;
  339. }
  340.  
  341. public OnObjectMoved(objectid)
  342. {
  343. return 1;
  344. }
  345.  
  346. public OnPlayerObjectMoved(playerid, objectid)
  347. {
  348. return 1;
  349. }
  350.  
  351. public OnPlayerPickUpPickup(playerid, pickupid)
  352. {
  353. if(pickupid == HPickupls) // If player pickups the HPickup
  354. {
  355. SetPlayerHealth(playerid, 100);
  356. return 1;
  357. }
  358. return 1;
  359. }
  360.  
  361. public OnVehicleMod(playerid, vehicleid, componentid)
  362. {
  363. return 1;
  364. }
  365.  
  366. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  367. {
  368. return 1;
  369. }
  370.  
  371. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  372. {
  373. return 1;
  374. }
  375.  
  376. public OnPlayerSelectedMenuRow(playerid, row)
  377. {
  378. return 1;
  379. }
  380.  
  381. public OnPlayerExitedMenu(playerid)
  382. {
  383. return 1;
  384. }
  385.  
  386. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  387. {
  388. return 1;
  389. }
  390.  
  391. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  392. {
  393. return 1;
  394. }
  395.  
  396. public OnRconLoginAttempt(ip[], password[], success)
  397. {
  398. return 1;
  399. }
  400.  
  401. public OnPlayerUpdate(playerid)
  402. {
  403. return 1;
  404. }
  405.  
  406. public OnPlayerStreamIn(playerid, forplayerid)
  407. {
  408. return 1;
  409. }
  410.  
  411. public OnPlayerStreamOut(playerid, forplayerid)
  412. {
  413. return 1;
  414. }
  415.  
  416. public OnVehicleStreamIn(vehicleid, forplayerid)
  417. {
  418. return 1;
  419. }
  420.  
  421. public OnVehicleStreamOut(vehicleid, forplayerid)
  422. {
  423. return 1;
  424. }
  425.  
  426. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  427. {
  428. switch( dialogid )
  429. {
  430. case DIALOG_REGISTER:
  431. {
  432. if (!response) return Kick(playerid);
  433. if(response)
  434. {
  435. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
  436. new INI:File = INI_Open(UserPath(playerid));
  437. INI_SetTag(File,"data");
  438. INI_WriteInt(File,"Password",udb_hash(inputtext));
  439. INI_WriteInt(File,"Cash",0);
  440. INI_WriteInt(File,"Admin",0);
  441. INI_WriteInt(File,"Kills",0);
  442. INI_WriteInt(File,"Deaths",0);
  443. INI_Close(File);
  444.  
  445. SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
  446. SpawnPlayer(playerid);
  447. ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You have Registerd. Relog to save your stats!","Ok","");
  448. }
  449. }
  450.  
  451. case DIALOG_LOGIN:
  452. {
  453. if ( !response ) return Kick ( playerid );
  454. if( response )
  455. {
  456. if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  457. {
  458. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  459. GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  460. ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
  461. }
  462. else
  463. {
  464. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
  465. }
  466. return 1;
  467. }
  468. }
  469. }
  470. return 1;
  471. }
  472.  
  473. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  474. {
  475. return 1;
  476. }
  477.  
  478. //-------------------------------Player cmds------------------------------------
  479. CMD:credits(playerid, params[])
  480. {
  481. SendClientMessage(playerid, 0xFFFFFFF, "Server created by Mc_karlis ");
  482. SendClientMessage(playerid, 0xFFFFFFF, "And big thanks to Naruto Emilio for all the help ");
  483. return 1;
  484. }
  485.  
  486. CMD:help(playerid, params[])
  487. {
  488. new helpinfo[126];
  489. strcat(helpinfo, "GENERAL: /help /credits /godmode \n", sizeof(helpinfo));
  490. strcat(helpinfo, "TELEPORTS: /sf /lv /ls \n", sizeof(helpinfo));
  491.  
  492.  
  493.  
  494. ShowPlayerDialog(playerid, DIALOG_HELP, DIALOG_STYLE_MSGBOX, "Help", helpinfo, "Ok", "");
  495. return 1;
  496. }
  497.  
  498. CMD:godmode(playerid, params[])
  499. {
  500. if(IsPlayerConnected(playerid))
  501. {
  502. if(Godmode[playerid] == 0)
  503. {
  504. Godmode[playerid] = 1;
  505. SetPlayerHealth(playerid, 99999);
  506. SetPlayerArmour(playerid, 99999);
  507. SendClientMessage(playerid, -1, "You have enabled the god mode");
  508. }
  509. else if(Godmode[playerid] == 1)
  510. {
  511. Godmode[playerid] = 0;
  512. SetPlayerHealth(playerid, 100);
  513. SetPlayerArmour(playerid, 0);
  514. SendClientMessage(playerid, -1, "You have disabled the god mode");
  515. }
  516. }
  517. else
  518. {
  519. SendClientMessage(playerid, -1, "You are not an admin");
  520. }
  521. return 1;
  522. }
  523.  
  524. CMD:sf(playerid,params)
  525. {
  526. #pragma unused params
  527. SetPlayerPos(playerid, -1991.2479,150.8329,27.5391);
  528. return 1;
  529. }
  530.  
  531. CMD:lv(playerid,params)
  532. {
  533. #pragma unused params
  534. SetPlayerPos(playerid, 2045.2657,1343.9778,10.6719);
  535. return 1;
  536. }
  537.  
  538. CMD:ls(playerid,params)
  539. {
  540. #pragma unused params
  541. SetPlayerPos(playerid, 1493.1505,-1732.1243,13.3828);
  542. return 1;
  543. }
  544. //-------------------------------admin cmds-------------------------------------
  545. CMD:acmds(playerid, params[])
  546. {
  547. if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 2 || IsPlayerAdmin(playerid))
  548. {
  549. ShowPlayerDialog(playerid, 12515, DIALOG_STYLE_LIST, "Admin Commands", "/kick\n/goto", "Select", "Cancel");
  550. return 1;
  551. }
  552.  
  553. else if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 3 || IsPlayerAdmin(playerid))
  554. {
  555. ShowPlayerDialog(playerid, 12515, DIALOG_STYLE_LIST, "Admin Commands", "/ban\n/kick\n/goto", "Select", "Cancel");
  556. return 1;
  557. }
  558.  
  559. else if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 4 || IsPlayerAdmin(playerid))
  560. {
  561. ShowPlayerDialog(playerid, 12515, DIALOG_STYLE_LIST, "Admin Commands", "/ban\n/kick\n/goto", "Select", "Cancel");
  562. return 1;
  563. }
  564.  
  565. else if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 5 || IsPlayerAdmin(playerid))
  566. {
  567. ShowPlayerDialog(playerid, 12515, DIALOG_STYLE_LIST, "Admin Commands", "/ban\n/kick\n/goto", "Select", "Cancel");
  568. return 1;
  569. }
  570.  
  571. else if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 6 || IsPlayerAdmin(playerid))
  572. {
  573. ShowPlayerDialog(playerid, 12515, DIALOG_STYLE_LIST, "Admin Commands", "/ban\n/kick\n/goto", "Select", "Cancel");
  574. return 1;
  575. }
  576.  
  577. return 1;
  578. }
  579.  
  580. CMD:kick(playerid, params[])
  581. {
  582. if(PlayerInfo[playerid][pAdmin] >= 1) {
  583. new PID; //define the playerid we wanna kick
  584. new reason[64]; //the reason, put into a string
  585. new str[128]; //a new message string
  586. new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
  587. GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  588. GetPlayerName(PID, Playername, sizeof(Playername));
  589. if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
  590.  
  591. if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
  592. return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  593.  
  594. format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
  595. SendClientMessageToAll(COLOR_RED, str); //send that message to all
  596. Kick(PID); //kick the playerid we've defined
  597.  
  598. }
  599. else //if he has not got the permissions
  600. {
  601. SendClientMessage(playerid, COLOR_GREY, "You have to be level 1 to use that command!"); //return this message
  602. }
  603. return 1;
  604. }
  605.  
  606. CMD:ban(playerid, params[])
  607. {
  608. if(PlayerInfo[playerid][pAdmin] >= 2) {
  609. new PID; //define the playerid we wanna ban
  610. new reason[64]; //the reason, put into a string
  611. new str[128]; //a new message string
  612. new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
  613. GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  614. GetPlayerName(PID, Playername, sizeof(Playername));
  615. if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
  616.  
  617. if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
  618. return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  619.  
  620. format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
  621. SendClientMessageToAll(COLOR_RED, str); //send that message to all
  622. Ban(PID); //Ban the playerid we've defined
  623.  
  624. }
  625. else //if he has not got the permissions
  626. {
  627. SendClientMessage(playerid, COLOR_GREY, "You have to be level 2 to use that command!"); //return this message
  628. }
  629. return 1;
  630. }
  631.  
  632. CMD:goto(playerid, params[])
  633. {
  634. if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, 0xFF0000AA, "You need to be a admin to use this command");
  635. new ID;
  636. new pn[MAX_PLAYER_NAME];
  637. new an[MAX_PLAYER_NAME];
  638. new str[128];
  639. if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]"); //This is a long line, "sscanf" is the plugin that search the missing params, "params" is the param that define params LOL, "u" is the PARAM that define the MISSING ID, ID is the param for the targetid
  640. if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid
  641. GetPlayerName(playerid, an, MAX_PLAYER_NAME);//Define the playerid's param
  642. GetPlayerName(ID, pn, MAX_PLAYER_NAME);//Define the ID's param
  643. new Float:x; //Defining float X
  644. new Float:y; //Same
  645. new Float:z; //Same
  646. GetPlayerPos(ID, x, y, z); //This line get the "ID" position
  647. SetPlayerPos(playerid, x+1, y+1, z); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1);
  648. format(str, sizeof(str), "You have been teleported to %s", pn); //Showed before, this is the line that give the message to playerid)
  649. SendClientMessage(playerid, 0x00FF00AA, str); //This line give the message to playerid
  650. if(IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do?
  651. {
  652. GetPlayerPos(ID, x, y, z);
  653. SetVehiclePos(playerid, x+1, y+1, z); //And this one? :D
  654. }
  655. return 1;
  656. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement