Advertisement
Guest User

Untitled

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