Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BytePass v1.2 PRECISA DE ZCMD + DOF2 || CRIE A PASTA BytePass EM scriptfiles
- #include a_samp
- #include zcmd
- #include DOF2
- //include sscanf
- stock sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- while (paramPos < paramCount && string[stringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = string[stringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = string[++stringPos];
- }
- do
- {
- stringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- stringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- new changestr[16], changepos = 0, strpos = stringPos;
- while(changepos < 16 && string[strpos] && string[strpos] != delim)
- {
- changestr[changepos++] = string[strpos++];
- }
- changestr[changepos] = '\0';
- setarg(paramPos,0,_:floatstr(changestr));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = string[stringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- stringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
- #define cor1 0xFFE12525
- #define cor2 0xFF2538E1
- #define cor3 0xFF28E125
- #define cor4 0xFFDEE125
- #define cor5 0xFFE17D25
- #define cor6 0xFFDE25E1
- #define cor7 0xFF9325E1
- #define cor8 0xFF2E8F2F
- //ADMINISTRAÇÃO DE SENHAS, VIA RCON
- CMD:editarsenha(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,cor3,"Você não está logado na RCON.");
- new senha,senhac;
- if(sscanf(params, "dd",senha,senhac)) return SendClientMessage(playerid,cor3,"Use /editarsenha [lvl-senha1a4] [nova-senha]");
- if(senha >= 5) return SendClientMessage(playerid,cor6,"O sistema é composto por apenas 4 senhas.");
- new file[32];
- format(file,sizeof file,"BytePass/senha.ini");
- new strsenha[64];
- format(strsenha,sizeof strsenha,"Senha%d",senha);
- DOF2_SetInt(file, strsenha, senhac);
- DOF2_SaveFile();
- SendClientMessage(playerid,cor2,"Senha editada com sucesso, para ve-la use /versenhas.");
- return 1;
- }
- CMD:criarsenha(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,cor3,"Você não está logado na RCON.");
- new senha;
- if(sscanf(params, "d",senha)) return SendClientMessage(playerid,cor5,"Use /criarsenha senha[numeros]");
- new file[32];
- format(file,sizeof file,"BytePass/senha.ini");
- if(!DOF2_FileExists(file))
- {
- DOF2_CreateFile(file);
- DOF2_SetInt(file, "Senha1", 0);
- DOF2_SetInt(file, "Senha2", 0);
- DOF2_SetInt(file, "Senha3", 0);
- DOF2_SetInt(file, "Senha4", 0);
- DOF2_SaveFile();
- SendClientMessage(playerid,cor7,"Arquivo criado com sucesso! Agora você pode criar senhas.");
- return 1;
- }
- else
- {
- if(DOF2_GetInt(file, "Senha1") == 0)
- {
- DOF2_SetInt(file, "Senha1", senha);
- DOF2_SaveFile();
- return SendClientMessage(playerid,cor4,"Senha Admin LVL 1 criada com sucesso.");
- }
- else
- {
- if(DOF2_GetInt(file, "Senha2") == 0)
- {
- DOF2_SetInt(file, "Senha2", senha);
- DOF2_SaveFile();
- return SendClientMessage(playerid,cor4,"Senha Admin LVL 2 criada com sucesso.");
- }
- else
- {
- if(DOF2_GetInt(file, "Senha3") == 0)
- {
- DOF2_SetInt(file, "Senha3", senha);
- DOF2_SaveFile();
- return SendClientMessage(playerid,cor4,"Senha Admin LVL 3 criada com sucesso.");
- }
- else
- {
- if(DOF2_GetInt(file, "Senha4") == 0)
- {
- DOF2_SetInt(file, "Senha4", senha);
- DOF2_SaveFile();
- return SendClientMessage(playerid,cor4,"Senha Admin LVL 4 criada com sucesso.");
- }
- else return SendClientMessage(playerid,cor2,"O limite de senhas estourou, use /editarsenha ou /removersenhas para modificar ou criar uma.");
- }
- }
- }
- }
- }
- CMD:versenhas(playerid)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,cor3,"Você não está logado na RCON.");
- new file[32];
- format(file,sizeof file,"BytePass/senha.ini");
- if(!DOF2_FileExists(file)) return SendClientMessage(playerid,cor3,"Arquivo não criado.");
- SendClientMessage(playerid,cor2,"-------------------------------------------------------------------------------------------------");
- new str[128];
- format(str,sizeof str,"ADMIN LVL 1: %d",DOF2_GetInt(file, "Senha1"));
- SendClientMessage(playerid,-1,str);
- format(str,sizeof str,"ADMIN LVL 2: %d",DOF2_GetInt(file, "Senha2"));
- SendClientMessage(playerid,-1,str);
- format(str,sizeof str,"ADMIN LVL 3: %d",DOF2_GetInt(file, "Senha3"));
- SendClientMessage(playerid,-1,str);
- format(str,sizeof str,"ADMIN LVL 4: %d",DOF2_GetInt(file, "Senha4"));
- SendClientMessage(playerid,-1,str);
- SendClientMessage(playerid,cor2,"-------------------------------------------------------------------------------------------------");
- return 1;
- }
- CMD:removersenhas(playerid)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,cor3,"Você não está logado na RCON.");
- new file[32];
- format(file,sizeof file,"BytePass/senha.ini");
- if(!DOF2_FileExists(file)) return SendClientMessage(playerid,cor3,"Arquivo não criado.");
- DOF2_SetInt(file, "Senha1", 0);
- DOF2_SetInt(file, "Senha2", 0);
- DOF2_SetInt(file, "Senha3", 0);
- DOF2_SetInt(file, "Senha4", 0);
- DOF2_SaveFile();
- SendClientMessage(playerid,cor3,"Senhas removidas com sucesso! Use /criarsenha para cria-las novamente.");
- return 1;
- }
- //SISTEMA PARA LOGIN, LEVELS
- new playeradmin[MAX_PLAYERS];
- CMD:login(playerid,params[])
- {
- new senha;
- if(sscanf(params, "d",senha)) return SendClientMessage(playerid,cor3,"Use /login [senha]");
- new file[32];
- new senhacerta;
- format(file,sizeof file,"BytePass/senha.ini");
- if(DOF2_GetInt(file, "Senha1") == senha)
- {
- playeradmin[playerid] = 1;
- senhacerta = 1;
- return SendClientMessage(playerid,cor3,"Logado com sucesso, use /aa para ver os comandos.");
- }
- if(DOF2_GetInt(file, "Senha2") == senha)
- {
- playeradmin[playerid] = 2;
- senhacerta = 1;
- return SendClientMessage(playerid,cor3,"Logado com sucesso, use /aa para ver os comandos.");
- }
- if(DOF2_GetInt(file, "Senha3") == senha)
- {
- playeradmin[playerid] = 3;
- senhacerta = 1;
- return SendClientMessage(playerid,cor3,"Logado com sucesso, use /aa para ver os comandos.");
- }
- if(DOF2_GetInt(file, "Senha4") == senha)
- {
- playeradmin[playerid] = 4;
- senhacerta = 1;
- return SendClientMessage(playerid,cor3,"Logado com sucesso, use /aa para ver os comandos.");
- }
- if(senhacerta == 0) return SendClientMessage(playerid,cor8,"Senha incorreta.");
- senhacerta = 0;
- return 1;
- }
- //AGORA É SÓ COLOCAR SEUS COMANDOS
- // CONFIGURANDO COM AS VARIAVEIS CITADAS:
- /*
- if(playeradmin[playerid] >= LEVEL)
- {
- SUAS FUNÇÕES
- }
- else return SendClientMessage(playerid,cor3,"Você não é um administrador ou não logou-se");
- */
- CMD:kick(playerid,params[])
- {
- if(playeradmin[playerid] >= 1)
- {
- new id,motivo[128];
- if(sscanf(params, "ds",id,motivo)) return SendClientMessage(playerid,cor3,"Use /kick [id] [motivo]");
- new nome[24];
- GetPlayerName(id,nome,sizeof nome);
- new str[128];
- format(str,sizeof str,"AdmCmd: %s foi kickado do servidor. Motivo: %s",nome,motivo);
- SendClientMessageToAll(cor1,str);
- Kick(id);
- }
- else return SendClientMessage(playerid,cor3,"Você não é um administrador ou não logou-se");
- return 1;
- }//NÃO TESTEI ESSE COMANDO, MÁS ACHO QUE FUNCIONA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement