Guest User

Help me...

a guest
Apr 9th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 26.28 KB | None | 0 0
  1. /*---------------------------------INCLUDES-----------------------------------*/
  2. #include <a_samp>
  3. #include <sscanf2>
  4. #include <dini>
  5. #include <dutils>
  6. #include <zcmd>
  7. /*---------------------------------PRAGMAS------------------------------------*/
  8. #pragma unused ret_memcpy
  9.  
  10. /*---------------------------------DEFINES------------------------------------*/
  11. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  12.  
  13. #define COLOR_RED         0xFF0000C8
  14. #define COLOR_YELLOW      0xDFF709C8
  15. #define COLOR_GREEN       0x09F709C8
  16. #define COLOR_LIGHTBLUE   0x44BBBBC8
  17. #define COLOR_BLUE        0x0000FFC8
  18. #define COLOR_PINK        0xBB4497C8
  19. #define COLOR_PURPLE      0xAF09F7C8
  20. #define COLOR_YELLOWGREEN 0x80EA15C8
  21. #define COLOR_GREY        0x847B7BC8
  22. #define COLOR_WHITE       0xFFFFFFC8
  23. #define COLOR_ORANGE      0xFF8000C8
  24. #define COLOR_BLACK       0x000000C8
  25.  
  26. #define REGISTER_DIALOG    0
  27. #define LOGIN_DIALOG       1
  28.  
  29. #define PlayerFile "Admin/Users/%s.ini"
  30. #define CommandFile "Admin/Settings/Commands.ini"
  31. /*----------------------------------------------------------------------------*/
  32.  
  33. main()
  34. {
  35.     print("\n----------------------------------");
  36.     print(" TeamDeathMatch by [TDM]the_boss    ");
  37.     print("----------------------------------\n");
  38. }
  39.  
  40. /*----------------------------------------------------------------------------*/
  41.  
  42. new String[128], Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS], vWorld[MAX_PLAYERS], Inter[MAX_PLAYERS];
  43. new IsSpecing[MAX_PLAYERS], Name[MAX_PLAYER_NAME], IsBeingSpeced[MAX_PLAYERS],spectatorid[MAX_PLAYERS];
  44.  
  45. forward ReportLog(string[]);
  46.  
  47. enum PLAYER_MAIN
  48. {
  49.      PLAYER_NAME[MAX_PLAYER_NAME],
  50.      PLAYER_IP[16],
  51.      PLAYER_REGGED,
  52.      PLAYER_PASS,
  53.      PLAYER_LEVEL,
  54.      PLAYER_MONEY,
  55.      PLAYER_SCORE,
  56. }
  57. new gPlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
  58. new gPlayerLogged[MAX_PLAYERS];
  59.  
  60. enum COMMANDS_MAIN
  61. {
  62.      KICK,
  63.      BAN
  64. }
  65. new gCommands[COMMANDS_MAIN];
  66.  
  67. public OnFilterScriptInit()
  68. {
  69.      // Level 0 = Normal Player
  70.      // Level 1 = Trail Moderator
  71.      // Level 2 = Moderator
  72.      // Level 3 = Administrator
  73.      // Level 4 = Head Administrator
  74.      // Level 5 = Server owner
  75.  
  76. if(!fexist(CommandFile))
  77. {
  78. dini_Create(CommandFile);
  79. dini_IntSet(CommandFile, "Kick", 2);
  80. dini_IntSet(CommandFile, "Ban", 3);
  81. }
  82.  
  83. gCommands[KICK] = dini_Int(CommandFile, "Kick");
  84. gCommands[BAN] = dini_Int(CommandFile, "Ban");
  85. return 1;
  86. }
  87.  
  88. public ReportLog(string[])
  89. {
  90.     new entry[128];
  91.     format(entry, sizeof(entry), "%s\n",string);
  92.     new File:hFile;
  93.     hFile = fopen("Admin/Reports/Reports.log", io_append);
  94.     fwrite(hFile, entry);
  95.     fclose(hFile);
  96. }
  97.  
  98. forward BanLog(string[]);
  99.  
  100. public BanLog(string[])
  101. {
  102.     new entry[129];
  103.     format(entry, sizeof(entry), "%s\n",string);
  104.     new File:hFile;
  105.     hFile = fopen("Admin/Bans/Bans.log", io_append);
  106.     fwrite(hFile, entry);
  107.     fclose(hFile);
  108.     return 1;
  109. }
  110.  
  111. forward KickLog(string[]);
  112.  
  113. public KickLog(string[])
  114. {
  115.     new entry[130];
  116.     format(entry, sizeof(entry), "%s\n",string);
  117.     new File:hFile;
  118.     hFile = fopen("Admin/Kicks/Kicks.log", io_append);
  119.     fwrite(hFile, entry);
  120.     fclose(hFile);
  121.     return 1;
  122. }
  123.  
  124. stock GetName(playerid)
  125. {
  126. new
  127. name[24];
  128. GetPlayerName(playerid, name, sizeof(name));
  129. return name;
  130. }
  131.  
  132. stock PlayerName(playerid)
  133. {
  134. new pname[24];
  135. GetPlayerName(playerid, pname, 24);
  136. return pname;
  137. }
  138.  
  139. stock PlayerIp(playerid)
  140. {
  141. new pip[24];
  142. GetPlayerIp(playerid, pip, 24);
  143. return pip;
  144. }
  145.  
  146. public OnGameModeInit()
  147. {
  148.     SetGameModeText("*TeamDeathMatch*");
  149.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  150.     return 1;
  151. }
  152.  
  153. public OnGameModeExit()
  154. {
  155.     return 1;
  156. }
  157.  
  158. public OnPlayerRequestClass(playerid, classid)
  159. {
  160.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  161.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  162.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  163.     return 1;
  164. }
  165.  
  166. public OnPlayerConnect(playerid)
  167. {
  168. new pname[24];
  169. GetPlayerName(playerid, pname,24);
  170. new string[128];
  171. format(string,128,"*[JOIN]: %s has joined Team_Death_Match server.*",pname);
  172. SendClientMessageToAll(COLOR_GREEN ,string);
  173. new file[100], name[MAX_PLAYER_NAME];
  174. GetPlayerName(playerid, name, sizeof(name));
  175. format(file, sizeof(file), PlayerFile, name);
  176. if(!fexist(file))
  177. {
  178. ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_INPUT, "Register", "Welcome! This account is not registered.\nEnter your new password below to create a new account.", "Register", "Exit");
  179. }
  180. else if(fexist(file))
  181. {
  182. ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Login", "Welcome back! This account is registered. \nInsert your password below to login.", "Login", "Exit");
  183. }
  184. return 1;
  185. }
  186.  
  187. public OnPlayerDisconnect(playerid, reason)
  188. {
  189.        new file[100],name[24]; GetPlayerName(playerid, name, 24);
  190.        format(file, sizeof(file), PlayerFile, name);
  191.        dini_Set(file, "Name", PlayerName(playerid));
  192.        dini_Set(file, "Ip", PlayerIp(playerid));
  193.        dini_IntSet(file, "Registered", gPlayerInfo[playerid][PLAYER_REGGED]);
  194.        dini_IntSet(file, "Password", gPlayerInfo[playerid][PLAYER_PASS]);
  195.        dini_IntSet(file, "Level", gPlayerInfo[playerid][PLAYER_LEVEL]);
  196.        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
  197.        dini_IntSet(file, "Score", GetPlayerScore(playerid));
  198.        gPlayerLogged[playerid] = 0;
  199.        return 1;
  200. }
  201.  
  202.  
  203. public OnPlayerSpawn(playerid)
  204. {
  205.     if(GetPlayerScore(playerid) >= 10)
  206.     {
  207.         new Text3D:label = Create3DTextLabel("Newbie",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  208.         Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.4);
  209.     }
  210.     else if(GetPlayerScore(playerid) >= 50)
  211.     {
  212.         new Text3D:label1 = Create3DTextLabel("Private",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  213.         Attach3DTextLabelToPlayer(label1, playerid, 0.0, 0.0, 0.4);
  214.     }
  215.     else if(GetPlayerScore(playerid) >= 100)
  216.     {
  217.         new Text3D:label2 = Create3DTextLabel("Soldier",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  218.         Attach3DTextLabelToPlayer(label2, playerid, 0.0, 0.0, 0.4);
  219.     }
  220.     else if(GetPlayerScore(playerid) >= 300)
  221.     {
  222.         new Text3D:label3 = Create3DTextLabel("Capitan",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  223.         Attach3DTextLabelToPlayer(label3, playerid, 0.0, 0.0, 0.4);
  224.     }
  225.     else if(GetPlayerScore(playerid) >= 500)
  226.     {
  227.         new Text3D:label4 = Create3DTextLabel("General Of Army",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  228.         Attach3DTextLabelToPlayer(label4, playerid, 0.0, 0.0, 0.4);
  229.     }
  230.     else if(GetPlayerScore(playerid) >= 1000)
  231.     {
  232.         new Text3D:label5 = Create3DTextLabel("Destroyer",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  233.         Attach3DTextLabelToPlayer(label5, playerid, 0.0, 0.0, 0.4);
  234.     }
  235.     else if(GetPlayerScore(playerid) >= 3000 && GetPlayerScore(playerid) < 600)
  236.     {
  237.         new Text3D:label6 = Create3DTextLabel("Profesional",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  238.         Attach3DTextLabelToPlayer(label6, playerid, 0.0, 0.0, 0.4);
  239.     }
  240.     else if(GetPlayerScore(playerid) >= 5000)
  241.     {
  242.         new Text3D:label3 = Create3DTextLabel("GOD",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  243.         Attach3DTextLabelToPlayer(label3, playerid, 0.0, 0.0, 0.4);
  244.     }
  245.     return 1;
  246. }
  247.  
  248. public OnPlayerDeath(playerid, killerid, reason)
  249. {
  250.     return 1;
  251. }
  252.  
  253. public OnVehicleSpawn(vehicleid)
  254. {
  255.     return 1;
  256. }
  257.  
  258. public OnVehicleDeath(vehicleid, killerid)
  259. {
  260.     return 1;
  261. }
  262.  
  263. public OnPlayerText(playerid, text[])
  264. {
  265.     return 1;
  266. }
  267.  
  268. public OnPlayerCommandText(playerid, cmdtext[])
  269. {
  270.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  271.     {
  272.         // Do something here
  273.         return 1;
  274.     }
  275.     return 0;
  276. }
  277.  
  278. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  279. {
  280.     return 1;
  281. }
  282.  
  283. public OnPlayerExitVehicle(playerid, vehicleid)
  284. {
  285.     return 1;
  286. }
  287.  
  288. public OnPlayerStateChange(playerid, newstate, oldstate)
  289. {
  290.     return 1;
  291. }
  292.  
  293. public OnPlayerEnterCheckpoint(playerid)
  294. {
  295.     return 1;
  296. }
  297.  
  298. public OnPlayerLeaveCheckpoint(playerid)
  299. {
  300.     return 1;
  301. }
  302.  
  303. public OnPlayerEnterRaceCheckpoint(playerid)
  304. {
  305.     return 1;
  306. }
  307.  
  308. public OnPlayerLeaveRaceCheckpoint(playerid)
  309. {
  310.     return 1;
  311. }
  312.  
  313. public OnRconCommand(cmd[])
  314. {
  315.     return 1;
  316. }
  317.  
  318. public OnPlayerRequestSpawn(playerid)
  319. {
  320.     return 1;
  321. }
  322.  
  323. public OnObjectMoved(objectid)
  324. {
  325.     return 1;
  326. }
  327.  
  328. public OnPlayerObjectMoved(playerid, objectid)
  329. {
  330.     return 1;
  331. }
  332.  
  333. public OnPlayerPickUpPickup(playerid, pickupid)
  334. {
  335.     return 1;
  336. }
  337.  
  338. public OnVehicleMod(playerid, vehicleid, componentid)
  339. {
  340.     return 1;
  341. }
  342.  
  343. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  344. {
  345.     return 1;
  346. }
  347.  
  348. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  349. {
  350.     return 1;
  351. }
  352.  
  353. public OnPlayerSelectedMenuRow(playerid, row)
  354. {
  355.     return 1;
  356. }
  357.  
  358. public OnPlayerExitedMenu(playerid)
  359. {
  360.     return 1;
  361. }
  362.  
  363. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  364. {
  365.     return 1;
  366. }
  367.  
  368. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  369. {
  370.     return 1;
  371. }
  372.  
  373. public OnRconLoginAttempt(ip[], password[], success)
  374. {
  375.     return 1;
  376. }
  377.  
  378. public OnPlayerUpdate(playerid)
  379. {
  380.     return 1;
  381. }
  382.  
  383. public OnPlayerStreamIn(playerid, forplayerid)
  384. {
  385.     return 1;
  386. }
  387.  
  388. public OnPlayerStreamOut(playerid, forplayerid)
  389. {
  390.     return 1;
  391. }
  392.  
  393. public OnVehicleStreamIn(vehicleid, forplayerid)
  394. {
  395.     return 1;
  396. }
  397.  
  398. public OnVehicleStreamOut(vehicleid, forplayerid)
  399. {
  400.     return 1;
  401. }
  402.  
  403. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  404. {
  405. if(dialogid == 1)
  406. {
  407. if(response)
  408. {
  409. if(strlen(inputtext))
  410. {
  411.    new file[100], name[MAX_PLAYER_NAME], ip[16], string[128];
  412.    GetPlayerName(playerid, name, sizeof(name));
  413.    GetPlayerIp(playerid, ip, sizeof(ip));
  414.    format(file, sizeof(file), PlayerFile, name);
  415.    dini_Create(file);
  416.    dini_Set(file, "Name", name);
  417.    dini_Set(file, "Ip", ip);
  418.    dini_IntSet(file, "Registered", 1);
  419.    dini_IntSet(file, "Password", num_hash(inputtext));
  420.    dini_IntSet(file, "Level", 0);
  421.    dini_IntSet(file, "Money", 1000);
  422.    dini_IntSet(file, "Score", 0);
  423.    format(string, sizeof(string), "INFO: You have been succesfully registered %s!", name);
  424.    SendClientMessage(playerid ,COLOR_GREEN ,string);
  425.    strcat(gPlayerInfo[playerid][PLAYER_NAME], dini_Get(file, "Name"));
  426.    strcat(gPlayerInfo[playerid][PLAYER_IP], dini_Get(file, "Ip"));
  427.    gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file, "Password");
  428.    gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file, "Level");
  429.    dini_IntSet(file,"Money",GetPlayerMoney(playerid));
  430.    dini_IntSet(file,"Score",GetPlayerScore(playerid));
  431.    gPlayerLogged[playerid] = 1;
  432. }
  433.    else if(!strlen(inputtext))
  434.    {
  435.    SendClientMessage(playerid, COLOR_RED, "ERROR: You must type in a password!");
  436.    ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_INPUT, "Register", "This account is registered. \nInsert your password below to login to your account.", "Register", "Exit");
  437.    }
  438. }
  439.    else if(!response)
  440.    {
  441.    SendClientMessage(playerid, COLOR_RED, "ERROR: You need to register in order to play!");
  442.    Kick(playerid);
  443.    }
  444. }
  445. if(dialogid == 2)
  446. {
  447. if(response)
  448. {
  449. if(strlen(inputtext))
  450. {
  451.    new file[100], name[MAX_PLAYER_NAME], string[128];
  452.    GetPlayerName(playerid, name, sizeof(name));
  453.    format(file, sizeof(file), PlayerFile, name);
  454.    if(num_hash(inputtext) == dini_Int(file, "Password"))
  455.    {
  456.    strcat(gPlayerInfo[playerid][PLAYER_NAME], dini_Get(file, "Name"));
  457.    strcat(gPlayerInfo[playerid][PLAYER_IP], dini_Get(file, "Ip"));
  458.    gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file, "Password");
  459.    gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file, "Level");
  460.    GivePlayerMoney(playerid, dini_Int(file, "Money"));
  461.    SetPlayerScore(playerid, dini_Int(file, "Score"));
  462.    gPlayerLogged[playerid] = 1;
  463.    format(string, sizeof(string), "INFO: Welcome back, %s!", name);
  464.    SendClientMessage(playerid, COLOR_GREEN, string);
  465. }
  466.    else if(num_hash(inputtext) != dini_Int(file, "Password"))
  467.    {
  468.    SendClientMessage(playerid, COLOR_RED, "ERROR: Wrong password!");
  469.    ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Login", "Please fill in your password!", "Login", "Exit");
  470.    }
  471. }
  472.    else if(!strlen(inputtext))
  473.    {
  474.    SendClientMessage(playerid, COLOR_RED, "SERVER: You must fill in your password!");
  475.    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", " Please fill in your password!", "Login", "Exit");
  476.    }
  477. }
  478.    else if(!response)
  479.    {
  480.    SendClientMessage(playerid, COLOR_RED, "ERROR: You need to login in order to play!");
  481.    Kick(playerid);
  482.    }
  483. }
  484. return 0;
  485. }
  486. /*-----------------------------------COMMANDS---------------------------------*/
  487.  
  488. CMD:kick(playerid, params[])
  489. {
  490.     new playerb, string[128],reason[128];
  491.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 2) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  492.     if(sscanf(params, "us[128]", playerb, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /kick [playerid] [reason]");
  493.     if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
  494.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < gPlayerInfo[playerid][PLAYER_LEVEL]) return SendClientMessage(playerid, COLOR_YELLOW, "WARNING: This Player has a higher admin level than you.");
  495.     new nameb[24],name2[24]; GetPlayerName(playerid, nameb, 24); GetPlayerName(playerb, name2,24);
  496.     format(string, sizeof(string), "[KICK]: %s has been kicked by %s, reason: %s", name2, nameb, params);
  497.     SendClientMessageToAll(COLOR_YELLOW, string);
  498.     KickLog(string);
  499.     Kick(playerb);
  500.     return 1;
  501. }
  502.  
  503. CMD:ban(playerid, params[])
  504. {
  505.     new id, reason[50], string[128], banned[MAX_PLAYER_NAME];
  506.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 3) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this command!");
  507.     if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /ban [playerid] [reason]");
  508.     GetPlayerName(id, banned, sizeof(banned)); new pname[24]; GetPlayerName(playerid, pname, 24);
  509.     format(string, sizeof(string), "[BAN]: %s has been banned by %s. reason: %s", banned, pname, reason);
  510.     SendClientMessageToAll(COLOR_YELLOW, string);
  511.     BanLog(string);
  512.     BanEx(id, reason);
  513.     return 1;
  514. }
  515.  
  516. CMD:getip(playerid, params[])
  517. {
  518.     new id;
  519.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this command!");
  520.     if(sscanf(params,"i",id)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /getip [playerid]");
  521.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
  522.     new string[128],ip[24],pname[24];
  523.     GetPlayerIp(id, ip, 24); GetPlayerName(id, pname, 24);
  524.     format(string,128,"[GetIP]: %s's IP is: %s",pname,ip);
  525.     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  526.     return 1;
  527. }
  528.  
  529. CMD:announce(playerid,params[])
  530. {
  531.   if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  532.   new text[60];
  533.   if(sscanf(params,"s[60]",text))
  534.   return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /announce [text]");
  535.   GameTextForAll(text,3000,3);
  536.   return 1;
  537. }
  538.  
  539. CMD:cchat(playerid,params[])
  540. {
  541.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 2)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  542.     {
  543.     for( new i = 0; i <= 100; i ++ ) SendClientMessageToAll( COLOR_WHITE, "" );
  544.     }
  545.     return 1;
  546. }
  547.  
  548. CMD:explode(playerid, params[])
  549. {
  550.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 3)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  551.     new string[128], ID, Float:x, Float:y, Float:z;
  552.     if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_ORANGE, "Usage: /explode [playerid/name]");
  553.     else if(!IsPlayerConnected(ID)) SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
  554.     else
  555.     {
  556.         new pName[MAX_PLAYER_NAME];
  557.         GetPlayerName(ID, pName, MAX_PLAYER_NAME);
  558.         GetPlayerPos(ID, x, y, z);
  559.         CreateExplosion(x, y, z, 12, 10.0);
  560.         format(string,sizeof(string), "You have exploded %s[ID: %d].", pName, ID);
  561.         SendClientMessage(playerid, COLOR_PURPLE, string);
  562.     }
  563.     return 1;
  564. }
  565.  
  566. CMD:unbanip(playerid, params[])
  567. {
  568.     new type[128],string[128];
  569.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 4)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  570.     else if(sscanf(params, "s[128]", type)) SendClientMessage(playerid, COLOR_ORANGE, "Usage: /unbanip [Players IP]");
  571.     else
  572.     {
  573.         new string2[128];
  574.         format(string, sizeof(string),"unbanip %s", type);
  575.         SendRconCommand(string);
  576.         SendRconCommand("reloadbans");
  577.         format(string2, sizeof(string2), "[UNBAN]: You have successfully unbanned IP.");
  578.         SendClientMessage(playerid, COLOR_LIGHTBLUE, string2);
  579.     }
  580.     return 1;
  581. }
  582.  
  583. CMD:report(playerid,params[]) {
  584.     new
  585.     name1[30],
  586.     name2[30],
  587.     id,
  588.     text[128],
  589.     reason[50];
  590.     if(sscanf(params,"us",id,reason))
  591.         return SendClientMessage(playerid, COLOR_ORANGE,"Usage: /report [id] [reason]");
  592.     if(IsPlayerConnected(id)) {
  593.         SendClientMessage(playerid,COLOR_GREEN,"Your report have been sent to online administartor. Thank you for reporting.");
  594.         for(new i = 0; i < MAX_PLAYERS; ++i) {
  595.             if(IsPlayerConnected(i) && !IsPlayerNPC(i) && gPlayerInfo[i][PLAYER_LEVEL] > 0) {
  596.              GetPlayerName(playerid,name1,sizeof(name1));
  597.              GetPlayerName(id,name2,sizeof(name2));
  598.              new Hour,Minute,Second;
  599.              gettime(Hour,Minute,Second);
  600.              format(text,sizeof(text),"|| %d:%d:%d || [Report] | \"%s\" [%i] has reported \"%s\" [%i], reason: %s.",Hour,Minute,Second,name1,playerid,name2,id,reason);
  601.              SendClientMessage(i,COLOR_YELLOW,text);
  602.              ReportLog(text);
  603.             }
  604.         }
  605.     } else {
  606.         return SendClientMessage(playerid,COLOR_RED,"ERROR: This player is not connected.");
  607.     }
  608.     return 1;
  609. }
  610.  
  611. CMD:makeadmin(playerid, params[])
  612. {
  613.     new id,
  614.         level;
  615.  
  616.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 5)
  617.         return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  618.  
  619.     if(sscanf(params, "ui", id, level))
  620.         return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /makeadmin [playerid] [level]");
  621.  
  622.     if(!IsPlayerConnected(id))
  623.         return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected!");
  624.  
  625.     if ( level < 0 || level > 5 )
  626.         return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Admin level (1-5)!");
  627.  
  628.     gPlayerInfo[id][PLAYER_LEVEL] = level;
  629.     new pName[MAX_PLAYER_NAME], str[128], pName1[MAX_PLAYER_NAME];
  630.     GetPlayerName(playerid, pName, sizeof(pName));
  631.     GetPlayerName(id, pName1, sizeof(pName1));
  632.     format(str, sizeof(str), "[SYSTEM]: Administrator %s has changed %s's Admin level to %i",pName, pName1, level);
  633.     SendClientMessageToAll(COLOR_YELLOW, str);
  634.     new file[100];
  635.     format(file, sizeof(file), PlayerFile, gPlayerInfo[playerid][PLAYER_NAME]);
  636.     dini_Set(file, "Name", gPlayerInfo[playerid][PLAYER_NAME]);
  637.     dini_Set(file, "Ip", gPlayerInfo[playerid][PLAYER_IP]);
  638.     dini_IntSet(file, "Registered", gPlayerInfo[playerid][PLAYER_REGGED]);
  639.     dini_IntSet(file, "Password", gPlayerInfo[playerid][PLAYER_PASS]);
  640.     dini_IntSet(file, "Level", gPlayerInfo[playerid][PLAYER_LEVEL]);
  641.     dini_IntSet(file, "Money", GetPlayerMoney(playerid));
  642.     gPlayerLogged[playerid] = 0;
  643.     return 1;
  644. }
  645.  
  646. CMD:setscore(playerid, params[])
  647. {
  648.     new targetid, score, sendername[MAX_PLAYER_NAME], receivername[MAX_PLAYER_NAME], string[128];
  649.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 3) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  650.     if(sscanf(params,"ui", targetid, score)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /setscore [PlayerID] [Score]");
  651.     if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This Player is not Connected!");
  652.     GetPlayerName(playerid, sendername, sizeof(sendername));
  653.     GetPlayerName(targetid, receivername,sizeof(receivername));
  654.     format(string, sizeof(string),"[SCORE]: Your Score been setted to %d by an admin %s", score, sendername);
  655.     SendClientMessage(targetid, COLOR_YELLOW, string);
  656.     format(string, sizeof(string),"[SCORE]: Admin %s Setted your score to %d", receivername, score);
  657.     SendClientMessage(targetid, COLOR_YELLOW, string);
  658.     SetPlayerScore(playerid, score);
  659.     return 1;
  660. }
  661.  
  662. CMD:spec(playerid, params[])
  663. {
  664.     new id;
  665.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  666.     if(sscanf(params,"u", id))return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /spec [playerid]");
  667.     if(id == playerid)return SendClientMessage(playerid,COLOR_RED,"ERROR: You cannot spec yourself.");
  668.     if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected");
  669.     if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,COLOR_YELLOW,"WARNING: You are already specing someone.");
  670.     GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
  671.     Inter[playerid] = GetPlayerInterior(playerid);
  672.     vWorld[playerid] = GetPlayerVirtualWorld(playerid);
  673.     TogglePlayerSpectating(playerid, true);
  674.     if(IsPlayerInAnyVehicle(id))
  675.     {
  676.         if(GetPlayerInterior(id) > 0)
  677.         {
  678.             SetPlayerInterior(playerid,GetPlayerInterior(id));
  679.         }
  680.         if(GetPlayerVirtualWorld(id) > 0)
  681.         {
  682.             SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
  683.         }
  684.         PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
  685.             }
  686.     else
  687.  
  688.     {
  689.         if(GetPlayerInterior(id) > 0)
  690.         {
  691.             SetPlayerInterior(playerid,GetPlayerInterior(id));
  692.         }
  693.         if(GetPlayerVirtualWorld(id) > 0)
  694.         {
  695.             SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
  696.         }
  697.         PlayerSpectatePlayer(playerid,id);
  698.     }
  699.     GetPlayerName(id, Name, sizeof(Name));
  700.     format(String, sizeof(String),"You have started to spectate %s.",Name);
  701.     SendClientMessage(playerid,0x0080C0FF,String);
  702.     IsSpecing[playerid] = 1;
  703.     IsBeingSpeced[id] = 1;
  704.     spectatorid[playerid] = id;
  705.     return 1;
  706. }
  707.  
  708. CMD:specoff(playerid, params[])
  709. {
  710.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  711.     if(IsSpecing[playerid] == 0)return SendClientMessage(playerid,COLOR_RED,"ERROR: You are not spectating anyone.");
  712.     TogglePlayerSpectating(playerid, 0);
  713.     return 1;
  714. }
  715.  
  716. CMD:heal(playerid, params[])
  717. {
  718.     new hp;
  719.     new destid;
  720.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  721.     if(!IsPlayerConnected(destid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This Player is not Connected!");
  722.     if(sscanf(params,"ud",destid,hp)) return SendClientMessage(playerid, COLOR_ORANGE,"Usage: /heal [playerid] [ammount]");
  723.     SetPlayerHealth(destid,hp);
  724.     SendClientMessageToAll(playerid, "{AF09F7}[System]: Admin has healed a player.");
  725.     return 1;
  726. }
  727.  
  728. CMD:akill(playerid, params[])
  729. {
  730.     new destid;
  731.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 3) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  732.     if(!IsPlayerConnected(destid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This Player is not Connected!");
  733.     if(sscanf(params,"ud",destid)) return SendClientMessage(playerid, COLOR_ORANGE,"Usage: /akill [playerid]");
  734.     SetPlayerHealth(destid, 0);
  735.     SendClientMessage(playerid, COLOR_YELLOW, "[System]: You have a-killed a player!");
  736.     return 1;
  737. }
  738.  
  739. CMD:get(playerid, params[])
  740. {
  741.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  742.     new id, string [120];
  743.     if(sscanf(params, "r", id)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /get [playerid]");
  744.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
  745.     new Float:Pos[4], playeridname[MAX_PLAYER_NAME+1], idname[MAX_PLAYER_NAME+1];
  746.     SetPlayerInterior(playerid, GetPlayerInterior(id));
  747.     GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
  748.     GetPlayerFacingAngle(id, Pos[3]);
  749.     SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  750.     SetPlayerFacingAngle(playerid, Pos[3]);
  751.     GetPlayerName(id, idname, sizeof(idname));
  752.     GetPlayerName(playerid, playeridname, sizeof(playeridname));
  753.     format(string, sizeof(string), "[System]: Administrator %s has teleported %s to him.", playeridname, idname);
  754.     SendClientMessageToAll(COLOR_PURPLE, string);
  755.     return 1;
  756. }
  757.  
  758. CMD:rankinfo(playerid,params[])
  759. {
  760.     SendClientMessage(playerid, COLOR_GREEN, "***[TDM] Ranks***");
  761.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Newbie 0-10*");
  762.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Private 11-50*");
  763.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Soldier 51-100*");
  764.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Capitan 101-300*");
  765.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*General Of Army 301-500*");
  766.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Destroyer 501-1000*");
  767.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Profesional 1001-3000*");
  768.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "*GOD 3001-5000...*");
  769.     return 1;
  770. }
  771.  
  772. CMD:givemoney(playerid, params[])
  773. {
  774.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
  775.     {
  776.     new string[128], targetid, money;
  777.     if(sscanf(params, "ud", targetid, money)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /givemoney [playerid] [money]");
  778.     if(IsPlayerConnected(targetid))
  779.     {
  780.     GivePlayerMoney(targetid, money);
  781.     format(string, sizeof(string), "[System]: You have set %s's cash to an amount of $%d.",GetName(targetid),money);
  782.     SendClientMessage(playerid, COLOR_YELLOW, string);
  783.     }
  784.     }
  785.     return 1;
  786. }
Advertisement
Add Comment
Please, Sign In to add comment