13.11.2015, 22:13
Hello, I need a command to arrest someone offline, my script is the South Central Roleplay, it will provide the basis for /ajail and /blacklist
--
Код:
CMD:blacklist(playerid, params[]) { static type[24]; if (PlayerData[playerid][pAdmin] < 3) return SendErrorMessage(playerid, "Vocк nгo tem permissгo para usar esse comando."); if (sscanf(params, "s[24]s[128]", type, params)) { SendSyntaxMessage(playerid, "/blacklist [name] [parameter]"); SendClientMessage(playerid, COLOR_YELLOW, "[NOMES]:{FFFFFF} ban, banip, unbanip"); return 1; } if (!strcmp(type, "ban", true)) { if (!IsValidPlayerName(params)) return SendErrorMessage(playerid, "O nome que vocк entrou nгo estб no formato correto."); foreach (new i : Player) if (!strcmp(PlayerData[i][pUsername], params) || !strcmp(ReturnName(i), params, true)) { KickEx(i); } Blacklist_Add("0.0.0.0", params, PlayerData[playerid][pUsername], "Name Ban (/blacklist)"); SendServerMessage(playerid, "Vpcк baniu \"%s\" com sucesso.", params); SendAdminAlert(COLOR_LIGHTRED, "AdmCmd: %s foi banido \"%s\".", ReturnName(playerid, 0), params); Log_Write("logs/ban_log.txt", "[%s] %s foi banido \"%s\".", ReturnDate(), ReturnName(playerid, 0), params); } else if (!strcmp(type, "banip", true)) { if (!IsAnIP(params)) return SendErrorMessage(playerid, "O endereзo de IP que vocк entrou nгo estб no formato correto."); foreach (new i : Player) if (!strcmp(PlayerData[i][pIP], params)) { KickEx(i); } Blacklist_Add(params, "", PlayerData[playerid][pUsername], "IP Ban (/blacklist)"); SendServerMessage(playerid, "Vocк baniu o IP \"%s\" com sucesso.", params); SendAdminAlert(COLOR_LIGHTRED, "AdmCmd: %s baniu o IP \"%s\".", ReturnName(playerid, 0), params); Log_Write("logs/ban_log.txt", "[%s] %s baniu o IP \"%s\".", ReturnDate(), ReturnName(playerid, 0), params); } else if (!strcmp(type, "unbanip", true)) { if (!IsAnIP(params)) return SendErrorMessage(playerid, "O endereзo de IP que vocк entrou nгo estб no formato correto."); Blacklist_RemoveIP(params); SendServerMessage(playerid, "Vocк desbaniu o IP \"%s\" com sucesso.", params); SendAdminAlert(COLOR_LIGHTRED, "AdmCmd: %s desbaniu o IP \"%s\".", ReturnName(playerid, 0), params); Log_Write("logs/ban_log.txt", "[%s] %s desbaniu o IP \"%s\".", ReturnDate(), ReturnName(playerid, 0), params); } return 1; }
Код:
CMD:ajail(playerid, params[]) { static userid, minutes, reason[128]; if (PlayerData[playerid][pAdmin] < 1 && PlayerData[playerid][pTester] < 1) return SendErrorMessage(playerid, "Vocк nгo tem permissгo para usar esse comando."); if (sscanf(params, "uds[128]", userid, minutes, reason)) return SendSyntaxMessage(playerid, "/ajail [playerid/nome] [minutes] [razгo]"); if (userid == INVALID_PLAYER_ID) return SendErrorMessage(playerid, "Vocк digitou um player invalido."); if (minutes < 1) return SendErrorMessage(playerid, "Vocк nгo pode prender o jogador por 0 menos."); if (minutes > 30 && PlayerData[playerid][pTester] && !PlayerData[playerid][pAdmin]) return SendErrorMessage(playerid, "Supporters nгo podem prender os players por mais de trinta minutos."); ClearAnimations(userid); PlayerTextDrawShow(userid, PlayerData[userid][pTextdraws][70]); SetPlayerPos(userid, 197.6346, 175.3765, 1003.0234); SetPlayerInterior(userid, 3); SetPlayerVirtualWorld(userid, (playerid + 100)); SetPlayerFacingAngle(userid, 0.0); SetCameraBehindPlayer(userid); ResetWeapons(userid); ShowHungerTextdraw(userid, 0); ResetPlayer(userid); PlayerData[userid][pJailTime] = minutes * 60; PlayerData[userid][pPrisoned] = 0; SendAdminAction(playerid, "Vocк prendeu %s por %d minutos (%s).", ReturnName(userid, 0), minutes, reason); SendAdminAction(userid, "%s prendeu vocк por %d minutos (%s).", ReturnName(playerid, 0), minutes, reason); SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s prendeu %s por %d minutos, motivo: %s", PlayerData[playerid][pNameOOC], ReturnName(userid, 0), minutes, reason); Log_Write("logs/jail_log.txt", "[%s] %s prendeu %s por %d minutos, motivo: %s.", ReturnDate(), ReturnName(playerid, 0), ReturnName(userid, 0), minutes, reason); return 1; }