Advertisement
Guest User

Untitled

a guest
Mar 19th, 2010
1,121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 43.53 KB | None | 0 0
  1.  
  2. /* ..:: Easy Registration Script by Hustler ::..
  3.  
  4.     >>  PLEASE do NOT take out the credits (c)
  5.     >>  It`s a very simple Admin System for a simple Gamemode
  6.  
  7.    ..:: CREDITS ::..
  8.  
  9.    >> BlackFoX_UD_(BfX) - For the graet TUT ! in www.samp.breadfish.de
  10.    >> Golkiller - For dcmd + sscanf Tutorial in www.samp.breadfish.de
  11.    >> DracoBlue - For dcmd
  12.    >> Alex aka Y_Less - For sscanf
  13.    >> ShukaZ - For Ideas
  14.    >> www.samp.breadfish.de - For the nice Community which help always
  15.    >> Hustler - For The Admin script ;D
  16.  
  17.    ..:: I wish you much fun with the filterscript ::..
  18.  
  19. */
  20. //                                                       SRY FOR MY BAD ENGLISH <3
  21. #include <a_samp>
  22. #include <dini>
  23. #define DIALOG_LOGIN 3
  24. #define DIALOG_REG 4
  25. #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
  26. #define COLOR_GREY 0xAFAFAFAA
  27. #define COLOR_GREEN 0x33AA33AA
  28. #define COLOR_RED 0xFF0000AA
  29. #define COLOR_BLUE 0x0000BBAA
  30. #define COLOR_LIGHTBLUE 0x33CCFFAA
  31. #define COLOR_DARKRED 0x660000AA
  32. #define COLOR_WHITE 0xFFFFFFAA
  33. #define COLOR_YELLOW 0xF1FE01FF
  34. #define COLOR_PURPLE 0x9E18E7FF
  35.  
  36. enum Player_daten
  37. {
  38.     admin,
  39.     Deaths,
  40.     Kills,
  41.     eingeloggt
  42. }
  43. new Player[MAX_PLAYERS][Player_daten];
  44.  
  45. public OnFilterScriptInit()
  46. {
  47.     print("\n--------------------------------------");
  48.     print("*** EASY ADMINISTRATION FILTERSCRIPT *** by HustLeR");
  49.     print("                 LOADED                  ");
  50.     print("--------------------------------------\n");
  51.     return 1;
  52. }
  53. public OnPlayerRequestClass(playerid, classid)
  54. {
  55.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  56.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  57.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  58.     return 1;
  59. }
  60.  
  61. public OnPlayerConnect(playerid)
  62. {
  63.     new pname[MAX_PLAYERS],accFormat[128];
  64.     GetPlayerName(playerid,pname,sizeof pname);
  65.     format(accFormat,sizeof accFormat,"acc/%s.sav",pname);
  66.     if(fexist(accFormat))
  67.     {
  68.         ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please logg in ","Cancel","Next");
  69.     }
  70.     else
  71.     {
  72.         ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please register to keep your stats","Cancel","Next");
  73.     }
  74.     SendClientMessage(playerid,COLOR_RED,"This Server is running on Husler`s Easy Administration Script");
  75.     return 1;
  76. }
  77.  
  78. public OnPlayerDisconnect(playerid, reason)
  79. {
  80.     new pname[MAX_PLAYERS],accFormat[128];
  81.     GetPlayerName(playerid,pname,sizeof pname);
  82.     format(accFormat,sizeof accFormat,"acc/%s.sav",pname);
  83.     if(fexist(accFormat) && Player[playerid][eingeloggt])
  84.     {
  85.         dini_IntSet(accFormat,"Adminlvl",Player[playerid][admin]);
  86.         dini_IntSet(accFormat,"Kills",Player[playerid][Kills]);
  87.         dini_IntSet(accFormat,"Deaths",Player[playerid][Deaths]);
  88.         dini_IntSet(accFormat,"Geld",GetPlayerMoney(playerid));
  89.         dini_IntSet(accFormat,"Score",GetPlayerScore(playerid));
  90.     }
  91.     Player[playerid][eingeloggt] = 0;
  92.     return 1;
  93. }
  94. public OnPlayerDeath(playerid, killerid, reason)
  95. {
  96.     Player[playerid][Deaths]++;
  97.     Player[killerid][Kills]++;
  98.     return 1;
  99. }
  100. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  101. {
  102.     new pname[MAX_PLAYERS],accFormat[128];
  103.     GetPlayerName(playerid,pname,sizeof pname);
  104.     format(accFormat,sizeof accFormat,"acc/%s.sav",pname);
  105.     if(response)
  106.     {
  107.         switch(dialogid)
  108.         {
  109.             case DIALOG_LOGIN: // ID Login
  110.             {
  111.                 if(!strlen(inputtext))
  112.                 {
  113.                     ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please logg in ","Cancel","Next");
  114.                     return SendClientMessage(playerid,0xFFFFFFFF,"No password!");
  115.                 }
  116.                 if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0) // Load PSW
  117.                 {
  118.                     Player[playerid][admin] = dini_Int(accFormat,"AdminLvl");
  119.                     Player[playerid][Kills] = dini_Int(accFormat,"Kills");
  120.                     Player[playerid][Deaths] = dini_Int(accFormat,"Deaths");
  121.                     GivePlayerMoney(playerid,dini_Int(accFormat,"Geld"));
  122.                     SetPlayerScore(playerid,dini_Int(accFormat,"Score"));
  123.                     Player[playerid][eingeloggt] = 1; //player is logged in now
  124.                     SendClientMessage(playerid,0xFFFFFFFF,"You have been sucessfully logged in.");
  125.                 }
  126.                 else
  127.                 {
  128.                     ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please logg in","Cancel","Next");
  129.                     SendClientMessage(playerid,0xFFFFFFFF,"This password ist wrong!");
  130.                 }
  131.             }
  132.             case DIALOG_REG:
  133.             {
  134.                 if(!strlen(inputtext))
  135.                 {
  136.                         ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please register to keep your stats","Cancel","Next");
  137.                         return SendClientMessage(playerid,0xFFFFFFFF,"This password ist too short!");
  138.                 }
  139.                 dini_Create(accFormat);
  140.                 dini_Set(accFormat,"Passwort",inputtext);
  141.                 Player[playerid][admin] = 0 ;
  142.                 Player[playerid][eingeloggt] = 1;
  143.                 SendClientMessage(playerid,0xFFFFFFFF,"Yout account has been registred and you have been automatically logged in");
  144.             }
  145.         }
  146.     }
  147.     else
  148.     {
  149.         switch(dialogid)
  150.         {
  151.             case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please logg in","Cancel","Next");
  152.             case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please register to keep yout stats","Cancel","Next");
  153.         }
  154.     }
  155.     return 1;
  156. }
  157. public OnPlayerCommandText(playerid, cmdtext[])
  158. {
  159. //-------------------DCMD`s Begin---------------------------------------------------------
  160.     dcmd(report,6,cmdtext);
  161.     dcmd(kick,4,cmdtext);
  162.     dcmd(ban,3,cmdtext);
  163.     dcmd(seestats,8,cmdtext);
  164.     dcmd(admins,6,cmdtext);
  165.     dcmd(a,1,cmdtext);
  166.     dcmd(dec,3,cmdtext);
  167.     dcmd(makeadmin,9,cmdtext);
  168.     dcmd(freeze,6,cmdtext);
  169.     dcmd(unfreeze,8,cmdtext);
  170.     dcmd(setkills,8,cmdtext);
  171.     dcmd(setdeaths,9,cmdtext);
  172.     dcmd(setscore,8,cmdtext);
  173.     dcmd(givecash,8,cmdtext);
  174.     dcmd(giveweapon,10,cmdtext);
  175.     dcmd(explode,7,cmdtext);
  176.     dcmd(tele,4,cmdtext);
  177.     dcmd(gethere,7,cmdtext);
  178.     dcmd(pm,2,cmdtext);
  179.     dcmd(setskin,7,cmdtext);
  180.     dcmd(sethealth,9,cmdtext);
  181.     dcmd(takeweaps,9,cmdtext);
  182.     dcmd(changeweather,13,cmdtext);
  183.     dcmd(sethour,7,cmdtext);
  184.     dcmd(veh,3,cmdtext);
  185.     dcmd(seecash,7,cmdtext);
  186.     dcmd(setcash,7,cmdtext);
  187.     dcmd(setarm,6,cmdtext);
  188. //----------------------Dcmd`s END------------------------------------------------------------
  189.     if(strcmp("/cmd",cmdtext,true,10)==0){
  190.     SendClientMessage(playerid,COLOR_RED,"[USER CMD`s] : /stats /seestats /resetstats /pm /admins /report /ahelp");
  191.     return 1;
  192.     }
  193.     if(strcmp("/credits",cmdtext,true,10)==0){
  194.     SendClientMessage(playerid,COLOR_RED,"Easy Administration Script by Hustler (c)");
  195.     return 1;
  196.     }
  197.  
  198.     if (strcmp("/clear", cmdtext, true, 10) == 0)
  199.     {
  200.     if(Player[playerid][admin] < 1)
  201.     {
  202.     SendClientMessage(playerid, COLOR_RED,"You must be a Moderator or higher to see clear the chat");
  203.     }
  204.     SendClientMessageToAll(COLOR_RED,"");
  205.     SendClientMessageToAll(COLOR_RED,"");
  206.     SendClientMessageToAll(COLOR_RED,"");
  207.     SendClientMessageToAll(COLOR_RED,"");
  208.     SendClientMessageToAll(COLOR_RED,"");
  209.     SendClientMessageToAll(COLOR_RED,"");
  210.     SendClientMessageToAll(COLOR_RED,"");
  211.     SendClientMessageToAll(COLOR_RED,"");
  212.     SendClientMessageToAll(COLOR_RED,"");
  213.     SendClientMessageToAll(COLOR_RED,"");
  214.     SendClientMessageToAll(COLOR_RED,"");
  215.     SendClientMessageToAll(COLOR_RED,"");
  216.     SendClientMessageToAll(COLOR_RED,"");
  217.     SendClientMessageToAll(COLOR_RED,"");
  218.     SendClientMessageToAll(COLOR_RED,"");
  219.     SendClientMessageToAll(COLOR_RED,"");
  220.     SendClientMessageToAll(COLOR_RED,"");
  221.     SendClientMessageToAll(COLOR_RED,"");
  222.     SendClientMessageToAll(COLOR_RED,"");
  223.     SendClientMessageToAll(COLOR_RED,"");
  224.     SendClientMessageToAll(COLOR_RED,"");
  225.     SendClientMessageToAll(COLOR_RED,"");
  226.     SendClientMessageToAll(COLOR_RED,"");
  227.     SendClientMessageToAll(COLOR_RED,"");
  228.     SendClientMessageToAll(COLOR_RED,"");
  229.     SendClientMessageToAll(COLOR_RED,"");
  230.     SendClientMessageToAll(COLOR_RED,"");
  231.     SendClientMessageToAll(COLOR_RED,"");
  232.     SendClientMessageToAll(COLOR_RED,"");
  233.     SendClientMessageToAll(COLOR_RED,"");
  234.     SendClientMessageToAll(COLOR_RED,"");
  235.     SendClientMessageToAll(COLOR_RED,"");
  236.     SendClientMessageToAll(COLOR_RED,"");
  237.     SendClientMessageToAll(COLOR_RED,"");
  238.     SendClientMessageToAll(COLOR_RED,"");
  239.     SendClientMessageToAll(COLOR_RED,"");
  240.     SendClientMessageToAll(COLOR_RED,"");
  241.     SendClientMessageToAll(COLOR_RED,"");
  242.     SendClientMessageToAll(COLOR_RED,"");
  243.     SendClientMessageToAll(COLOR_RED,"");
  244.     SendClientMessageToAll(COLOR_RED,"");
  245.     SendClientMessageToAll(COLOR_RED,"");
  246.     SendClientMessageToAll(COLOR_RED,"");
  247.     SendClientMessageToAll(COLOR_RED,"");
  248.     SendClientMessageToAll(COLOR_RED,"");
  249.     SendClientMessageToAll(COLOR_RED,"");
  250.     SendClientMessageToAll(COLOR_RED,"");
  251.     SendClientMessageToAll(COLOR_RED,"");
  252.     SendClientMessageToAll(COLOR_RED,"");
  253.     SendClientMessageToAll(COLOR_RED,"");
  254.     SendClientMessageToAll(COLOR_RED,"");
  255.     SendClientMessageToAll(COLOR_RED,"");
  256.     SendClientMessageToAll(COLOR_RED,"");
  257.     SendClientMessageToAll(COLOR_RED,"");
  258.     SendClientMessageToAll(COLOR_RED,"");
  259.     SendClientMessageToAll(COLOR_RED,"");
  260.     SendClientMessageToAll(COLOR_RED,"");
  261.     SendClientMessageToAll(COLOR_RED,"");
  262.     SendClientMessageToAll(COLOR_RED,"");
  263.     SendClientMessageToAll(COLOR_RED,"");
  264.     SendClientMessageToAll(COLOR_RED,"");
  265.     SendClientMessageToAll(COLOR_RED,"");
  266.     SendClientMessageToAll(COLOR_RED,"");
  267.     SendClientMessageToAll(COLOR_RED,"");
  268.     SendClientMessageToAll(COLOR_RED,"");
  269.     SendClientMessageToAll(COLOR_RED,"");
  270.     SendClientMessageToAll(COLOR_RED,"");
  271.     SendClientMessageToAll(COLOR_RED,"");
  272.     SendClientMessageToAll(COLOR_RED,"");
  273.     SendClientMessageToAll(COLOR_RED,"");
  274.     SendClientMessageToAll(COLOR_RED,"");
  275.     SendClientMessageToAll(COLOR_RED,"");
  276.     SendClientMessageToAll(COLOR_RED,"");
  277.     SendClientMessageToAll(COLOR_RED,"");
  278.     SendClientMessageToAll(COLOR_RED,"");
  279.     SendClientMessageToAll(COLOR_RED,"");
  280.     SendClientMessageToAll(COLOR_RED,"");
  281.     SendClientMessageToAll(COLOR_RED,"");
  282.     SendClientMessageToAll(COLOR_RED,"");
  283.     SendClientMessageToAll(COLOR_RED,"");
  284.     SendClientMessageToAll(COLOR_RED,"");
  285.     SendClientMessageToAll(COLOR_RED,"");
  286.     SendClientMessageToAll(COLOR_RED,"");
  287.     SendClientMessageToAll(COLOR_RED,"");
  288.     SendClientMessageToAll(COLOR_RED,"");
  289.     SendClientMessageToAll(COLOR_RED,"");
  290.     SendClientMessageToAll(COLOR_RED,"");
  291.     SendClientMessageToAll(COLOR_RED,"");
  292.     SendClientMessageToAll(COLOR_RED,"");
  293.     SendClientMessageToAll(COLOR_RED,"");
  294.     SendClientMessageToAll(COLOR_RED,"");
  295.     SendClientMessageToAll(COLOR_RED,"");
  296.     SendClientMessageToAll(COLOR_RED,"");
  297.     SendClientMessageToAll(COLOR_RED,"");
  298.     SendClientMessageToAll(COLOR_RED,"");
  299.     SendClientMessageToAll(COLOR_RED,"");
  300.     SendClientMessageToAll(COLOR_RED,"");
  301.     SendClientMessageToAll(COLOR_RED,"");
  302.     new name[MAX_PLAYER_NAME],string[128];
  303.     GetPlayerName(playerid,name,sizeof(name));
  304.     format(string,sizeof(string),"Admin %s has cleared the chat",name);
  305.     SendClientMessageToAll(COLOR_GREEN,string);
  306.     return 1;
  307.     }
  308.  
  309.  
  310.     if (strcmp("/ahelp", cmdtext, true, 10) == 0)
  311.     {
  312.     if(Player[playerid][admin] == 0)
  313.     {
  314.     SendClientMessage(playerid, COLOR_RED,"You must be a Moderator or higher to see admin commands");
  315.     }
  316.     if(Player[playerid][admin] == 1)
  317.     {
  318.     SendClientMessage(playerid, COLOR_PURPLE,"[ModeratorCMD`s]: /a /dec /freeze /unfreeze /explode /kick /takeweaps /clear /seecash");
  319.     }
  320.     if(Player[playerid][admin] == 2)
  321.     {
  322.     SendClientMessage(playerid, COLOR_PURPLE,"[ModeratorCMD`s]: /a /dec /freeze /unfreeze /explode  /kick /takeweaps /clear /seecash");
  323.     SendClientMessage(playerid, COLOR_PURPLE,"[AdminCMD`s]: /giveweapon /tele /gethere /setskin /sethealth /sethour /setarm /changeweather");
  324.     }
  325.     if(Player[playerid][admin] == 3)
  326.     {
  327.     SendClientMessage(playerid, COLOR_PURPLE,"[ModeratorCMD`s]: /a /dec /freeze /unfreeze /explode  /kick /takeweaps /clear /seecash");
  328.     SendClientMessage(playerid, COLOR_PURPLE,"[AdminCMD`s]: /giveweapon /tele /gethere /setskin /sethealth /setarm /sethour /changeweather");
  329.     SendClientMessage(playerid, COLOR_PURPLE,"[SuperAdminCMD`s]: /gmx /ban /setscore /setdeaths /setkills /givecash /setcash /veh");
  330.     }
  331.     if(Player[playerid][admin] == 4)
  332.     {
  333.     SendClientMessage(playerid, COLOR_PURPLE,"[ModeratorCMD`s]: /a /dec /freeze /unfreeze /explode  /kick /takeweaps /clear /seecash");
  334.     SendClientMessage(playerid, COLOR_PURPLE,"[AdminCMD`s]: /giveweapon /tele /gethere /setskin /sethealth /setarm /sethour /changeweather");
  335.     SendClientMessage(playerid, COLOR_PURPLE,"[SuperAdminCMD`s]: /gmx /ban /setscore /setdeaths /setkills /givecash /setcash /veh");
  336.     SendClientMessage(playerid, COLOR_PURPLE,"[ServerOwnerCMD`s]: /makeadmin");
  337.     }
  338.     return 1;
  339.     }
  340.     if (strcmp("/stats", cmdtext, true, 10) == 0)
  341.     {
  342.     new name[MAX_PLAYER_NAME], string[256], string2[256],string3[256];
  343.     GetPlayerName(playerid, name, sizeof(name));
  344.     format(string, sizeof(string), "| Stats of[%s] |", name);
  345.     format(string2, sizeof(string2), "[Kills: %d] [Deaths: %d] [Ratio: %0.2f] ",Player[playerid][Kills], Player[playerid][Deaths],Float:Player[playerid][Kills]/Float:Player[playerid][Deaths]);
  346.     format(string3, sizeof(string3), "[Cash: %d] [Score: %d] [Adminlevel: %d]",GetPlayerMoney(playerid),GetPlayerScore(playerid),Player[playerid][admin]);
  347.     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  348.     SendClientMessage(playerid, COLOR_WHITE, string2);
  349.     SendClientMessage(playerid, COLOR_WHITE, string3);
  350.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "|__________________________________________|");
  351.     return 1;
  352.     }
  353.  
  354.     if (strcmp("/gmx",cmdtext,true,10) == 0)
  355.     {
  356.     if(Player[playerid][admin] < 3){
  357.         return SendClientMessage(playerid,COLOR_RED,"You must be Admin level 3 or higher to start a gmx");
  358.     }
  359.     new
  360.         name[MAX_PLAYER_NAME],
  361.         string[128];
  362.     GetPlayerName(playerid,name,sizeof(name));
  363.     format(string,sizeof(string),"Admin %s has restarted the sesrver!",name);
  364.     SendClientMessageToAll(COLOR_LIGHTBLUE,string);
  365.     SendRconCommand("gmx");
  366.     return 1;
  367.     }
  368.     if (strcmp("/resetstats", cmdtext, true, 10) == 0)
  369.     {
  370.     Player[playerid][Deaths]=0;
  371.     Player[playerid][Kills]=0;
  372.     SetPlayerScore(playerid,0);
  373.     SendClientMessage(playerid,COLOR_YELLOW,"You have reset your stats");
  374.     return 1;
  375.     }
  376.  
  377.     return 0;
  378. }
  379. //=============================================================DCMD`s Commands=================================================
  380. dcmd_report(playerid,params[])
  381. {
  382.     new
  383.         sReason[128],
  384.         pID;
  385.     if(sscanf(params,"ds",pID,sReason)) {
  386.             return  SendClientMessage(playerid,COLOR_RED,"USAGE: /report [playerid] [reason]");
  387.  
  388.         }
  389.     if(!IsPlayerConnected(pID)) {
  390.             return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID");
  391.         }
  392.     new
  393.             Tplayer[MAX_PLAYER_NAME],
  394.             string[128];
  395.     GetPlayerName(pID,Tplayer,sizeof(Tplayer));
  396.     format(string,sizeof(string),"%s has reported (ID %d) with the reason: %s",Tplayer,pID,sReason[0] ? sReason : "<No Reason>");
  397.     SendAdminMessage(COLOR_YELLOW,string);
  398.     return 1;
  399.  }
  400. dcmd_kick(playerid,params[])
  401. {
  402.     new
  403.         Reason[256],
  404.         pID;
  405.     if(Player[playerid][admin] < 1){
  406.         return SendClientMessage(playerid,COLOR_RED,"You are not a Moderator/Admin!");
  407.         }
  408.     if(sscanf(params,"us",pID,Reason)){
  409.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick [playerid] [reason]");
  410.         }
  411.     if(!IsPlayerConnected(pID)) {
  412.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  413.         }
  414.     new
  415.             name[MAX_PLAYER_NAME],
  416.             string[256];
  417.     GetPlayerName(pID,name,sizeof(name));
  418.     new
  419.             Aname[MAX_PLAYER_NAME];
  420.     GetPlayerName(playerid,Aname,sizeof(Aname));
  421.     format(string,sizeof(string)," %s has kicked %s with the reason: %s",Aname,name,Reason);
  422.     SendClientMessageToAll(COLOR_GREEN,string);
  423.     Kick(pID);
  424.     return 1;
  425. }
  426. dcmd_ban(playerid,params[])
  427. {
  428.     new
  429.         Reason[256],
  430.         pID;
  431.     if(Player[playerid][admin] < 3){
  432.         return SendClientMessage(playerid,COLOR_RED,"You are not a Admin!");
  433.         }
  434.     if(sscanf(params,"us",pID,Reason)){
  435.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /ban [playerid] [reason]");
  436.         }
  437.     if(!IsPlayerConnected(pID)) {
  438.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  439.         }
  440.     new
  441.             name[MAX_PLAYER_NAME],
  442.             string[256];
  443.     GetPlayerName(pID,name,sizeof(name));
  444.     new
  445.             Aname[MAX_PLAYER_NAME];
  446.     GetPlayerName(playerid,Aname,sizeof(Aname));
  447.     format(string,sizeof(string)," %s has banned %s with the reason: %s",Aname,name,Reason);
  448.     SendClientMessageToAll(COLOR_GREEN,string);
  449.     Ban(pID);
  450.     return 1;
  451. }
  452. dcmd_seestats(playerid,params[])
  453. {
  454.     new pID;
  455.     if(sscanf(params,"u",pID)){
  456.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /seestats [playerid]");
  457.         }
  458.     if(!IsPlayerConnected(pID)) {
  459.     return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  460.         }
  461.     new
  462.     name[MAX_PLAYER_NAME],
  463.     string[256],string2[256];
  464.     GetPlayerName(pID,name,sizeof(name));
  465.     format(string, sizeof(string), "| Stats of[%s] |", name);
  466.     format(string2, sizeof(string2), "[Kills: %d] [Deaths: %d] [Ratio: %0.2f] [Score: %d]  ", Player[pID][Kills], Player[pID][Deaths],Float:Player[pID][Kills]/Float:Player[pID][Deaths],GetPlayerScore(pID));
  467.     SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
  468.     SendClientMessage(playerid,COLOR_WHITE,string2);
  469.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"|_____________________________________________|");
  470.     new
  471.         pname[MAX_PLAYER_NAME],string3[256];
  472.     GetPlayerName(playerid,pname,sizeof(pname));
  473.     format(string3, sizeof(string3), "%s has typed /seestas to see your stats", pname);
  474.     SendClientMessage(pID,COLOR_YELLOW,string3);
  475.     return 1;
  476. }
  477. dcmd_admins(playerid,params[])
  478. {
  479.     #pragma unused params
  480.     SendClientMessage(playerid, COLOR_BLUE, "Mods/Admins Online:");
  481.  
  482.     new i = 0, aname[256], string[256];
  483.     for(; i < MAX_PLAYERS; i++)
  484.     {
  485.         if(IsPlayerConnected(i))
  486.         {
  487.             if(Player[i][admin] == 1)
  488.             {
  489.                 GetPlayerName(i, aname, sizeof(aname));
  490.                 format(string, 256, " Moderator: %s", aname);
  491.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  492.             }
  493.             else if(Player[i][admin] == 2)
  494.             {
  495.                 GetPlayerName(i, aname, sizeof(aname));
  496.                 format(string, 256, " Admin: %s", aname);
  497.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, aname);
  498.             }
  499.             else if(Player[i][admin] == 3)
  500.             {
  501.                 GetPlayerName(i, aname, sizeof(aname));
  502.                 format(string, 256, " SuperAdmin: %s", aname);
  503.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  504.             }
  505.             else if(Player[i][admin] == 4)
  506.             {
  507.                 GetPlayerName(i, aname, sizeof(aname));
  508.                 format(string, 256, " ServerOwner: %s", aname);
  509.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  510.             }
  511.         }
  512.     }
  513.     return 1;
  514. }
  515. dcmd_a(playerid,params[])
  516. {
  517.     if(Player[playerid][admin] <= 1) {
  518.     return SendClientMessage(playerid,COLOR_RED,"You must be a Mod/Admin to be able to write in admin chat");
  519.         }
  520.     new atext[128];
  521.     if(sscanf(params,"s",atext)){
  522.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /a [text]");
  523.         }
  524.     new name[MAX_PLAYER_NAME];
  525.     new string[128];
  526.     GetPlayerName(playerid,name,sizeof(name));
  527.     format(string,sizeof(string),"Level %d Admin (%s): %s" ,Player[playerid][admin],name,atext);
  528.     SendAdminMessage(COLOR_YELLOW,string);
  529.     return 1;
  530. }
  531. dcmd_dec(playerid,params[])
  532. {
  533.     new dtext[128];
  534.     if(Player[playerid][admin] <=1) {
  535.         return SendClientMessage (playerid,COLOR_RED,"You must be a Mod/Admin to write a declaration");
  536.     }
  537.     if(sscanf(params,"s",dtext)){
  538.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /dec [text]");
  539.     }
  540.     GameTextForAll(dtext,3*1000,3);
  541.     return 1;
  542. }
  543. dcmd_makeadmin(playerid,params[])
  544. {
  545.     if(Player[playerid][admin] < 4 || IsPlayerAdmin(playerid)) {
  546.         return SendClientMessage (playerid,COLOR_RED,"You must be a ServerOwner to set admin Levels");
  547.     }
  548.     new pID,alevel;
  549.     if(sscanf(params,"ud",pID,alevel)){
  550.         return SendClientMessage (playerid,COLOR_RED,"USAGE: /makeadmin [playerid] [adminlevel]");
  551.     }
  552.     if(!IsPlayerConnected(pID)){
  553.         return SendClientMessage (playerid,COLOR_RED,"Nobody is connected with this ID!");
  554.     }
  555.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  556.     Player[pID][admin] = alevel;
  557.     GetPlayerName(playerid,aname,sizeof(aname));
  558.     GetPlayerName(pID,name,sizeof(name));
  559.     format(string,sizeof(string),"You have set the admin level of %s to %d",name,alevel);
  560.     format(string2,sizeof(string2),"ServerOwner %s has set your admin level to %d",aname,alevel);
  561.     SendClientMessage(playerid,COLOR_GREEN,string);
  562.     SendClientMessage(pID,COLOR_GREEN,string2);
  563.     return 1;
  564. }
  565. dcmd_freeze(playerid,params[])
  566. {
  567.     if(Player[playerid][admin] < 1){
  568.         return SendClientMessage (playerid,COLOR_RED,"You must be a Mod/Admin to freeze Players");
  569.     }
  570.     new pID;
  571.     if(sscanf(params,"u",pID)){
  572.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /freeze [playerid]");
  573.     }
  574.     if(!IsPlayerConnected(pID)){
  575.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  576.     }
  577.     new string[128],string2[128],adminname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  578.     GetPlayerName(playerid,adminname,sizeof(adminname));
  579.     GetPlayerName(pID,name,sizeof(name));
  580.     format(string,sizeof(string),"You have frozen %s",name);
  581.     format(string2,sizeof(string2),"You was been frozen by %s",adminname);
  582.     SendClientMessage(playerid,COLOR_GREEN,string);
  583.     SendClientMessage(pID,COLOR_GREEN,string2);
  584.     TogglePlayerControllable(pID, 0);
  585.     return 1;
  586. }
  587. dcmd_unfreeze(playerid,params[])
  588. {
  589.     if(Player[playerid][admin] < 1){
  590.         return SendClientMessage (playerid,COLOR_RED,"You must be a Mod/Admin to freeze Players");
  591.     }
  592.     new pID;
  593.     if(sscanf(params,"u",pID)){
  594.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /freeze [playerid]");
  595.     }
  596.     if(!IsPlayerConnected(pID)){
  597.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  598.     }
  599.     new string[128],string2[128],adminname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  600.     GetPlayerName(playerid,adminname,sizeof(adminname));
  601.     GetPlayerName(pID,name,sizeof(name));
  602.     format(string,sizeof(string),"You have unfrozen %s",name);
  603.     format(string2,sizeof(string2),"You was been unfrozen by %s",adminname);
  604.     SendClientMessage(playerid,COLOR_GREEN,string);
  605.     SendClientMessage(pID,COLOR_GREEN,string2);
  606.     TogglePlayerControllable(pID, 1);
  607.     return 1;
  608. }
  609. dcmd_setkills(playerid,params[])
  610. {
  611.     if(Player[playerid][admin] < 3){
  612.         return SendClientMessage (playerid,COLOR_RED,"You must be a SuperAdmin or ServerOwner to set Kills");
  613.     }
  614.     new pID,kills;
  615.     if(sscanf(params,"ud",pID,kills)){
  616.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /setkills [playerid] [kills]");
  617.     }
  618.     if(!IsPlayerConnected(pID)){
  619.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  620.     }
  621.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  622.     Player[pID][Kills] = kills;
  623.     GetPlayerName(playerid,aname,sizeof(aname));
  624.     GetPlayerName(pID,name,sizeof(name));
  625.     format(string,sizeof(string),"You have set the kills  of %s to %d",name,kills);
  626.     format(string2,sizeof(string2),"Admin %s has set your kills to %d",aname,kills);
  627.     SendClientMessage(playerid,COLOR_GREEN,string);
  628.     SendClientMessage(pID,COLOR_GREEN,string2);
  629.     return 1;
  630. }
  631. dcmd_setdeaths(playerid,params[])
  632. {
  633.     if(Player[playerid][admin] < 3){
  634.         return SendClientMessage (playerid,COLOR_RED,"You must be a SuperAdmin or ServerOwner to set Deaths");
  635.     }
  636.     new pID,deaths;
  637.     if(sscanf(params,"ud",pID,deaths)){
  638.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /setkills [playerid] [kills]");
  639.     }
  640.     if(!IsPlayerConnected(pID)){
  641.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  642.     }
  643.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  644.     Player[pID][Deaths] = deaths;
  645.     GetPlayerName(playerid,aname,sizeof(aname));
  646.     GetPlayerName(pID,name,sizeof(name));
  647.     format(string,sizeof(string),"You have set the Deaths of %s to %d",name,deaths);
  648.     format(string2,sizeof(string2),"Admin %s has set your Deaths to %d",aname,deaths);
  649.     SendClientMessage(playerid,COLOR_GREEN,string);
  650.     SendClientMessage(pID,COLOR_GREEN,string2);
  651.     return 1;
  652. }
  653. dcmd_setscore(playerid,params[])
  654. {
  655.     if(Player[playerid][admin] < 3){
  656.         return SendClientMessage (playerid,COLOR_RED,"You must be a SuperAdmin or ServerOwner to set Scores");
  657.     }
  658.     new pID,scores;
  659.     if(sscanf(params,"ud",pID,scores)){
  660.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /setscore [playerid] [score]");
  661.     }
  662.     if(!IsPlayerConnected(pID)){
  663.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  664.     }
  665.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  666.     SetPlayerScore(pID,scores);
  667.     GetPlayerName(playerid,aname,sizeof(aname));
  668.     GetPlayerName(pID,name,sizeof(name));
  669.     format(string,sizeof(string),"You have set the Score of %s to %d",name,scores);
  670.     format(string2,sizeof(string2),"Admin %s has set your Score to %d",aname,scores);
  671.     SendClientMessage(playerid,COLOR_GREEN,string);
  672.     SendClientMessage(pID,COLOR_GREEN,string2);
  673.     return 1;
  674. }
  675. dcmd_givecash(playerid,params[])
  676. {
  677.     if(Player[playerid][admin] < 3){
  678.         return SendClientMessage (playerid,COLOR_RED,"You must be a SuperAdmin or a ServerOwner to give money");
  679.     }
  680.     new pID,cash;
  681.     if(sscanf(params,"ud",pID,cash)){
  682.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /givecash [playerid] [amount]");
  683.     }
  684.     if(!IsPlayerConnected(pID)){
  685.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  686.     }
  687.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  688.     GivePlayerMoney(pID,cash);
  689.     GetPlayerName(playerid,aname,sizeof(aname));
  690.     GetPlayerName(pID,name,sizeof(name));
  691.     format(string,sizeof(string),"You have given Money to %s to %d",name,cash);
  692.     format(string2,sizeof(string2),"Admin %s has given you %d $",aname,cash);
  693.     SendClientMessage(playerid,COLOR_GREEN,string);
  694.     SendClientMessage(pID,COLOR_GREEN,string2);
  695.     return 1;
  696. }
  697. dcmd_giveweapon(playerid,params[])
  698. {
  699.     if(Player[playerid][admin] < 2){
  700.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to give weapons");
  701.     }
  702.     new pID,weapon,ammo;
  703.     if(sscanf(params,"udd",pID,weapon,ammo)){
  704.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /giveweapon [playerid][weaponID] [ammo]");
  705.     }
  706.     if(!IsPlayerConnected(pID)){
  707.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  708.     }
  709.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  710.     GivePlayerWeapon(pID,weapon,ammo);
  711.     GetPlayerName(playerid,aname,sizeof(aname));
  712.     GetPlayerName(pID,name,sizeof(name));
  713.     format(string,sizeof(string),"You have given the player %s weapon ID:%d with %d ammo",name,weapon,ammo);
  714.     format(string2,sizeof(string2),"Admin %s has give you weapon ID:%d with %d ammo",aname,weapon,ammo);
  715.     SendClientMessage(playerid,COLOR_GREEN,string);
  716.     SendClientMessage(pID,COLOR_GREEN,string2);
  717.     return 1;
  718. }
  719. dcmd_explode(playerid,params[])
  720. {
  721.     if(Player[playerid][admin] < 1){
  722.         return SendClientMessage (playerid,COLOR_RED,"You must be a Moderator or higher to explode players");
  723.     }
  724.     new pID;
  725.     if(sscanf(params,"u",pID)){
  726.         return SendClientMessage (playerid,COLOR_RED,"USAGE: /explode [playerid]");
  727.     }
  728.     if(!IsPlayerConnected(pID)){
  729.         return SendClientMessage (playerid,COLOR_RED,"Nobody is connected with this ID!");
  730.     }
  731.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  732.     GetPlayerName(playerid,aname,sizeof(aname));
  733.     GetPlayerName(pID,name,sizeof(name));
  734.     format(string,sizeof(string),"You have explode %s  ",name);
  735.     format(string2,sizeof(string2),"Admin %s has explode you",aname);
  736.     new Float:x,Float:y,Float:z;
  737.     GetPlayerPos(pID,x,y,z);
  738.     CreateExplosion(x,y,z,7,15);
  739.     CreateExplosion(x,y,z,7,15);
  740.     CreateExplosion(x,y,z,7,15);
  741.     CreateExplosion(x,y,z,7,15);
  742.     CreateExplosion(x,y,z,7,15);
  743.     SendClientMessage(playerid,COLOR_GREEN,string);
  744.     SendClientMessage(pID,COLOR_GREEN,string2);
  745.     return 1;
  746. }
  747. dcmd_tele(playerid,params[])
  748. {
  749.     if(Player[playerid][admin] < 2){
  750.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to teleport to players");
  751.     }
  752.     new pID;
  753.     if(sscanf(params,"u",pID)){
  754.         return SendClientMessage (playerid,COLOR_RED,"USAGE: /tele [playerid]");
  755.     }
  756.     if(!IsPlayerConnected(pID)){
  757.         return SendClientMessage (playerid,COLOR_RED,"Nobody is connected with this ID!");
  758.     }
  759.     new string[128],name[MAX_PLAYER_NAME];
  760.     GetPlayerName(pID,name,sizeof(name));
  761.     format(string,sizeof(string),"You have been teleported to %s",name);
  762.     new Float:x,Float:y,Float:z;
  763.     GetPlayerPos(pID,x,y,z);
  764.     SetPlayerPos(playerid,x,y,z);
  765.     SendClientMessage(playerid,COLOR_GREEN,string);
  766.     return 1;
  767. }
  768. dcmd_gethere(playerid,params[])
  769. {
  770.     if(Player[playerid][admin] < 2){
  771.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin to teleport players ");
  772.     }
  773.     new pID;
  774.     if(sscanf(params,"u",pID)){
  775.         return SendClientMessage (playerid,COLOR_RED,"USAGE: /gethere [playerid]");
  776.     }
  777.     if(!IsPlayerConnected(pID)){
  778.         return SendClientMessage (playerid,COLOR_RED,"Nobody is connected with this ID!");
  779.     }
  780.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  781.     GetPlayerName(pID,name,sizeof(name));
  782.     GetPlayerName(playerid,aname,sizeof(aname));
  783.     format(string,sizeof(string),"You have been teleported to %s",aname);
  784.     format(string2,sizeof(string2),"You have been teleported to %s",name);
  785.     new Float:x,Float:y,Float:z;
  786.     GetPlayerPos(playerid,x,y,z);
  787.     SetPlayerPos(pID,x,y,z);
  788.     SendClientMessage(pID,COLOR_GREEN,string);
  789.     SendClientMessage(playerid,COLOR_GREEN,string2);
  790.     return 1;
  791. }
  792. dcmd_pm(playerid,params[])
  793. {
  794.     new
  795.         pmtext[128],
  796.         pID;
  797.     if(sscanf(params,"ds",pID,pmtext)) {
  798.             return  SendClientMessage(playerid,COLOR_RED,"USAGE: /pm [playerid] [text]");
  799.  
  800.         }
  801.     if(!IsPlayerConnected(pID)) {
  802.             return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID");
  803.         }
  804.     new
  805.         name[MAX_PLAYER_NAME],pmname[MAX_PLAYER_NAME],
  806.         string[128],string2[128];
  807.     GetPlayerName(playerid,name,sizeof(name));
  808.     GetPlayerName(pID,pmname,sizeof(pmname));
  809.     format(string,sizeof(string),"PM from %s : %s ",name,pmtext);
  810.     format(string2,sizeof(string2),"You have sent the PM to %s ",pmname);
  811.     SendClientMessage(pID,COLOR_YELLOW,string);
  812.     SendClientMessage(playerid,COLOR_YELLOW,string2);
  813.     return 1;
  814.  }
  815. dcmd_setskin(playerid,params[])
  816. {
  817.     if(Player[playerid][admin] < 2){
  818.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to set Skins");
  819.     }
  820.     new pID,skinid;
  821.     if(sscanf(params,"ud",pID,skinid)){
  822.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /setskin [playerid] [skinID(0-299!)]*");
  823.     }
  824.     if(!IsPlayerConnected(pID)){
  825.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  826.     }
  827.     if(skinid < 0){
  828.         return SendClientMessage(playerid,COLOR_RED,"INVALID ID!");
  829.     }
  830.     if(skinid > 299){
  831.         return SendClientMessage(playerid,COLOR_RED,"INVALID ID!");
  832.     }
  833.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  834.     SetPlayerSkin(pID,skinid);
  835.     GetPlayerName(playerid,aname,sizeof(aname));
  836.     GetPlayerName(pID,name,sizeof(name));
  837.     format(string,sizeof(string),"You have set the SkinID of %s to %d",name,skinid);
  838.     format(string2,sizeof(string2),"Admin %s has set your SkinID to %d",aname,skinid);
  839.     SendClientMessage(playerid,COLOR_GREEN,string);
  840.     SendClientMessage(pID,COLOR_GREEN,string2);
  841.     return 1;
  842. }
  843. dcmd_sethealth(playerid,params[])
  844. {
  845.     if(Player[playerid][admin] < 2){
  846.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to set Health");
  847.     }
  848.     new pID,life;
  849.     if(sscanf(params,"ud",pID,life)){
  850.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /sethealth [playerid] [float(0-100!)]*");
  851.     }
  852.     if(!IsPlayerConnected(pID)){
  853.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  854.     }
  855.     if(life < 0){
  856.         return SendClientMessage(playerid,COLOR_RED,"INVALID FLOAT!");
  857.     }
  858.     if(life > 100){
  859.         return SendClientMessage(playerid,COLOR_RED,"INVALID FLOAT!");
  860.     }
  861.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  862.     SetPlayerHealth(pID,life);
  863.     GetPlayerName(playerid,aname,sizeof(aname));
  864.     GetPlayerName(pID,name,sizeof(name));
  865.     format(string,sizeof(string),"You have set the Health of %s to %d",name,life);
  866.     format(string2,sizeof(string2),"Admin %s has set your Health to %d",aname,life);
  867.     SendClientMessage(playerid,COLOR_GREEN,string);
  868.     SendClientMessage(pID,COLOR_GREEN,string2);
  869.     return 1;
  870. }
  871. dcmd_takeweaps(playerid,params[])
  872. {
  873.     new
  874.         Reason[256],
  875.         pID;
  876.     if(Player[playerid][admin] < 1){
  877.         return SendClientMessage(playerid,COLOR_RED,"You must be a Moderator or higher to take weapons away");
  878.         }
  879.     if(sscanf(params,"us",pID,Reason)){
  880.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /takeweaps [playerid] [reason]");
  881.         }
  882.     if(!IsPlayerConnected(pID)) {
  883.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  884.         }
  885.     new
  886.             name[MAX_PLAYER_NAME],
  887.             string[256];
  888.     GetPlayerName(pID,name,sizeof(name));
  889.     new
  890.             Aname[MAX_PLAYER_NAME],string2[256];
  891.     GetPlayerName(playerid,Aname,sizeof(Aname));
  892.     format(string,sizeof(string),"Admin %s has taken your weapons with the reason: %s",Aname,Reason);
  893.     format(string2,sizeof(string2),"You have taken the weapons of %s with the reason: %s",name,Reason);
  894.     SendClientMessage(pID,COLOR_GREEN,string);
  895.     ResetPlayerWeapons(pID);
  896.     return 1;
  897. }
  898. dcmd_changeweather(playerid,params[])
  899. {
  900.     if(Player[playerid][admin] < 2){
  901.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to change Weather");
  902.     }
  903.     new wetter;
  904.     if(sscanf(params,"d",wetter)){
  905.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /setweather [WeatherID]");
  906.     }
  907.     new string2[128],aname[MAX_PLAYER_NAME];
  908.     SetWeather(wetter);
  909.     GetPlayerName(playerid,aname,sizeof(aname));
  910.     format(string2,sizeof(string2),"Admin %s has set the weather ID to %d",aname,wetter);
  911.     SendClientMessageToAll(COLOR_GREEN,string2);
  912.     return 1;
  913. }
  914. dcmd_sethour(playerid,params[])
  915. {
  916.     if(Player[playerid][admin] < 2){
  917.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to change time");
  918.     }
  919.     new hour;
  920.     if(sscanf(params,"d",hour)){
  921.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /sethour [hour]");
  922.     }
  923.     if(hour < 0){
  924.         return SendClientMessage(playerid,COLOR_RED,"INVALID HOUR![0-24]");
  925.     }
  926.     if(hour > 24){
  927.         return SendClientMessage(playerid,COLOR_RED,"INVALID HOUR![0-24]");
  928.     }
  929.     new string2[128],aname[MAX_PLAYER_NAME];
  930.     SetWorldTime(hour);
  931.     GetPlayerName(playerid,aname,sizeof(aname));
  932.     format(string2,sizeof(string2),"Admin %s has set the time to %d",aname,hour);
  933.     SendClientMessageToAll(COLOR_GREEN,string2);
  934.     return 1;
  935. }
  936. dcmd_veh(playerid,params[])
  937. {
  938.     if(Player[playerid][admin] < 3){
  939.         return SendClientMessage (playerid,COLOR_RED,"You must be a SuperAdmin or higher to spawn cars");
  940.     }
  941.     new veh,color1,color2;
  942.     if(sscanf(params,"ddd",veh,color1,color2)){
  943.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /veh [vehicleID] [color1] [color2]");
  944.     }
  945.     if(veh < 400){
  946.         return SendClientMessage(playerid,COLOR_RED,"INVALID vehID![400-611]");
  947.     }
  948.     if(veh > 611){
  949.         return SendClientMessage(playerid,COLOR_RED,"INVALID vehID![400-611]");
  950.     }
  951.     if(color1 < 0){
  952.         return SendClientMessage(playerid,COLOR_RED,"INVALID color1ID![0-126]");
  953.     }
  954.     if(color1 > 126){
  955.         return SendClientMessage(playerid,COLOR_RED,"INVALID color1ID![0-126]");
  956.     }
  957.     if(color2 < 0){
  958.         return SendClientMessage(playerid,COLOR_RED,"INVALID color2ID![0-126]");
  959.     }
  960.     if(color2 > 126){
  961.         return SendClientMessage(playerid,COLOR_RED,"INVALID color2ID![0-126]");
  962.     }
  963.     new Float:x , Float:y , Float: z;
  964.     GetPlayerPos(playerid,x,y,z);
  965.     CreateVehicle(veh, x, y, z, 0, color1, color2, 123456789);
  966.     return 1;
  967. }
  968. dcmd_seecash(playerid,params[])
  969. {
  970.     if(Player[playerid][admin] < 1){
  971.         return SendClientMessage(playerid,COLOR_RED,"You must be a Moderator or higher for this CMD");
  972.     }
  973.     new pID;
  974.     if(sscanf(params,"u",pID)){
  975.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /seecash [playerid]");
  976.         }
  977.     if(!IsPlayerConnected(pID)) {
  978.     return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  979.         }
  980.     new
  981.     name[MAX_PLAYER_NAME],
  982.     string2[256];
  983.     GetPlayerName(pID,name,sizeof(name));
  984.     format(string2, sizeof(string2), "[Cash of %s] : %d $",name,GetPlayerMoney(pID));
  985.     SendClientMessage(playerid,COLOR_GREEN,string2);
  986.     return 1;
  987. }
  988. dcmd_setcash(playerid,params[])
  989. {
  990.     if(Player[playerid][admin] < 3){
  991.         return SendClientMessage (playerid,COLOR_RED,"You must be a SuperAdmin or a ServerOwner to set money");
  992.     }
  993.     new pID,cash;
  994.     if(sscanf(params,"ud",pID,cash)){
  995.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /setcash [playerid] [amount]");
  996.     }
  997.     if(!IsPlayerConnected(pID)){
  998.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  999.     }
  1000.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  1001.     SetPlayerMoney(pID,cash);
  1002.     GetPlayerName(playerid,aname,sizeof(aname));
  1003.     GetPlayerName(pID,name,sizeof(name));
  1004.     format(string,sizeof(string),"You have set the money of %s to %d $",name,cash);
  1005.     format(string2,sizeof(string2),"Admin %s has set your money to %d $",aname,cash);
  1006.     SendClientMessage(playerid,COLOR_GREEN,string);
  1007.     SendClientMessage(pID,COLOR_GREEN,string2);
  1008.     return 1;
  1009. }
  1010. dcmd_setarm(playerid,params[])
  1011. {
  1012.     if(Player[playerid][admin] < 2){
  1013.         return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to set Armour");
  1014.     }
  1015.     new pID,arm;
  1016.     if(sscanf(params,"ud",pID,arm)){
  1017.         return SendClientMessage(playerid,COLOR_RED,"USAGE: /setarm [playerid] [float(0-100!)]*");
  1018.     }
  1019.     if(!IsPlayerConnected(pID)){
  1020.         return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
  1021.     }
  1022.     if(arm < 0){
  1023.         return SendClientMessage(playerid,COLOR_RED,"INVALID FLOAT!");
  1024.     }
  1025.     if(arm > 100){
  1026.         return SendClientMessage(playerid,COLOR_RED,"INVALID FLOAT!");
  1027.     }
  1028.     new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
  1029.     SetPlayerArmour(pID,arm);
  1030.     GetPlayerName(playerid,aname,sizeof(aname));
  1031.     GetPlayerName(pID,name,sizeof(name));
  1032.     format(string,sizeof(string),"You have set the Armour of %s to %d",name,arm);
  1033.     format(string2,sizeof(string2),"Admin %s has set your Armour to %d",aname,arm);
  1034.     SendClientMessage(playerid,COLOR_GREEN,string);
  1035.     SendClientMessage(pID,COLOR_GREEN,string2);
  1036.     return 1;
  1037. }
  1038. //====================================================================================================================
  1039.  
  1040. stock SendAdminMessage(farbe,msg[])
  1041. {
  1042. for(new i = 0; i < MAX_PLAYERS; i++)
  1043. {
  1044. if(Player[i][admin] >= 1)
  1045. {
  1046. SendClientMessage(i,farbe,msg);
  1047. }
  1048. }
  1049. }
  1050. //======================================================================================================================
  1051. //==================================================SCANF CODE ====================================================
  1052. stock sscanf(string[], format[], {Float,_}:...)
  1053. {
  1054.     #if defined isnull
  1055.         if (isnull(string))
  1056.     #else
  1057.         if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  1058.     #endif
  1059.         {
  1060.             return format[0];
  1061.         }
  1062.     #pragma tabsize 4
  1063.     new
  1064.         formatPos = 0,
  1065.         stringPos = 0,
  1066.         paramPos = 2,
  1067.         paramCount = numargs(),
  1068.         delim = ' ';
  1069.     while (string[stringPos] && string[stringPos] <= ' ')
  1070.     {
  1071.         stringPos++;
  1072.     }
  1073.     while (paramPos < paramCount && string[stringPos])
  1074.     {
  1075.         switch (format[formatPos++])
  1076.         {
  1077.             case '\0':
  1078.             {
  1079.                 return 0;
  1080.             }
  1081.             case 'i', 'd':
  1082.             {
  1083.                 new
  1084.                     neg = 1,
  1085.                     num = 0,
  1086.                     ch = string[stringPos];
  1087.                 if (ch == '-')
  1088.                 {
  1089.                     neg = -1;
  1090.                     ch = string[++stringPos];
  1091.                 }
  1092.                 do
  1093.                 {
  1094.                     stringPos++;
  1095.                     if ('0' <= ch <= '9')
  1096.                     {
  1097.                         num = (num * 10) + (ch - '0');
  1098.                     }
  1099.                     else
  1100.                     {
  1101.                         return -1;
  1102.                     }
  1103.                 }
  1104.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  1105.                 setarg(paramPos, 0, num * neg);
  1106.             }
  1107.             case 'h', 'x':
  1108.             {
  1109.                 new
  1110.                     num = 0,
  1111.                     ch = string[stringPos];
  1112.                 do
  1113.                 {
  1114.                     stringPos++;
  1115.                     switch (ch)
  1116.                     {
  1117.                         case 'x', 'X':
  1118.                         {
  1119.                             num = 0;
  1120.                             continue;
  1121.                         }
  1122.                         case '0' .. '9':
  1123.                         {
  1124.                             num = (num << 4) | (ch - '0');
  1125.                         }
  1126.                         case 'a' .. 'f':
  1127.                         {
  1128.                             num = (num << 4) | (ch - ('a' - 10));
  1129.                         }
  1130.                         case 'A' .. 'F':
  1131.                         {
  1132.                             num = (num << 4) | (ch - ('A' - 10));
  1133.                         }
  1134.                         default:
  1135.                         {
  1136.                             return -1;
  1137.                         }
  1138.                     }
  1139.                 }
  1140.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  1141.                 setarg(paramPos, 0, num);
  1142.             }
  1143.             case 'c':
  1144.             {
  1145.                 setarg(paramPos, 0, string[stringPos++]);
  1146.             }
  1147.             case 'f':
  1148.             {
  1149.  
  1150.                 new changestr[16], changepos = 0, strpos = stringPos;
  1151.                 while(changepos < 16 && string[strpos] && string[strpos] != delim)
  1152.                 {
  1153.                     changestr[changepos++] = string[strpos++];
  1154.                     }
  1155.                 changestr[changepos] = '\0';
  1156.                 setarg(paramPos,0,_:floatstr(changestr));
  1157.             }
  1158.             case 'p':
  1159.             {
  1160.                 delim = format[formatPos++];
  1161.                 continue;
  1162.             }
  1163.             case '\'':
  1164.             {
  1165.                 new
  1166.                     end = formatPos - 1,
  1167.                     ch;
  1168.                 while ((ch = format[++end]) && ch != '\'') {}
  1169.                 if (!ch)
  1170.                 {
  1171.                     return -1;
  1172.                 }
  1173.                 format[end] = '\0';
  1174.                 if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  1175.                 {
  1176.                     if (format[end + 1])
  1177.                     {
  1178.                         return -1;
  1179.                     }
  1180.                     return 0;
  1181.                 }
  1182.                 format[end] = '\'';
  1183.                 stringPos = ch + (end - formatPos);
  1184.                 formatPos = end + 1;
  1185.             }
  1186.             case 'u':
  1187.             {
  1188.                 new
  1189.                     end = stringPos - 1,
  1190.                     id = 0,
  1191.                     bool:num = true,
  1192.                     ch;
  1193.                 while ((ch = string[++end]) && ch != delim)
  1194.                 {
  1195.                     if (num)
  1196.                     {
  1197.                         if ('0' <= ch <= '9')
  1198.                         {
  1199.                             id = (id * 10) + (ch - '0');
  1200.                         }
  1201.                         else
  1202.                         {
  1203.                             num = false;
  1204.                         }
  1205.                     }
  1206.                 }
  1207.                 if (num && IsPlayerConnected(id))
  1208.                 {
  1209.                     setarg(paramPos, 0, id);
  1210.                 }
  1211.                 else
  1212.                 {
  1213.                     #if !defined foreach
  1214.                         #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  1215.                         #define __SSCANF_FOREACH__
  1216.                     #endif
  1217.                     string[end] = '\0';
  1218.                     num = false;
  1219.                     new
  1220.                         name[MAX_PLAYER_NAME];
  1221.                     id = end - stringPos;
  1222.                     foreach (Player, playerid)
  1223.                     {
  1224.                         GetPlayerName(playerid, name, sizeof (name));
  1225.                         if (!strcmp(name, string[stringPos], true, id))
  1226.                         {
  1227.                             setarg(paramPos, 0, playerid);
  1228.                             num = true;
  1229.                             break;
  1230.                         }
  1231.                     }
  1232.                     if (!num)
  1233.                     {
  1234.                         setarg(paramPos, 0, INVALID_PLAYER_ID);
  1235.                     }
  1236.                     string[end] = ch;
  1237.                     #if defined __SSCANF_FOREACH__
  1238.                         #undef foreach
  1239.                         #undef __SSCANF_FOREACH__
  1240.                     #endif
  1241.                 }
  1242.                 stringPos = end;
  1243.             }
  1244.             case 's', 'z':
  1245.             {
  1246.                 new
  1247.                     i = 0,
  1248.                     ch;
  1249.                 if (format[formatPos])
  1250.                 {
  1251.                     while ((ch = string[stringPos++]) && ch != delim)
  1252.                     {
  1253.                         setarg(paramPos, i++, ch);
  1254.                     }
  1255.                     if (!i)
  1256.                     {
  1257.                         return -1;
  1258.                     }
  1259.                 }
  1260.                 else
  1261.                 {
  1262.                     while ((ch = string[stringPos++]))
  1263.                     {
  1264.                         setarg(paramPos, i++, ch);
  1265.                     }
  1266.                 }
  1267.                 stringPos--;
  1268.                 setarg(paramPos, i, '\0');
  1269.             }
  1270.             default:
  1271.             {
  1272.                 continue;
  1273.             }
  1274.         }
  1275.         while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  1276.         {
  1277.             stringPos++;
  1278.         }
  1279.         while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  1280.         {
  1281.             stringPos++;
  1282.         }
  1283.         paramPos++;
  1284.     }
  1285.     do
  1286.     {
  1287.         if ((delim = format[formatPos++]) > ' ')
  1288.         {
  1289.             if (delim == '\'')
  1290.             {
  1291.                 while ((delim = format[formatPos++]) && delim != '\'') {}
  1292.             }
  1293.             else if (delim != 'z')
  1294.             {
  1295.                 return delim;
  1296.             }
  1297.         }
  1298.     }
  1299.     while (delim > ' ');
  1300.     return 0;
  1301. }
  1302. //================================================= SCANF CODE END ========================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement