Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Local variables */
- local PlayerRCON = array(getPlayerSlots(), false);
- local rconpassword;
- /* Functions */
- function OnPlayerConnect(playerid)
- {
- PlayerRCON[playerid] = false;
- return 1;
- }
- function OnScriptInit()
- {
- local config = getConfig();
- if(config.rawin("rconpassword")) foreach(i, message in config.rconpassword) rconpassword = message;
- log("\nScript by Stuneris loaded!\n");
- return 1;
- }
- function OnPlayerCommandText(playerid, commandtext)
- {
- if(commandtext == "/login")
- {
- if(!IsPlayerAdmin(playerid))
- {
- local pass = command.slice(12);
- if(pass == rconpassword)
- {
- PlayerRCON[playerid] = true;
- sendPlayerMessage(playerid, "Slaptažodis teisingas, sėkmingai prisijungėte į administratoriaus statusą.", GREEN);
- }
- else
- {
- sendPlayerMessage(playerid, "Slaptažodis neteisingas!", RED);
- }
- }
- }
- if(commandtext == "/a")
- {
- if(IsPlayerAdmin(playerid))
- {
- if(cmd.len() < 3) return 0;
- local text = command.slice(10);
- sendMessageToAll("[ADMIN] " + getPlayerName(playerid) + ": " + text, GREEN);
- }
- }
- if(commandtext == "/kick")
- {
- if(IsPlayerAdmin(playerid))
- {
- local player = cmd[2].tointeger();
- if(!isPlayerConnected(player)) return 1;
- kickPlayer(player, true);
- sendMessageToAll("[KICK]: " + getPlayerName(player) + " IP: " + getPlayerIp(player), RED);
- }
- }
- if(commandtext == "/ban")
- {
- if(IsPlayerAdmin(playerid))
- {
- local player = cmd[2].tointeger();
- if(!isPlayerConnected(player)) return 1;
- banPlayer(player, 0);
- sendMessageToAll("[BAN]: " + getPlayerName(player) + " IP: " + getPlayerIp(player), RED);
- }
- }
- return 0;
- }
- function IsPlayerAdmin(playerid)
- {
- if(PlayerRCON[playerid] == true) return true;
- return false;
- }
- /* Add Events */
- addEvent("playerCommandText", OnPlayerCommandText);
- addEvent("scriptInit", OnScriptInit);
- addEvent("playerConnect", OnPlayerConnect);
Advertisement
Add Comment
Please, Sign In to add comment