Advertisement
Guest User

twtwtwt

a guest
Mar 1st, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.26 KB | None | 0 0
  1. //Credits to Y_Less, Dracoblue and Kush.
  2.  
  3. #include <a_samp>
  4. #include <YSI\y_ini>
  5. #include <zcmd>
  6. #include <sscanf2>
  7.  
  8.  
  9. #define COLOR_GREY 0xAFAFAFAA
  10. #define COLOR_GREEN 0x33AA33AA
  11. #define COLOR_BRIGHTRED 0xFF0000AA
  12. #define COLOR_YELLOW 0xFFFF00AA
  13. #define COLOR_PINK 0xFF66FFAA
  14. #define COLOR_BLUE 0x3A47DEFF
  15. #define COLOR_TAN 0xBDB76BAA
  16. #define COLOR_PURPLE 0x800080AA
  17. #define COLOR_WHITE 0xFFFFFFAA
  18. #define COLOR_LIGHTBLUE 0x33CCFFAA
  19. #define COLOR_ORANGE 0xFF9900AA
  20. #define COLOR_INDIGO 0x4B00B0AA
  21. #define COLOR_BLACK 0x00000000
  22. #define COLOR_DARKGREY 0x696969FF
  23.  
  24. #define DIALOG_REGISTER 1
  25. #define DIALOG_LOGIN 2
  26. #define DIALOG_SUCCESS_1 3
  27. #define DIALOG_SUCCESS_2 4
  28.  
  29. #define PATH "/Users/%s.ini"
  30.  
  31. #define COL_WHITE "{FFFFFF}"
  32. #define COL_RED "{F81414}"
  33. #define COL_GREEN "{00FF22}"
  34. #define COL_LIGHTBLUE "{00CED1}"
  35.  
  36. enum pInfo
  37. {
  38. pPass,
  39. pCash,
  40. pAdmin,
  41. pKills,
  42. pBanned,
  43. pScore,
  44. pDeaths
  45. }
  46. new PlayerInfo[MAX_PLAYERS][pInfo];
  47. new IsSpectating[MAX_PLAYERS];
  48. new PlayerText:ConnectTD[12];
  49.  
  50.  
  51. forward SendAdminMessage(msg[]);
  52. forward LoadUser_data(playerid,name[],value[]);
  53. public LoadUser_data(playerid,name[],value[])
  54. {
  55. INI_Int("Password",PlayerInfo[playerid][pPass]);
  56. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  57. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  58. INI_Int("Kills",PlayerInfo[playerid][pKills]);
  59. INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  60. INI_Int("Score",PlayerInfo[playerid][pScore]);
  61. return 1;
  62. }
  63.  
  64.  
  65.  
  66. stock UserPath(playerid)
  67. {
  68. new string[128],playername[MAX_PLAYER_NAME];
  69. GetPlayerName(playerid,playername,sizeof(playername));
  70. format(string,sizeof(string),PATH,playername);
  71. return string;
  72. }
  73.  
  74. /*Credits to Dracoblue*/
  75. stock udb_hash(buf[]) {
  76. new length=strlen(buf);
  77. new s1 = 1;
  78. new s2 = 0;
  79. new n;
  80. for (n=0; n<length; n++)
  81. {
  82. s1 = (s1 + buf[n]) % 65521;
  83. s2 = (s2 + s1) % 65521;
  84. }
  85. return (s2 << 16) + s1;
  86. }
  87.  
  88. main()
  89. {
  90. print("\n----------------------------------");
  91. print(" Blank Gamemode by your name here");
  92. print("----------------------------------\n");
  93. }
  94.  
  95. public OnGameModeInit()
  96. {
  97. TextDrawCreate(240.0,580.0,"Welcome to Critical TDM");
  98. // Disables the yellow arrows
  99. DisableInteriorEnterExits();
  100. // Gamemode
  101. SetGameModeText("Critical DM V.0.1");
  102. return 1;
  103. }
  104.  
  105. public OnGameModeExit()
  106. {
  107. return 1;
  108. }
  109.  
  110. public OnPlayerRequestClass(playerid, classid)
  111. {
  112. return 1;
  113. }
  114.  
  115. public OnPlayerConnect(playerid)
  116. {
  117. if(fexist(UserPath(playerid)))
  118. {
  119. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  120. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
  121. }
  122. else
  123. {
  124. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
  125. }
  126.  
  127. return 1;
  128. }
  129.  
  130. public OnPlayerDisconnect(playerid, reason)
  131. {
  132. new INI:File = INI_Open(UserPath(playerid));
  133. INI_SetTag(File,"data");
  134. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  135. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  136. INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  137. INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  138. INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
  139. INI_Close(File);
  140. return 1;
  141. }
  142.  
  143. public OnPlayerSpawn(playerid)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnPlayerDeath(playerid, killerid, reason) //This code gets called when somebody dies.
  149. {
  150. PlayerInfo[killerid][pKills] ++; //incraseing killerid kils for one more
  151. PlayerInfo[playerid][pDeaths] ++; //increase player deaths for one more
  152. PlayerInfo[playerid][pScore] ++;
  153. if(IsPlayerConnected(killerid)) //Checks if there really is a "killer" - more ways of death are for example falling from great heights, so there isn't a killer there!
  154. {
  155. SetPlayerScore(killerid,GetPlayerScore(playerid)+5);
  156. GivePlayerMoney(killerid, 500); //Give the player 500 dollars
  157. SendClientMessage(killerid, COLOR_LIGHTBLUE, "*You have won $500 and 5 scores from killing someone*"); // Send message to killer
  158. }
  159. return 1;
  160. }
  161.  
  162. public OnVehicleSpawn(vehicleid)
  163. {
  164. return 1;
  165. }
  166.  
  167. public OnVehicleDeath(vehicleid, killerid)
  168. {
  169. return 1;
  170. }
  171.  
  172. public OnPlayerText(playerid, text[])
  173. {
  174. return 1;
  175. }
  176.  
  177. public OnPlayerCommandText(playerid, cmdtext[])
  178. {
  179. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  180. {
  181. // Do something here
  182. return 1;
  183. }
  184. return 0;
  185. }
  186.  
  187. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  188. {
  189. SendClientMessage(playerid, 0xFFFF00AA, "You have entered a vehicle");
  190. return 1;
  191. }
  192.  
  193. public OnPlayerExitVehicle(playerid, vehicleid)
  194. {
  195. SendClientMessage(playerid, 0xFFFF00AA, "You have exited a vehicle");
  196. return 1;
  197. }
  198.  
  199. public OnPlayerStateChange(playerid, newstate, oldstate)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnPlayerEnterCheckpoint(playerid)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerLeaveCheckpoint(playerid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnPlayerEnterRaceCheckpoint(playerid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnPlayerLeaveRaceCheckpoint(playerid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnRconCommand(cmd[])
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnPlayerRequestSpawn(playerid)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnObjectMoved(objectid)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnPlayerObjectMoved(playerid, objectid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnPlayerPickUpPickup(playerid, pickupid)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnVehicleMod(playerid, vehicleid, componentid)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnPlayerSelectedMenuRow(playerid, row)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnPlayerExitedMenu(playerid)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  280. {
  281. return 1;
  282. }
  283.  
  284. public OnRconLoginAttempt(ip[], password[], success)
  285. {
  286. return 1;
  287. }
  288.  
  289. public OnPlayerUpdate(playerid)
  290. {
  291. return 1;
  292. }
  293.  
  294. public OnPlayerStreamIn(playerid, forplayerid)
  295. {
  296. return 1;
  297. }
  298.  
  299. public OnPlayerStreamOut(playerid, forplayerid)
  300. {
  301. return 1;
  302. }
  303.  
  304. public OnVehicleStreamIn(vehicleid, forplayerid)
  305. {
  306. return 1;
  307. }
  308.  
  309. public OnVehicleStreamOut(vehicleid, forplayerid)
  310. {
  311. return 1;
  312. }
  313.  
  314. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  315. {
  316. switch( dialogid )
  317. {
  318. case DIALOG_REGISTER:
  319. {
  320. if (!response) return Kick(playerid);
  321. if(response)
  322. {
  323. 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");
  324. new INI:File = INI_Open(UserPath(playerid));
  325. INI_SetTag(File,"data");
  326. INI_WriteInt(File,"Password",udb_hash(inputtext));
  327. INI_WriteInt(File,"Cash",0);
  328. INI_WriteInt(File,"Admin",0);
  329. INI_WriteInt(File,"Kills",0);
  330. INI_WriteInt(File,"Deaths",0);
  331. INI_WriteInt(File,"Score",0);
  332. INI_Close(File);
  333.  
  334. ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! now you have succesfully registered","Ok","");
  335. }
  336. }
  337.  
  338. case DIALOG_LOGIN:
  339. {
  340. if ( !response ) return Kick ( playerid );
  341. if( response )
  342. {
  343. if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  344. {
  345. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  346. GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  347. SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
  348. ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
  349. }
  350. else
  351. {
  352. 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");
  353. }
  354. return 1;
  355. }
  356. }
  357. }
  358. return 1;
  359. }
  360.  
  361. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  362. {
  363. return 1;
  364. }
  365.  
  366. CMD:kick(playerid, params[])
  367. {
  368. new id, reason[128];
  369. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  370. else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /kick [id/name][reason]");
  371. else if(id==playerid)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick yourself!");
  372. else if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick another admin!");
  373. else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: Player is not connected!");
  374. else {
  375. new Name[MAX_PLAYER_NAME], KickMessage[128];
  376. new Name2[MAX_PLAYER_NAME];
  377. GetPlayerName(playerid, Name, sizeof(Name));
  378. GetPlayerName(id, Name2, sizeof(Name2));
  379. format(KickMessage, sizeof(KickMessage), "Administrator %s(%d) has kicked player %s(%d)| Reason: %s", Name, playerid, Name2, id);
  380. SendClientMessageToAll(COLOR_LIGHTBLUE, KickMessage);
  381. Kick(id);
  382. }
  383. return 1;
  384. }
  385.  
  386. CMD:warn(playerid, params[])
  387. {
  388. new id, reason[128];
  389. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  390. else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_LIGHTBLUE,"Usage: /warn [id/name] [reason]");
  391. else if(id==playerid)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not warn yourself!");
  392. else if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not warn another admin!");
  393. else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: Player is not connected!");
  394. else
  395. {
  396. new Name[MAX_PLAYER_NAME], WarnMessage[128];
  397. new Name2[MAX_PLAYER_NAME];
  398. GetPlayerName(playerid, Name, sizeof(Name));
  399. GetPlayerName(id, Name2, sizeof(Name2));
  400. format(WarnMessage, sizeof(WarnMessage), "Administrator %s(%d) has warned %s(%d) | Reason: %s", Name, playerid, Name2, id);
  401. SendClientMessageToAll(COLOR_LIGHTBLUE, WarnMessage);
  402. }
  403. return 1;
  404. }
  405.  
  406. CMD:ban(playerid,params[])
  407. {
  408. if(IsPlayerAdmin(playerid))
  409. {
  410. new id;
  411. new tmp[256], tmp2[256], Index;
  412. tmp = strtok(params,Index), tmp2 = strtok(params,Index);
  413. if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /ban [id/name] [reason]"); //Check If Player Does Not Added "Reason and the ID"
  414. if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick another admin!");
  415. if(id==playerid)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick yourself!");
  416. new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
  417. player1 = strval(tmp); // << player1 = ID of The Player
  418. if(!IsPlayerConnected(player1)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: Player is not connected!"); //<< Check If Player Connected Or Not
  419. GetPlayerName(player1, playername, sizeof(playername)); //get Selected Player Name
  420. GetPlayerName(playerid, adminname, sizeof(adminname)); //get Admin Name Who Use This command
  421. format(string,sizeof(string),"Administrator %s has banned %s | Reason ( %s )",adminname,playername,params[2]); //adminname = the player Who Use This command || playername = the Player who Going To Be kicked || params[2] = The Reason Of The Kick
  422. SendClientMessageToAll(COLOR_LIGHTBLUE,string); // Send Message To all Players.
  423. Ban(player1);
  424. }
  425. else return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You're not authorized to use this command!"); // This Code return the Player IF he's not Login in as RCON admin
  426. return 1;
  427. }
  428.  
  429.  
  430.  
  431. CMD:rangeban(playerid, params[]) {
  432. new id;
  433. new reason[50];
  434. if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  435. if(sscanf(params, "us[50]", id,reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[USAGE] - /rangeban [ID] [REASON]");
  436. if(PlayerInfo[id][pAdmin] == 7) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "* One does not simply range-ban the server owner!");
  437.  
  438. new string[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME];
  439. GetPlayerName(playerid, sender, sizeof(sender));
  440. GetPlayerName(id, receiver, sizeof(receiver));
  441. //new rbandate[3];
  442. //getdate(rbandate[0], rbandate[1], rbandate[2]);
  443. format(string, sizeof(string), "[BAN] - %s(%d) has been banned by %s(%d)", receiver, id, sender, playerid);
  444. SendClientMessageToAll(COLOR_LIGHTBLUE, string); //Sends the kick message, as seen above ^.
  445.  
  446. format(string, sizeof(string), "[BAN] - Reason: %s", reason);
  447. SendClientMessageToAll(COLOR_LIGHTBLUE, string); //Sends the kick reasons message, as seen above ^
  448.  
  449. SetTimerEx("KickTimer", 500, false, "i", id); //Sets KickTimer to 1 seond(will be kicked after 1 second)
  450. PlayerInfo[id][pBanned] = 1;
  451.  
  452. SendClientMessage(id, COLOR_LIGHTBLUE, "[BAN] - You've been BANNED"); //Sends Target a message, saying that he was kicked.
  453. SendClientMessage(id, COLOR_LIGHTBLUE, "[BAN] - For more info read the chat.");
  454.  
  455. //{FFFFFF}%s\n\n{FF002B}Reason: {FFFFFF}%s\n\n{FF002B}Date: {FFFFFF}%02d/%02d/%04d\n\n{FFFFFF}Press F8 to take a screenshot and use this in unban appeal!", pname, playerid,Reason, rbandate[2], rbandate[1], rbandate[0]);
  456. new ip[50];
  457. GetPlayerIp(id,ip,sizeof(ip));
  458. strdel(ip,strlen(ip)-4,strlen(ip));
  459. format(ip,sizeof(ip),"%s**.**",ip);
  460. format(ip,sizeof(ip),"banip %s",ip);
  461. SendRconCommand(ip);
  462.  
  463. printf("ADMIN %s has RANGE BANNED %s FOR: %s", sender, receiver, reason);
  464.  
  465. new INI:File = INI_Open(UserPath(id));
  466. INI_SetTag(File,"ban info");
  467. INI_WriteString(File,"RANGE-Banned By", sender);
  468. INI_WriteString(File,"Reason", reason);
  469. INI_Close(File);
  470. return 1;
  471. }
  472.  
  473. CMD:announce(playerid, params[])
  474. {
  475. new string[128];
  476. if(PlayerInfo[playerid][pAdmin] < 1) SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  477. if(!strlen(params))
  478. {
  479. SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /announce [message]");
  480. return 1;
  481. }
  482. format(string, sizeof(string), "%s", params);
  483. GameTextForAll(string, 5000, 0);
  484. return 1;
  485. }
  486.  
  487.  
  488.  
  489. CMD:spec(playerid, params[])
  490. {
  491. new ID;
  492. new pname[128];
  493. GetPlayerName(ID, pname, sizeof(pname));
  494. if(PlayerInfo[playerid][pAdmin] < 1) SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  495. if(sscanf(params, "i", ID))
  496. {
  497. SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /spec (playerid)");
  498. return 1;
  499. }
  500. if(!IsPlayerConnected(ID))
  501. {
  502. SendClientMessage(playerid, COLOR_LIGHTBLUE, "Invalid player ID");
  503. return 1;
  504. }
  505. TogglePlayerSpectating(playerid, 1);
  506. PlayerSpectatePlayer(playerid, ID);
  507. SetPlayerInterior(playerid, ID);
  508. SetPlayerInterior(playerid, GetPlayerInterior(ID));
  509. IsSpectating[playerid] =1;
  510. return 1;
  511. }
  512.  
  513.  
  514. CMD:specoff(playerid, params[])
  515. {
  516. #pragma unused params
  517. if(IsSpectating[playerid] == 1)
  518. {
  519. TogglePlayerSpectating(playerid, 0);
  520. IsSpectating[playerid] =0;
  521. return 1;
  522. }
  523. return 1;
  524. }
  525.  
  526. CMD:asay(playerid, params[])
  527. {
  528. new string[128];
  529. new pname[128];
  530. GetPlayerName(playerid, pname, sizeof(pname));
  531. if(PlayerInfo[playerid][pAdmin] < 1) SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  532. if(!strlen(params))
  533. {
  534. SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /asay (message)");
  535. return 1;
  536. }
  537. format(string, sizeof(string), "[ADMIN CHAT] %s(%d): %s", pname, playerid, params);
  538. SendAdminMessage(string);
  539. return 1;
  540.  
  541. }
  542.  
  543. CMD:goto(playerid, params[])
  544. {
  545. new string[128];
  546. new ID;
  547. new pname[128];
  548. GetPlayerName(ID, pname, sizeof(pname));
  549. if(PlayerInfo[playerid][pAdmin] < 1) SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  550. if(sscanf(params, "i", ID))
  551. {
  552. SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /goto (playerid)");
  553. return 1;
  554. }
  555. if(!IsPlayerConnected(ID))
  556. {
  557. SendClientMessage(playerid, COLOR_LIGHTBLUE, "That player ID is not connected.");
  558. return 1;
  559. }
  560. new Float:x, Float:y, Float:z;
  561. GetPlayerPos(ID, x, y, z);
  562. SetPlayerPos(playerid, x, y, z);
  563. SetPlayerPos(playerid,x+1,y,z);
  564. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ID));
  565. SetPlayerInterior(playerid,GetPlayerInterior(ID));
  566. format(string, sizeof(string), "You have teleported to %s(%d)", pname, ID);
  567. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  568. return 1;
  569. }
  570.  
  571. CMD:bring(playerid, params[])
  572. {
  573. new string[128];
  574. new ID;
  575. new pname[128];
  576. GetPlayerName(ID, pname, sizeof(pname));
  577. if(PlayerInfo[playerid][pAdmin] < 1) SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  578. if(sscanf(params, "i", ID))
  579. {
  580. SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /bring (playerid)");
  581. return 1;
  582. }
  583. if(!IsPlayerConnected(ID))
  584. {
  585. SendClientMessage(playerid, COLOR_LIGHTBLUE, "Invalid player ID");
  586. return 1;
  587. }
  588. new Float:x, Float:y, Float:z;
  589. GetPlayerPos(playerid, x, y, z);
  590.  
  591. SetPlayerPos(ID, x+1, y, z);
  592. SetPlayerVirtualWorld(ID, GetPlayerVirtualWorld(playerid));
  593. SetPlayerInterior(ID, GetPlayerInterior(playerid));
  594. format(string, sizeof(string), "You have brought %s(%d) to you.", pname, ID);
  595. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  596. return 1;
  597. }
  598.  
  599. CMD:setscore(playerid, params[])
  600. {
  601. new id, score;
  602. if(sscanf(params, "ud", id, score) ) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /setscore [id] [score]");
  603. if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  604. SendClientMessage(playerid, COLOR_LIGHTBLUE, "You set the score");
  605. SetPlayerScore(id, score);
  606. return 1;
  607. }
  608.  
  609.  
  610.  
  611. CMD:setmoney(playerid, params[])
  612. {
  613. new id, cash;
  614. if(sscanf(params, "ud", id, cash) ) return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "Usage: /setcash [id] [cash]");
  615. if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  616. SendClientMessage(playerid, COLOR_LIGHTBLUE, "You set the cash");
  617. GivePlayerMoney(id, cash);
  618. return 1;
  619. }
  620.  
  621.  
  622. CMD:acmds(playerid,params[])
  623. {
  624. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
  625. SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Critical DM admin commands list!");
  626. SendClientMessage(playerid,COLOR_LIGHTBLUE,"[STATISTICS] /ban /rangeban /setscore /setmoney");
  627. SendClientMessage(playerid,COLOR_LIGHTBLUE,"[PLAYER] /warn /kick /spec /specoff /goto /bring");
  628. SendClientMessage(playerid,COLOR_LIGHTBLUE,"[PUBLIC] /announce /asay");
  629. return 1;
  630. }
  631.  
  632. CMD:kill(playerid, params[])
  633. {
  634. SetPlayerHealth(playerid, 0);
  635. SendClientMessage(playerid, 0xFFFFFFAA, "You have successfully killed yourself");
  636. return 1;
  637. }
  638.  
  639.  
  640. strtok(const string[], &index)
  641. {
  642. new length = strlen(string);
  643. while ((index < length) && (string[index] <= ' '))
  644. {
  645. index++;
  646. }
  647.  
  648. new offset = index;
  649. new result[20];
  650. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  651. {
  652. result[index - offset] = string[index];
  653. index++;
  654. }
  655. result[index - offset] = EOS;
  656. return result;
  657. }
  658.  
  659. public SendAdminMessage(msg[])
  660. {
  661. for(new i=0; i<MAX_PLAYERS; i++)
  662. {
  663. if(IsPlayerConnected(i))
  664. {
  665. if(IsPlayerAdmin(i))
  666. {
  667. SendClientMessage(i, COLOR_LIGHTBLUE, msg);
  668. }
  669. }
  670. }
  671. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement