Guest User

Untitled

a guest
Dec 19th, 2013
871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.26 KB | None | 0 0
  1. /*
  2.  
  3.  
  4.  
  5. ############################################################################################################################################################
  6. ############################################################################################################################################################
  7. ############################################################################################################################################################
  8. ############################################################################################################################################################
  9. #################==================================############=======#####\####/###########################################################################
  10. #################|#################################|############|I#I|######|\##/#|##########################################################################
  11. #################|#################################|############|I#I|######|#\#/#|##########################################################################
  12. #################|#################################|############|I#I|######|##|#|###########################################################################
  13. #################|#################################|############|I##|######|#####|##########################################################################
  14. #################|#################################|########################################################################################################
  15. #################|############Copyright(c)#########|########################################################################################################
  16. #################|#################################|########################################################################################################
  17. #################|#################################|########################################################################################################
  18. #################|#################################|########################################################################################################
  19. #################|#################################|########################################################################################################
  20. #################|=================================|########################################################################################################
  21. #################|####|#########|#######|#####|####|########################################################################################################
  22. #################|####|#########|#######|#####|####|########################################################################################################
  23. #################|====|=========|=======|=====|====|########################################################################################################
  24. #################|####|#########|#######|#####|####|########################################################################################################
  25. #################|####|#########|#######|#####|####|########################################################################################################
  26. #################|====|=========|=======|=====|====|########################################################################################################
  27. #################|####|#########|#######|#####|####|########################################################################################################
  28. #################|####|#########|#######|#####|####|########################################################################################################
  29. #################|====|=========|=======|=====|====|########################################################################################################
  30. #################|####|#########|#######|#####|####|########################################################################################################
  31. #################|####|#########|#######|#####|####|########################################################################################################
  32. #################|====|=========|=======|=====|====|########################################################################################################
  33. #################|####|#########|#######|#####|####|########################################################################################################
  34. #################|####|#########|#######|#####|####|########################################################################################################
  35. #################|====|=========|=======|=====|====|########################################################################################################
  36. #################|####|#########|#######|#####|####|########################################################################################################
  37. #################|####|#########|#######|#####|####|########################################################################################################
  38. #################==================================#########################################################################################################
  39. ############################################################################################################################################################
  40. ############################################################################################################################################################
  41. ############################################################################################################################################################
  42.  
  43.  
  44.  
  45. //==============================================================================
  46.  
  47.  
  48. */
  49.  
  50.  
  51.  
  52.  
  53.  
  54. #include <a_samp>
  55. #include <sscanf2>
  56. #include <YSI\y_ini>
  57. #include <zcmd>
  58. #include <foreach>
  59. #include <Dini>
  60. new muted[MAX_PLAYERS];
  61. #define DIALOG_REGISTER 800
  62. #define DIALOG_LOGIN 8001
  63. #define DIALOG_SUCCESS_1 8003
  64. #define DIALOG_SUCCESS_2 8004
  65. #define Grey 0xC0C0C0C8
  66. #define PATH "/Users/%s.ini"
  67. #define COL_WHITE "{FFFFFF}"
  68. #define COL_RED "{F81414}"
  69. #define COL_GREEN "{00FF22}"
  70. #define COL_LIGHTBLUE "{00CED1}"
  71. //Shades of red
  72. #define COLOR_INDIANRED 0xCD5C5CFF
  73. #define COLOR_LIGHTCORAL 0xF08080FF
  74. #define COLOR_SALMON 0xFA8072FF
  75. #define COLOR_DARKSALMON 0xE9967AFF
  76. #define COLOR_LIGHTSALMON 0xFFA07AFF
  77. #define COLOR_CRIMSON 0xDC143CFF
  78. #define COLOR_RED 0xFF0000FF
  79. #define COLOR_FIREBRICK B22222FF
  80. #define COLOR_DARKRED 0x8B0000FF
  81.  
  82. //Shades of pink
  83. #define COLOR_PINK 0xFFC0CBFF
  84. #define COLOR_LIGHTPINK 0xFFB6C1FF
  85. #define COLOR_HOTPINK 0xFF69B4FF
  86. #define COLOR_DEEPPINK 0xFF1493FF
  87. #define COLOR_MEDIUMVIOLETRED 0xC71585FF
  88. #define COLOR_PALEVIOLETRED 0xDB7093FF
  89.  
  90. //Shades of Orange
  91. #define COLOR_CORAL 0xFF7F50FF
  92. #define COLOR_TOMATO 0xFF6347FF
  93. #define COLOR_ORANGERED 0xFF4500FF
  94. #define COLOR_DARKORANGE 0xFF8C00FF
  95. #define COLOR_ORANGE 0xFFA500FF
  96.  
  97. //Shades of Yellow
  98. #define COLOR_GOLD 0xFFD700FF
  99. #define COLOR_YELLOW 0xFFFF00FF
  100. #define COLOR_LIGHTYELLOW 0xFFFFE0FF
  101. #define COLOR_LEMONCHIFFON 0xFFFACDFF
  102. #define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
  103. #define COLOR_PAPAYAWHIP 0xFFEFD5FF
  104. #define COLOR_MOCCASIN 0xFFE4B5FF
  105. #define COLOR_PEACHPUFF 0xFFDAB9FF
  106. #define COLOR_PALEGOLDENROD 0xEEE8AAFF
  107. #define COLOR_KHAKI 0xF0E68CFF
  108. #define COLOR_DARKKHAKI 0xBDB76BFF
  109.  
  110. //Shades of Purple
  111. #define COLOR_LAVENDER 0xE6E6FAFF
  112. #define COLOR_THISTLE 0xD8BFD8FF
  113. #define COLOR_PLUM 0xDDA0DDFF
  114. #define COLOR_VIOLET 0xEE82EEFF
  115. #define COLOR_ORCHID 0xDA70D6FF
  116. #define COLOR_FUCHSIA 0xFF00FFFF
  117. #define COLOR_MAGENTA 0xFF00FFFF
  118. #define COLOR_MEDIUMORCHID 0xBA55D3FF
  119. #define COLOR_MEDIUMPURPLE 0x9370DBFF
  120. #define COLOR_AMETHYST 0x9966CCFF
  121. #define COLOR_BLUEVIOLET 0x8A2BE2FF
  122. #define COLOR_DARKVIOLET 0x9400D3FF
  123. #define COLOR_DARKORCHID 0x9932CCFF
  124. #define COLOR_DARKMAGENTA 0x8B008BFF
  125. #define COLOR_PURPLE 0x800080FF
  126. #define COLOR_INDIGO 0x4B0082FF
  127. #define COLOR_SLATEBLUE 0x6A5ACDFF
  128. #define COLOR_DARKSLATEBLUE 0x483D8BFF
  129. #define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
  130.  
  131. //Shades of Green
  132. #define COLOR_GREENYELLOW 0xADFF2FFF
  133. #define COLOR_CHARTREUSE 0x7FFF00FF
  134. #define COLOR_LAWNGREEN 0x7CFC00FF
  135. #define COLOR_LIME 0x00FF00FF
  136. #define COLOR_LIMEGREEN 0x32CD32FF
  137. #define COLOR_PALEGREEN 0x98FB98FF
  138. #define COLOR_LIGHTGREEN 0x90EE90FF
  139. #define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
  140. #define COLOR_SPRINGGREEN 0x00FF7FFF
  141. #define COLOR_MEDIUMSEAGREEN 0x3CB371FF
  142. #define COLOR_SEAGREEN 0x2E8B57FF
  143. #define COLOR_FORESTGREEN 0x228B22FF
  144. #define COLOR_GREEN 0x008000FF
  145. #define COLOR_DARKGREEN 0x006400FF
  146. #define COLOR_YELLOWGREEN 0x9ACD32FF
  147. #define COLOR_OLIVEDRAB 0x6B8E23FF
  148. #define COLOR_OLIVE 0x808000FF
  149. #define COLOR_DARKOLIVEGREEN 0x556B2FFF
  150. #define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
  151. #define COLOR_DARKSEAGREEN 0x8FBC8FFF
  152. #define COLOR_LIGHTSEAGREEN 0x20B2AAFF
  153. #define COLOR_DARKCYAN 0x008B8BFF
  154. #define COLOR_TEAL 0x008080FF
  155.  
  156. //Shades of Blue/Cyan
  157. #define COLOR_AQUA 0x00FFFFFF
  158. #define COLOR_CYAN 0x00FFFFFF
  159. #define COLOR_LIGHTCYAN 0xE0FFFFFF
  160. #define COLOR_PALETURQUOISE 0xAFEEEEFF
  161. #define COLOR_AQUAMARINE 0x7FFFD4FF
  162. #define COLOR_TURQUOISE 0x40E0D0FF
  163. #define COLOR_MEDIUMTURQUOISE 0x48D1CC
  164. #define COLOR_DARKTURQUOISE 0x00CED1FF
  165. #define COLOR_CADETBLUE 0x5F9EA0FF
  166. #define COLOR_STEELBLUE 0x4682B4FF
  167. #define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
  168. #define COLOR_POWDERBLUE 0xB0E0E6FF
  169. #define COLOR_LIGHTBLUE 0xADD8E6FF
  170. #define COLOR_SKYBLUE 0x87CEEBFF
  171. #define COLOR_LIGHTSKYBLUE 0x87CEFAFF
  172. #define COLOR_DEEPSKYBLUE 0x00BFFFFF
  173. #define COLOR_DODGERBLUE 0x1E90FFFF
  174. #define COLOR_CORNFLOWERBLUE 0x6495EDFF
  175. #define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
  176. #define COLOR_ROYALBLUE 0x4169E1FF
  177. #define COLOR_BLUE 0x0000FFFF
  178. #define COLOR_MEDIUMBLUE 0x0000CDFF
  179. #define DARKBLUE 0x00008BFF
  180. #define COLOR_NAVY 0x000080FF
  181. #define COLOR_MIDNIGHTBLUE 0x191970FF
  182.  
  183. //Shades of Brown
  184. #define COLOR_CORNSILK 0xFFF8DCFF
  185. #define COLOR_BLANCHEDALMOND 0xFFEBCDFF
  186. #define COLOR_BISQUE 0xFFE4C4FF
  187. #define COLOR_NAVAJOWHITE 0xFFDEADFF
  188. #define COLOR_WHEAT 0xF5DEB3FF
  189. #define COLOR_BURLYWOOD 0xDEB887FF
  190. #define COLOR_TAN 0xD2B48CFF
  191. #define COLOR_ROSYBROWN 0xBC8F8FFF
  192. #define COLOR_SANDYBROWN 0xF4A460FF
  193. #define COLOR_DARKGOLDENROD 0xB8860BFF
  194. #define COLOR_PERU 0xCD853FFF
  195. #define COLOR_SADDLEBROWN 0x8B4513FF
  196. #define COLOR_SIENNA 0xA0522DFF
  197. #define COLOR_BROWN 0xA52A2AFF
  198. #define COLOR_MAROON 0x800000FF
  199.  
  200. //Shades of Grey
  201. #define COLOR_WHITE 0xFFFFFFFF
  202. #define COLOR_GAINSBORO 0xDCDCDCFF
  203. #define COLOR_LIGHTGREY 0xD3D3D3FF
  204. #define COLOR_SILVER 0xC0C0C0FF
  205. #define COLOR_DARKGRAY 0xA9A9A9FF
  206. #define COLOR_GRAY 0x808080FF
  207. #define COLOR_DIMGRAY 0x696969FF
  208. #define COLOR_LIGHTSLATEGRAY 0x778899FF
  209. #define COLOR_SLATEGRAY 0x708090FF
  210. #define COLOR_DARKSLATEGRAY 0x2F4F4FFF
  211. #define COLOR_BLACK 0x000000FFPS.
  212.  
  213. new String[128], Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS], vWorld[MAX_PLAYERS], Inter[MAX_PLAYERS];
  214. new IsSpecing[MAX_PLAYERS], Name[MAX_PLAYER_NAME], IsBeingSpeced[MAX_PLAYERS],spectatorid[MAX_PLAYERS];
  215.  
  216. new WTimer1;
  217.  
  218. forward Wheel1(playerid);
  219.  
  220. enum pInfo
  221. {
  222. pPass,
  223. pCash,
  224. pAdmin,
  225. pKills,
  226. pDeaths
  227. }
  228. new PlayerInfo[MAX_PLAYERS][pInfo];
  229.  
  230. stock Path(playerid)
  231. {
  232. new str[128],name[MAX_PLAYER_NAME];
  233. GetPlayerName(playerid,name,sizeof(name));
  234. format(str,sizeof(str),UserPath,name);
  235. return str;
  236. }
  237.  
  238. forward LoadUser_data(playerid,name[],value[]);
  239. public LoadUser_data(playerid,name[],value[])
  240. {
  241. INI_Int("Password",PlayerInfo[playerid][pPass]);
  242. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  243. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  244. INI_Int("Kills",PlayerInfo[playerid][pKills]);
  245. INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  246. return 1;
  247. }
  248.  
  249. stock UserPath(playerid)
  250. {
  251. new string[128],playername[MAX_PLAYER_NAME];
  252. GetPlayerName(playerid,playername,sizeof(playername));
  253. format(string,sizeof(string),PATH,playername);
  254. return string;
  255. }
  256.  
  257. stock udb_hash(buf[]) {
  258. new length=strlen(buf);
  259. new s1 = 1;
  260. new s2 = 0;
  261. new n;
  262. for (n=0; n<length; n++)
  263. {
  264. s1 = (s1 + buf[n]) % 65521;
  265. s2 = (s2 + s1) % 65521;
  266. }
  267. return (s2 << 16) + s1;
  268. }
  269.  
  270. public OnPlayerConnect(playerid)
  271. {
  272. if(fexist(UserPath(playerid)))
  273. {
  274. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  275. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password to login to acces your account","Login","Quit");
  276. }
  277. else
  278. {
  279. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Register",""COL_WHITE"{FFFFFF}You are {FF0000}not {FFFFFF}registered","Register","Quit");
  280. }
  281. return 1;
  282. }
  283.  
  284.  
  285.  
  286. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  287. {
  288. switch( dialogid )
  289. {
  290. case DIALOG_REGISTER:
  291. {
  292. if (!response) return Kick(playerid);
  293. if(response)
  294. {
  295. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Register",""COL_RED"{FFFFFF}Wrong password\n"COL_WHITE"Type your password to registert","Register","Quit");
  296. new INI:File = INI_Open(UserPath(playerid));
  297. INI_SetTag(File,"data");
  298. INI_WriteInt(File,"Password",udb_hash(inputtext));
  299. INI_WriteInt(File,"Cash",0);
  300. INI_WriteInt(File,"Admin",0);
  301. INI_WriteInt(File,"Kills",0);
  302. INI_WriteInt(File,"Deaths",0);
  303. INI_Close(File);
  304. SendClientMessage(playerid, 0xFFFFFF, "{FFFFFF}You Have {00FF00}Successfully {FFFFFF}Registered A Account!");
  305. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  306. }
  307. }
  308.  
  309.  
  310. case DIALOG_LOGIN:
  311. {
  312. if ( !response ) return Kick ( playerid );
  313. if( response )
  314. {
  315. if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  316. {
  317. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  318. GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  319. ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX, "Notice", "Thank you for logging!", "Ok", "");
  320. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  321. }
  322. else
  323. {
  324. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"{FFFFFF}You Typed A {FF0000}Incorrect {FFFFFF}Password\n"COL_WHITE"Type Your Password Below To Login","Login","Quit");
  325. }
  326. return 1;
  327. }
  328. }
  329. }
  330. return 1;
  331. }
  332.  
  333. public Wheel1(playerid)
  334. {
  335. new Wheel = random(6);
  336. switch(Wheel)
  337. {
  338. case 0: AddVehicleComponent(GetPlayerVehicleID(playerid), 1073);
  339. case 1: AddVehicleComponent(GetPlayerVehicleID(playerid), 1098);
  340. case 2: AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
  341. case 3: AddVehicleComponent(GetPlayerVehicleID(playerid), 1077);
  342. case 4: AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
  343. case 5: AddVehicleComponent(GetPlayerVehicleID(playerid), 1075);
  344. }
  345. }
  346.  
  347. public OnPlayerDisconnect(playerid,reason)
  348. {
  349. KillTimer(WTimer1);
  350. new INI:File = INI_Open(UserPath(playerid));
  351. INI_SetTag(File,"data");
  352. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  353. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  354. INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  355. INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  356. INI_Close(File);
  357. return 1;
  358. }
  359.  
  360.  
  361.  
  362. public OnPlayerDeath(playerid,killerid,reason)
  363. {
  364. if(IsBeingSpeced[playerid] == 1)
  365. {
  366. foreach(Player,i)
  367. {
  368. if(spectatorid[i] == playerid)
  369. {
  370. TogglePlayerSpectating(i,false);
  371. }
  372. }
  373. }
  374. return 1;
  375. }
  376.  
  377. public OnPlayerText(playerid,text[])
  378. {
  379.  
  380. if(muted[playerid] == 1)
  381. {
  382. SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B}You can not talk while your muted.");
  383. return 0;
  384. }
  385. return 1;
  386. }
  387.  
  388. CMD:slap(playerid,params[])
  389. {
  390. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  391.  
  392. new target,pName[MAX_PLAYER_NAME],Float:x,Float:y,Float:z,string[124];
  393. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /slap (playerid).");
  394. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  395. GetPlayerName(target,pName,sizeof(pName));
  396. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got slapped by an administrator.",pName);
  397. SendClientMessageToAll(-1,string);
  398. GetPlayerPos(target,x,y,z);
  399. SetPlayerPos(target,x,y,z+15);
  400. return 1;
  401. }
  402.  
  403. CMD:banip(playerid,params[])
  404. {
  405. if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  406. new ip[44],string[124];
  407. if(sscanf(params,"s[44]",ip)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /ban (playerid).");
  408. format(string,sizeof(string),"banip %s",ip);
  409. SendRconCommand(string);
  410. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got (IP)banned by an administrator.",ip);
  411. SendClientMessage(playerid,-1,string);
  412. PlayerPlaySound(playerid, 1009, 0.0, 0.0, 0.0);
  413. return 1;
  414. }
  415.  
  416. CMD:freeze(playerid,params[])
  417. {
  418. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  419. new target,string[124],pName[24];
  420. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /freeze (playerid).");
  421. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
  422. GetPlayerName(target,pName,24);
  423. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got frozen by an administrator.",pName);
  424. SendClientMessageToAll(-1,string);
  425. TogglePlayerControllable(target,0);
  426. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  427. return 1;
  428. }
  429.  
  430. CMD:unfreeze(playerid,params[])
  431. {
  432. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  433. new target,string[124],pName[24];
  434. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /unfreeze (playerid).");
  435. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected .");
  436. GetPlayerName(target,pName,24);
  437. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got unfrozen by an administrator.",pName);
  438. SendClientMessageToAll(-1,string);
  439. TogglePlayerControllable(target,1);
  440. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  441. return 1;
  442. }
  443.  
  444. CMD:goto(playerid,params[])
  445. {
  446. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  447. new target,Float:x,Float:y,Float:z;
  448. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /goto (playerid).");
  449. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected");
  450. GetPlayerPos(target,x,y,z);
  451. SetPlayerPos(playerid,x,y,z);
  452. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  453. return 1;
  454. }
  455.  
  456. CMD:get(playerid,params[])
  457. {
  458. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  459. new target,Float:x,Float:y,Float:z;
  460. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /get (playerid).");
  461. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  462. GetPlayerPos(playerid,x,y,z);
  463. SetPlayerPos(target,x,y,z);
  464. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  465. return 1;
  466. }
  467.  
  468. CMD:mute(playerid,params[])
  469. {
  470. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  471. new target,string[124],pName[24];
  472. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /mute (playerid).");
  473. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  474. GetPlayerName(target,pName,sizeof(pName));
  475. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got muted by an administrator.",pName);
  476. SendClientMessageToAll(-1,string);
  477. muted[target] = 1;
  478. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  479. return 1;
  480. }
  481.  
  482. CMD:unmute(playerid,params[])
  483. {
  484. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  485. new target,string[124],pName[24];
  486. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{FF0000}[Usage]: {FFFF00}/Unmute (PlayerID).");
  487. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  488. GetPlayerName(target,pName,sizeof(pName));
  489. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got unmuted by an administrator.",pName);
  490. SendClientMessageToAll(-1,string);
  491. muted[target] = 0;
  492. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  493. return 1;
  494. }
  495.  
  496. CMD:kick(playerid,params[])
  497. {
  498. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  499. new target,reason[66],string[124],pName[24];
  500. if(sscanf(params,"us[66]",target,reason)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B}/kick (PlayerID) (Reason).");
  501. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  502. GetPlayerName(target,pName,sizeof(pName));
  503. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got unmuted by an administrator.[ Reason: %s ]",pName,reason);
  504. SendClientMessageToAll(-1,string);
  505. Kick(target);
  506. PlayerPlaySound(playerid, 1009, 0.0, 0.0, 0.0);
  507. return 1;
  508. }
  509.  
  510. CMD:ban(playerid,params[])
  511. {
  512. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  513. new target,reason[66],string[124],pName[24];
  514. if(sscanf(params,"us[66]",target,reason)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} /Ban (PlayerID) (Reason)");
  515. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  516. GetPlayerName(target,pName,sizeof(pName));
  517. format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got banned by a administrator - [ Reason: %s ]",pName,reason);
  518. SendClientMessageToAll(-1,string);
  519. Ban(target);
  520. PlayerPlaySound(playerid, 1009, 0.0, 0.0, 0.0);
  521. return 1;
  522. }
  523.  
  524. CMD:ip(playerid,params[])
  525. {
  526. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  527. new target,pIP[34],pName[24],string[124];
  528. if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B}/IP (PlayerID)");
  529. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  530. GetPlayerName(target,pName,sizeof(pName));
  531. GetPlayerIp(target,pIP,34);
  532. format(string,sizeof(string),"{FFFF00}%s's IP is %s",pName,pIP);
  533. SendClientMessage(playerid,-1,string);
  534. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  535. return 1;
  536. }
  537.  
  538. CMD:setlevel(playerid,params[])
  539. {
  540. if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  541. new target,level,string[124],pName[24];
  542. if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"{FF0000}[Usage]: {FFFF00}/Setlevel (PlayerID) (Level)");
  543. if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
  544. if(level < 0 || level > 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:Invalid level. (1 - 3)");
  545. GetPlayerName(target,pName,sizeof(pName));
  546. SendClientMessageToAll(-1,string);
  547. PlayerInfo[target][pAdmin] = level;
  548. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  549. return 1;
  550. }
  551.  
  552. COMMAND:spec(playerid, params[])
  553. {
  554. new id;
  555. if(PlayerInfo[playerid][pAdmin] < 1) return 0;
  556. if(sscanf(params,"u", id))return SendClientMessage(playerid, Grey, "{F83934}[Usage]:{8B8B8B}/Spec (ID)");
  557. if(id == playerid)return SendClientMessage(playerid,Grey,"{F83934}[Error]:{8B8B8B} You Cannot Spectate Yourself");
  558. if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, Grey, "{F83934}[Error]:Player Not Found");
  559. if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,Grey,"{F83934}[Error]:You Are Already Spectating Somebody");
  560. GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
  561. Inter[playerid] = GetPlayerInterior(playerid);
  562. vWorld[playerid] = GetPlayerVirtualWorld(playerid);
  563. TogglePlayerSpectating(playerid, true);
  564. if(IsPlayerInAnyVehicle(id))
  565.  
  566. if(GetPlayerInterior(id) > 0)
  567. {
  568. SetPlayerInterior(playerid,GetPlayerInterior(id));
  569. }
  570. else if(GetPlayerVirtualWorld(id) > 0)
  571. {
  572. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
  573. }
  574. PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
  575.  
  576. {
  577. if(GetPlayerInterior(id) > 0)
  578. {
  579. SetPlayerInterior(playerid,GetPlayerInterior(id));
  580. }
  581. if(GetPlayerVirtualWorld(id) > 0)
  582. {
  583. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
  584. }
  585. PlayerSpectatePlayer(playerid,id);
  586. }
  587. GetPlayerName(id, Name, sizeof(Name));
  588. format(String, sizeof(String),"{F83934}[System]:{8B8B8B} You're now Spectating %s.",Name);
  589. SendClientMessage(playerid,0x0080C0FF,String);
  590. IsSpecing[playerid] = 1;
  591. IsBeingSpeced[id] = 1;
  592. spectatorid[playerid] = id;
  593. return 1;
  594. }
  595.  
  596. COMMAND:specoff(playerid, params[])
  597. {
  598. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  599. TogglePlayerSpectating(playerid, 0);
  600. return 1;
  601. }
  602.  
  603. public OnPlayerStateChange(playerid, newstate, oldstate)
  604. {
  605. if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  606. {
  607. if(IsBeingSpeced[playerid] == 1)
  608. {
  609. foreach(Player,i)
  610. {
  611. if(spectatorid[i] == playerid)
  612. {
  613. PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
  614. }
  615. }
  616. }
  617. }
  618. if(newstate == PLAYER_STATE_ONFOOT)
  619. {
  620. if(IsBeingSpeced[playerid] == 1)
  621. {
  622. foreach(Player,i)
  623. {
  624. if(spectatorid[i] == playerid)
  625. {
  626. PlayerSpectatePlayer(i, playerid);
  627. }
  628. }
  629. }
  630. }
  631. return 1;
  632. }
  633.  
  634. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  635. {
  636. if(IsBeingSpeced[playerid] == 1)
  637. {
  638. foreach(Player,i)
  639. {
  640. if(spectatorid[i] == playerid)
  641. {
  642. SetPlayerInterior(i,GetPlayerInterior(playerid));
  643. SetPlayerVirtualWorld(i,GetPlayerVirtualWorld(playerid));
  644. }
  645. }
  646. }
  647. return 1;
  648. }
  649.  
  650. public OnPlayerSpawn(playerid)
  651. {
  652.  
  653. SetPlayerHealth(playerid, 99999);
  654. SetTimerEx("SpawnProtection", 10000, false, "i", playerid);
  655. SendClientMessage(playerid, 0xFF0000FF, "{F83934}[System]:{8B8B8B} Anti-Spawn kill protection");
  656. SetTimerEx("SpawnProtection1", 3000, false, "i", playerid);
  657. TogglePlayerControllable(playerid, false);
  658. SetPlayerVirtualWorld(playerid, 0);
  659. SetPlayerInterior(playerid, 0);
  660. return 1;
  661.  
  662. }
  663.  
  664.  
  665.  
  666. CMD:report(playerid, params[])
  667. {
  668. new tmp[256], idx;
  669. tmp = strrest(params, idx);
  670. if(!strlen(tmp)){
  671. SendClientMessage(playerid, 0x555252AA, "{F83934}[Usage]:{8B8B8B}/Report [PlayerID] [Reason]");
  672. return 1;
  673. }else{
  674. new pid = strval(tmp);
  675. tmp = strrest(params, idx);
  676. if(!IsPlayerConnected(pid)){
  677. SendClientMessage(playerid, 0x555252AA, "{F83934}[Error]:{8B8B8B} Invalid ID!");
  678. return 1;
  679. }else{
  680. if(!strlen(tmp)){
  681. SendClientMessage(playerid, 0x555252AA, "{F83934}[Usage]:{8B8B8B}/Report [PlayerID] [Reason]");
  682. return 1;
  683. }else{
  684. new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[124];
  685. GetPlayerName(playerid, name, sizeof(name));
  686. GetPlayerName(pid, name2, sizeof(name2));
  687. format(string, sizeof(string), "{00FFFF}>> - %s(%d) Has Reported %s(%d) For '%s'", name, playerid, name2, pid, tmp);
  688. for(new i=0; i<GetMaxPlayers(); i++){
  689. if(IsPlayerConnected(i)){
  690. if(PlayerInfo[playerid][pAdmin] < 1) {
  691. SendClientMessage(i, 0x555252AA, string);
  692. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  693. }
  694. }
  695. }
  696. }
  697. }
  698. }
  699. return 1;
  700. }
  701.  
  702. strrest(const string[], &index)
  703. {
  704. new length = strlen(string);
  705. while ((index < length) && (string[index] <= ' '))
  706. {
  707. index++;
  708. }
  709.  
  710. new offset = index;
  711. new result[20];
  712. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  713. {
  714. result[index - offset] = string[index];
  715. index++;
  716. }
  717. result[index - offset] = EOS;
  718. return result;
  719. }
  720.  
  721. COMMAND:announce(playerid, params[])
  722. {
  723. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  724. new text[64], time, style;
  725. if(PlayerInfo[playerid][pAdmin] < 2) return 0;
  726. else if (sscanf(params, "iis[64]", style, time, text)) return SendClientMessage(playerid,Grey,"{F83934}[Usage]:{8B8B8B}/Announce (Style[0-6]) (Time) (Text)");
  727. else if (strlen(text) > 64) return SendClientMessage(playerid,Grey,"{F83934}[Error]:{8B8B8B} Message is too long.");
  728. else if (style == 2) return SendClientMessage(playerid,Grey,"{F83934}[Usage]:{8B8B8B} Bug with style No.2 don't use it!");
  729. else if (style < 0 || style > 6) return SendClientMessage(playerid,0x854900FF,"{F83934}[Error]:{8B8B8B}");
  730. else if (time > 20*1000) return SendClientMessage(playerid, Grey,"{F83934}[Error]:{8B8B8B} Message can not be longer then 20 seconds!");
  731. else {
  732. GameTextForAll(text, time, style);
  733. }
  734. return 1;
  735. }
  736.  
  737. CMD:acmds(playerid, params[])
  738. {
  739. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  740. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  741. SendClientMessage(playerid, 0x0077BB00 , "{00FF00}(Level 1 | Moderator) ");
  742. SendClientMessage(playerid, 0x0077BB00 , "»»{FFFF00}/slap, /freeze, /unfreeze, /goto, /get, /mute, /unmute, /ip, /spec, /specoff««");
  743. SendClientMessage(playerid, 0x0077BB00 , "{00FF00}(Level 2 | Administrator) ");
  744. SendClientMessage(playerid, 0x0077BB00 , "»»{FFFF00}/kick, /ban, /announce, /explode, /setskin, /setweather, /clearchat««");
  745. SendClientMessage(playerid, 0x0077BB00 , "{00FF00}(Level 3 | Owners) ");
  746. SendClientMessage(playerid, 0x0077BB00 , "»»{FFFF00}/banip, /setlevel, /restart, /gmx««");
  747. return 1;
  748. }
  749.  
  750. CMD:explode(playerid, params[]){
  751. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  752. new amount;
  753. new Float:boomx, Float:boomy, Float:boomz;
  754. if(sscanf(params, "i", amount)) return SendClientMessage(playerid,Grey,"{F83934}[Usage]:{8B8B8B} /Explode [PlayerID]");
  755. GetPlayerPos(playerid,boomx, boomy, boomz);
  756. CreateExplosion(boomx, boomy , boomz, amount, 10);
  757. return 1;
  758. }
  759.  
  760.  
  761.  
  762. COMMAND:admins(playerid,params[])
  763. {
  764. if(IsPlayerConnected(playerid))
  765. {
  766. SendClientMessage(playerid, COLOR_RED, " ");
  767. SendClientMessage(playerid, 0xFF0080C8, "[============Online Administrators============] ");
  768. for(new i = 0; i < MAX_PLAYERS; i++)
  769. {
  770. if(IsPlayerConnected(i))
  771. {
  772. if(PlayerInfo[i][pAdmin] > 1)
  773. {
  774. new admtext[64];
  775. new sendername[MAX_PLAYER_NAME];
  776. new string[256];
  777. if(PlayerInfo[i][pAdmin] == 1) { admtext = "{80FF00}Level 1 Moderator"; }
  778. else if(PlayerInfo[i][pAdmin] == 2) { admtext = "{80FF00}Level 2 Administrator"; }
  779. else if(PlayerInfo[i][pAdmin] == 3) { admtext = "{80FF00}Level 3 Master Administrator"; }
  780. GetPlayerName(i, sendername, sizeof(sendername));
  781. format(string, 256, "{FF00FF}%s {80FF00}( %s )", sendername, admtext);
  782. SendClientMessage(playerid, 0xFFFF00C8, string);
  783. SendClientMessage(playerid, 0xFF0080C8, "[============Online Administrators============]");
  784. }
  785. }
  786. }
  787. }
  788. return 1;
  789. }
  790.  
  791. CMD:setskin(playerid, params[])
  792. {
  793.  
  794. new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
  795. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  796. if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, -1, "{F83934}[Usage]:{8B8B8B}/Setskin (PlayerID) (SkinID)");
  797. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  798. GetPlayerName(id, targetname, MAX_PLAYER_NAME);
  799. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{F83934}[Error]:{8B8B8B} Player Not Connected!");
  800. SetPlayerSkin(id, skinid);
  801. format(string, 128, "{F83934}[System]:{8B8B8B} Administrator %s(%d) has changed your skin To %i", name, playerid, skinid);
  802. SendClientMessage(id, 0xFFFF00C8, string);
  803. format(string, 128, "{F83934}[System]:{8B8B8B} You have successfully set his skin to %i", targetname, id, skinid);
  804. SendClientMessage(playerid, -1, string);
  805. return 1;
  806. }
  807.  
  808. CMD:setweather(playerid,params[])
  809. {
  810. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  811. new string[128];
  812. new sendername[MAX_PLAYER_NAME];
  813. new weather;
  814. if(sscanf(params, "d", weather))
  815. return SendClientMessage(playerid, Grey, "{F83934}[Usage]:{8B8B8B}/Setweather (WeatherID)");
  816. if(PlayerInfo[playerid][pAdmin] < 2)
  817. return SendClientMessage(playerid, Grey, "{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  818. {
  819. SetWeather(weather);
  820. SendClientMessage(playerid, Grey, "[LOST:RP] The weather has been changed");
  821. GetPlayerName(playerid, sendername, sizeof(sendername));
  822. format(string, 256, "{F83934}[System]:{8B8B8B} Administrator %s changed the weather to weather ID(%d)", sendername,weather);
  823. SendClientMessage(playerid, -1, string);
  824. }
  825. return 1;
  826. }
  827.  
  828. CMD:clearchat(playerid, params[])
  829. {
  830. if(PlayerInfo[playerid][pAdmin] < 2)
  831. {
  832. ClearChatboxAll(playerid);
  833. }
  834. else
  835. {
  836. SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  837. return 1;
  838. }
  839. return 1;
  840. }
  841.  
  842. ClearChatboxAll(playerid)
  843. {
  844. for(new i = 0; i < 50; i++)
  845. {
  846. SendClientMessage(playerid, 0xFFFFFFC8, "");
  847. }
  848. return 1;
  849. }
  850.  
  851. CMD:restart(playerid, params[])
  852. {
  853. if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
  854. foreach(Player,i)
  855. {
  856. KillTimer(WTimer1);
  857. new INI:File = INI_Open(UserPath(playerid));
  858. INI_SetTag(File,"data");
  859. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  860. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  861. INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  862. INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  863. INI_Close(File);
  864. return 1;
  865. }
  866. return 1;
  867. }
Advertisement
Add Comment
Please, Sign In to add comment