03.06.2017, 16:41
Bom,eu tenho um filterscript,comando de /votekick,
Porйm queria deixar esse comando sу os players vips poderem abrir votaзгo,mas os outros poderem votar porйm nгo poderгo abrir,acho que entenderгo nй? " pVip "
A outra coisa,quero que esse comando sу seja usado quando meus admins tiverem offline
quando tгo on nгo poder kikar!
Jб tem o sistema porйm nгo funciona!
Grato.
Porйm queria deixar esse comando sу os players vips poderem abrir votaзгo,mas os outros poderem votar porйm nгo poderгo abrir,acho que entenderгo nй? " pVip "
A outra coisa,quero que esse comando sу seja usado quando meus admins tiverem offline
quando tгo on nгo poder kikar!
Jб tem o sistema porйm nгo funciona!
Grato.
Код:
#include <a_samp> //*COLOURS*// #define VERDE 0x21DD00FF #define Vermelho 0xE60000FF #define ADMIN_Vermelho 0xFB0000FF #define AMARELO 0xFFFF00FF #define laranja 0xF97804FF #define LIGHTVermelho 0xFF8080FF #define LightBlue 0x00C2ECFF #define PURPLE 0xB360FDFF #define PLAYER_COLOR 0xFFFFFFFF #define AZUL 0x1229FAFF #define lightgreen 0x38FF06FF #define DARKPINK 0xE100E1FF #define darkgreen 0x008040FF #define ANuNCIO 0x00CACAFB #define COLOR_SYSTEM 0xEFEFF7AA #define NICESKY 0x99FFFFAA #define GRAY 0xCECECEFF #define BRANCO 0xFFFFFFAA #define CYAN 0x00FFFFAA //*OTHER DEFINES*// #define VOTETIME 30000 // change the time to change the amount of time left. #define STRING 255 //#define ADMINSONLINE 1 // Uncomment this if you don't want people to vote while admins are online. //*VARIBALES*// new VoteKick; new Votes; new Voted[MAX_PLAYERS]; new PlayerCount; //*FORWARDS*// forward VoteTimer(giveplayerid); public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Filterscript Criado Por Giacomand"); print(" Filterscript Otimizado / traduzido Por [FeK]Gunner"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerConnect(playerid) { Voted[playerid] = 0; return 1; } public OnPlayerDisconnect(playerid, reason) { Voted[playerid] = 0; return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[128]; new tmp[128]; new idx; new giveplayerid; new giveplayer[MAX_PLAYER_NAME]; new sendername[MAX_PLAYER_NAME]; new string[STRING]; cmd = strtok(cmdtext,idx); if(strcmp(cmd, "/votekick", true) == 0) { for (new i = 0; i < GetMaxPlayers(); i++) { if(IsPlayerConnected(i)) { #if defined ADMINSONLNE if(IsPlayerAdmin(i)) { SendClientMessage(playerid,Vermelho," » Erro Hб Admins Online Para Ajudalo Digite /report [id do xiter / acusado] [motivo]"); return 1; } #endif PlayerCount++; } } if(PlayerCount <= 3) { SendClientMessage(playerid, Vermelho, " » Erro: Deve ter mais de 3 jogadores online para iniciar uma votaзгo kick-"); return 1; } new reason[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, laranja, " » Uso: /votekick [ID/NICK] [MOTIVO]"); SendClientMessage(playerid, laranja, " » Aviso: Irб iniciar um temporizador, que qualquer pessoa pode votar para Kickar o jogador. (30 Seconds)"); return 1; } if(VoteKick == 1) { SendClientMessage(playerid, Vermelho, " » Jб Existe Uma Votaзгo"); return 1; } if(IsPlayerAdmin(playerid)) { SendClientMessage(playerid, Vermelho, " » Vocк Nгo Pode Kickar Um Admin!"); return 1; } giveplayerid = ReturnUser(tmp); if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; while ((idx < length) && ((idx - offset) < (sizeof(reason) - 1))) { reason[idx - offset] = cmdtext[idx]; idx++; } reason[idx - offset] = EOS; if(!strlen(reason)) { SendClientMessage(playerid, laranja, " » Uso: /votekick [ID/NICK] [MOTIVO]"); return 1; } else { format(string, sizeof(string), "[ALERTA]: Jogador %s comeзou um votekick em %s. [Motivo: %s] -%d segundos restantes.", Name(playerid), Name(giveplayerid), reason, VOTETIME / 1000); print(string); SendClientMessageToAll(AMARELO, string); SendClientMessageToAll(AMARELO, " » Se Vocк Quiser Votar Para Que Este Jogador Seja kickado digite /vote"); Votes = 1; SetTimerEx("VoteTimer", VOTETIME, 0, "i", giveplayerid); VoteKick = 1; Voted[playerid] = 1; } } else if(giveplayerid == INVALID_PLAYER_ID) { format(string, sizeof(string), " » %d Estб Ofline.", giveplayerid); SendClientMessage(playerid, Vermelho, string); } return 1; } if(strcmp(cmd, "/vote", true) == 0) { if(Voted[playerid] == 1) { SendClientMessage(playerid, Vermelho, " » Vocк jб votou!"); } else { Voted[playerid] = 1; Votes++; format(string, sizeof(string), "%s votou %d de %d", Name(playerid), Votes, (PlayerCount /= 2)+1); SendClientMessageToAll(AMARELO, string); } return 1; } return 0; } public VoteTimer(giveplayerid) { new string[STRING]; new TempPlayerCount = PlayerCount; TempPlayerCount /= 2; if(Votes > TempPlayerCount) { format(string, sizeof(string), " » %s Foi Kickado Por Escolha Dos Players", Name(giveplayerid)); SendClientMessageToAll(AMARELO, string); Kick(giveplayerid); } else { format(string, sizeof(string), " » %s Nгo Foi Kickado Pois Os Players acharam que ele nгo merecia.", Name(giveplayerid)); SendClientMessageToAll(AMARELO, string); } for(new i = 0; i < GetMaxPlayers(); i++) { Voted[i] = 0; } Votes = 0; VoteKick = 0; return 1; } stock Name(playerid) //By Alex "******" Cole { new plname[24]; GetPlayerName(playerid, plname, sizeof(plname)); return plname; } stock strtok(const string[], &index,seperator=' ') { new length = strlen(string); new offset = index; new result[128]; while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; if ((index < length) && (string[index] == seperator)) { index++; } return result; } stock IsNumeric(const string[]) { for (new i = 0, j = strlen(string); i < j; i++) if (string[i] > '9' || string[i] < '0') return 0; return 1; } ReturnUser(text[], playerid = INVALID_PLAYER_ID) { new pos = 0; while (text[pos] < 0x21) { if (text[pos] == 0) return INVALID_PLAYER_ID; pos++; } new userid = INVALID_PLAYER_ID; if (IsNumeric(text[pos])) { userid = strval(text[pos]); if (userid >=0 && userid < MAX_PLAYERS) { if(!IsPlayerConnected(userid)) userid = INVALID_PLAYER_ID; else return userid; } } new len = strlen(text[pos]); new count = 0; new pname[MAX_PLAYER_NAME]; for (new i = 0; i < GetMaxPlayers(); i++) { if (IsPlayerConnected(i)) { GetPlayerName(i, pname, sizeof (pname)); if (strcmp(pname, text[pos], true, len) == 0) { if (len == strlen(pname)) return i; else { count++; userid = i; } } } } if (count != 1) { if (playerid != INVALID_PLAYER_ID) { if (count) SendClientMessage(playerid, COLOR_SYSTEM, "ERROR: There are multiple users, enter full playername."); else SendClientMessage(playerid, COLOR_SYSTEM, "ERROR: Playername not found."); } userid = INVALID_PLAYER_ID; } return userid; }