Guest User

FS DE ADMINISTRACAO ATUALIZADO

a guest
Mar 12th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.40 KB | None | 0 0
  1. #include a_samp
  2. #include SII
  3. #include zcmd
  4. #include sscanf
  5.  
  6. #define DIALOG_REGISTRO 1
  7. #define DIALOG_LOGAR 2
  8. #define coradm 0x00E87FAA
  9. #define cor1   0x48FF88AA
  10.  
  11. #if defined FILTERSCRIPT
  12.  
  13. public OnFilterScriptInit()
  14. {
  15.     print("\n--------------------------------------");
  16.     print(" a_Admin, Feito Por João Victor");
  17.     print("--------------------------------------\n");
  18.     return 1;
  19. }
  20. #else
  21. #endif
  22.  
  23. new
  24.     texto[10],
  25.     nome[MAX_PLAYER_NAME],
  26.     Str[128],
  27.     ip[16],
  28.     id,
  29.     grana,
  30.     score,
  31.     score1,
  32.     skin;
  33.  
  34. new gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
  35.  
  36. enum pInfo
  37. {
  38.     pSenha,
  39.     pScore,
  40.     pDinheiro,
  41.     pAdmin
  42. }
  43.  
  44. new PlayerInfo[MAX_PLAYERS][pInfo];
  45.  
  46. stock ObterINI(playerid)
  47. {
  48.     new conta[64];
  49.     format(conta,30,"Contas/%s.ini",gPlayerName[playerid]);
  50.     return conta;
  51. }
  52.  
  53. public OnPlayerConnect(playerid)
  54. {
  55.     GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
  56.     if (fexist(ObterINI(playerid))) {
  57.         ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT,"Login","Digite sua senha abaixo para efetuar login.","logar","Sair");
  58.     }
  59.     else {
  60.         ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT,"Registrando","Digite sua senha abaixo para registrar uma nova conta.","Registrar","Sair");
  61.     }
  62.     return 1;
  63. }
  64.  
  65. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  66. {
  67.     switch( dialogid ) {
  68.         case DIALOG_REGISTRO:
  69.         {
  70.             if (!response) return Kick(playerid);
  71.             if (response) {
  72.                 if(!strlen(inputtext)) {
  73.                     ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "Registro","Você digitou uma senha inválida.\nDigite sua senha abaixo para registrar uma nova conta.","Registro","Sair");
  74.                 }
  75.  
  76.                 if(INI_Open(ObterINI(playerid))) {
  77.                     INI_WriteString("Senha",inputtext);
  78.                     INI_WriteInt("Score",1);
  79.                     INI_WriteInt("Dinheiro",5000);
  80.                     INI_WriteInt("Admin",0);
  81.                     INI_Save();
  82.                     INI_Close();
  83.                     ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT,"Logar","Digite sua senha abaixo para efetuar login:","Logar","Sair");
  84.                 }
  85.             }
  86.         }
  87.         case DIALOG_LOGAR:
  88.         {
  89.             if ( !response ) return Kick ( playerid );
  90.             if( response ) {
  91.                 if(!strlen(inputtext)) {
  92.                     ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT, "Logar","Você digitou uma senha inválida.\nDigite sua senha abaixo para efetuar login:","Logar","Sair");
  93.                 }
  94.  
  95.                 if(INI_Open(ObterINI(playerid))) {
  96.                     INI_ReadString(PlayerInfo[playerid][pSenha],"Senha",20);
  97.  
  98.                     if(strcmp(inputtext,PlayerInfo[playerid][pSenha],false)) {
  99.                         ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT, "Logar","Você digitou uma senha incorreta.\nDigite sua senha abaixo para efetuar login:","Logar","Sair");
  100.                     }
  101.  
  102.                     SetPlayerScore(playerid, INI_ReadInt("Score" ) );
  103.                     ResetPlayerMoney(playerid);
  104.                     GivePlayerMoney(playerid, INI_ReadInt( "Dinheiro" ));
  105.                     PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
  106.                     INI_Close();
  107.                     SpawnPlayer(playerid);
  108.                 }
  109.             }
  110.         }
  111.     }
  112.     return 1;
  113. }
  114.  
  115. public OnPlayerDisconnect(playerid, reason)
  116. {
  117.     if(INI_Open(ObterINI(playerid))) {
  118.  
  119.         INI_WriteInt("Score",PlayerInfo[playerid][pScore]);
  120.         INI_WriteInt("Dinheiro",GetPlayerMoney(playerid));
  121.         INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
  122.         INI_Save();
  123.         INI_Close();
  124.     }
  125.     return 1;
  126. }
  127.  
  128. CMD:kick(playerid,params[])
  129. {
  130.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  131.     if(sscanf(params, "us",id,texto)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/kick [id] [motivo]");
  132.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  133.     SendClientMessage(id,cor1,"Você foi kickado,volte no servidor e não cometa o mesmo erro.");
  134.     Kick(id);
  135.     ResetPlayerWeapons(id);
  136.     ResetPlayerMoney(id);
  137.     GetPlayerName(id,nome,sizeof(nome));
  138.     format(Str, sizeof(Str), "Info: {FFFFFF}%s foi kickado [ Motivo: %s ].",nome,texto);
  139.     SendClientMessageToAll(cor1,Str);
  140.     return 1;
  141. }
  142.  
  143. CMD:ban(playerid,params[])
  144. {
  145.     if(PlayerInfo[playerid][pAdmin] >= 1)  return SendClientMessage(playerid,coradm,"Você não é administrador.");
  146.     if(sscanf(params, "us",id,texto)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/ban [id] [motivo]");
  147.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  148.     SendClientMessage(id,cor1,"Você foi banido, se for inocente relate no forum.");
  149.     Ban(id);
  150.     ResetPlayerWeapons(id);
  151.     ResetPlayerMoney(id);
  152.     GetPlayerName(id,nome,sizeof(nome));
  153.     format(Str, sizeof(Str), "Info: {FFFFFF}%s foi banido [ Motivo: %s ].",nome,texto);
  154.     SendClientMessageToAll(cor1,Str);
  155.     return 1;
  156. }
  157.  
  158. CMD:aviso(playerid,params[])
  159. {
  160.     if(PlayerInfo[playerid][pAdmin] >= 1)  return SendClientMessage(playerid,coradm,"Você não é administrador.");
  161.     if(sscanf(params, "us",id,texto)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/aviso [id] [motivo]");
  162.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  163.     GetPlayerName(id,nome,sizeof(nome));
  164.     GameTextForPlayer(id,"AVISO",1500,1);
  165.     format(Str, sizeof(Str), "Aviso: %s [ Motivo: %s ]",nome,texto);
  166.     SendClientMessageToAll(cor1,Str);
  167.     return 1;
  168. }
  169.  
  170. CMD:an(playerid,params[])
  171. {
  172.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  173.     if(sscanf(params, "us",id,texto)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/an [texto]");
  174.     GetPlayerName(playerid,nome,sizeof(nome));
  175.     format(Str, sizeof(Str), "Administrador: %s || s% ||",nome,texto);
  176.     SendClientMessageToAll(cor1,Str);
  177.     return 1;
  178. }
  179.  
  180. CMD:congelar(playerid,params[])
  181. {
  182.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  183.     if(sscanf(params, "u",id)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/congelar [id]");
  184.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  185.     TogglePlayerControllable(id,0);
  186.     SendClientMessage(playerid,coradm,"Você foi congelado.");
  187.     return 1;
  188. }
  189.  
  190. CMD:descongelar(playerid,params[])
  191. {
  192.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  193.     if(sscanf(params, "u",id)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/descongelar [id]");
  194.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  195.     TogglePlayerControllable(id,1);
  196.     SendClientMessage(playerid,coradm,"Você foi descongelado.");
  197.     return 1;
  198. }
  199.  
  200. CMD:ejetar(playerid,params[])
  201. {
  202.     if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  203.     if(sscanf(params, "u",id)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/ejetar [id]");
  204.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  205.     RemovePlayerFromVehicle(id);
  206.     SendClientMessage(playerid,cor1,"Você foi ejetado de seu veiculo.");
  207.     return 1;
  208. }
  209.  
  210. CMD:ip(playerid,params[])
  211. {
  212.     if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  213.     if(sscanf(params, "u",id)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/ip [id]");
  214.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  215.     GetPlayerIp(id,ip,sizeof(ip));
  216.     GetPlayerName(id,nome,sizeof(nome));
  217.     format(Str, sizeof(Str), "iP: %s || d% ||",nome,ip);
  218.     SendClientMessage(playerid,cor1,Str);
  219.     return 1;
  220. }
  221.  
  222. CMD:ir(playerid,params[])
  223. {
  224.     if(PlayerInfo[playerid][pAdmin] >= 1)return SendClientMessage(playerid,coradm,"Você não é administrador.");
  225.     if(sscanf(params, "u",id)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/ir [id]");
  226.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  227.     new Float:x,Float:y,Float:z;
  228.     GetPlayerPos(id, x, y, z);
  229.     SetPlayerPos(playerid,x,y+2, z);
  230.     GetPlayerName(id,nome,sizeof(nome));
  231.     format(Str, sizeof(Str), "Admin [ %s ] se teleportou até você.",nome);
  232.     SendClientMessage(id,cor1,Str);
  233.     return 1;
  234. }
  235.  
  236. CMD:trazer(playerid,params[])
  237. {
  238.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  239.     if(sscanf(params, "u",id)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/trazer [id]");
  240.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  241.     new Float:x,Float:y,Float:z;
  242.     GetPlayerPos(playerid, x, y, z);
  243.     SetPlayerPos(id,x,y+2, z);
  244.     GetPlayerName(id,nome,sizeof(nome));
  245.     format(Str, sizeof(Str), "Admin [ %s ] se levou você até ele.",nome);
  246.     SendClientMessage(id,cor1,Str);
  247.     return 1;
  248. }
  249.  
  250. CMD:setskin(playerid,params[])
  251. {
  252.     if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  253.     if(sscanf(params, "iu",id,skin)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/darskin [id] [skinid]");
  254.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  255.     if(skin > 299 || skin < 1) return SendClientMessage(playerid, 0xFF0000FF, "ERRO: ID inválido!");
  256.     SetPlayerSkin(id,skin);
  257.     GetPlayerName(id,nome,sizeof(nome));
  258.     format(Str, sizeof(Str), "Você deu para o player %s a skin de id: d% ",nome,skin);
  259.     SendClientMessage(playerid,cor1,Str);
  260.     return 1;
  261. }
  262.  
  263. CMD:dargrana(playerid,params[])
  264. {
  265.     if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  266.     if(sscanf(params, "iu",id,grana)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/dargrana [id] [grana]");
  267.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  268.     if(grana > 40000 || grana < 1) return SendClientMessage(playerid, 0xFF0000FF, "ERRO: Quantidade inválida. Max: 40000");
  269.     GivePlayerMoney(id,grana);
  270.     GetPlayerName(id,nome,sizeof(nome));
  271.     format(Str, sizeof(Str), "Você deu %d para o player %s ",grana,nome);
  272.     SendClientMessage(playerid,cor1,Str);
  273.     return 1;
  274. }
  275.  
  276. CMD:darscore(playerid,params[])
  277. {
  278.     if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  279.     if(sscanf(params, "iu",id,score1)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/darscore [id] [score]");
  280.     if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este playerid não está conectado.");
  281.     if(grana > 400 || grana < 1) return SendClientMessage(playerid, 0xFF0000FF, "ERRO: Quantidade inválida. Max: 400");
  282.     score = GetPlayerScore(id);
  283.     SetPlayerScore(id,score+score1);
  284.     GetPlayerName(id,nome,sizeof(nome));
  285.     format(Str, sizeof(Str), "Você deu %d scores para o player %s ",score1,nome);
  286.     SendClientMessage(playerid,cor1,Str);
  287.     return 1;
  288. }
  289.  
  290. CMD:daradmin(playerid,params[])
  291. {
  292.     if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid,coradm,"Você não é administrador lvl2.");
  293.     new lvl[50];
  294.     if(sscanf(params, "iu",id,lvl)) return SendClientMessage(playerid,coradm,"Use: {FFFFFF}/daradmin [id] [lvl(1a2)]");
  295.     if(INI_Open(ObterINI(id)))
  296.     {
  297.         INI_WriteString("Admin",lvl);
  298.     }
  299.     return 1;
  300. }
  301.  
  302. CMD:aa(playerid)
  303. {
  304.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,coradm,"Você não é administrador.");
  305.     ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{0F64A5}Ajuda  Admin","{9BABB7}/kick(lvl1), /ban(lvl1), /ir(lvl1), /trazer(lvl1), /ip\n/darscore(lvl2), /dargrana(lvl2), /setskin(lvl2), /daradmin(lvl2), /ejetar(lvl2), /congelar(lvl1)\n/descongelar(lvl1), /an(lvl1), /aviso(lvl1)","Ok","Fechar");
  306.     return 1;
  307. }
Advertisement
Add Comment
Please, Sign In to add comment