08.07.2010, 13:33
in this filterscript (it'a admin script)
there on player press tap and click any player show pm dialog and send message and there reply command down
i have the best script of this but i need dialog pm i try do that in new filterscript but it's not work there's many errors i copied ondialogrespand ,onplayerclicked and reply command and dosent work please any one can edit it help me
there on player press tap and click any player show pm dialog and send message and there reply command down
Код:
// AdminClick v1.3.2 // by biltong 2010 //This filterscript allows server admins to use common commands like ban or kick at the click of the mouse. //Original SA:MP Post: http://forum.sa-mp.com/index.php?topic=162374.0 <-- ALL releases will be there. /*Copyright © 2010 biltong This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/ #define FILTERSCRIPT #include <a_samp> //#define MAX_PLAYERS 500 //============================================================================== //CONFIG //============================================================================== //#define MAX_PLAYERS 500 //NB!!!!! You MUST uncomment and change the number after MAX_PLAYERS to the amount of players your server has! This script will NOT function if you do not change this! #define LOG_CONNECTS //comment this to stop logging when a player connects. #define LOG_DISCONNECTS //comment this to stop logging when a player disconnects. //#define LOG_PMS //comment this to stop logging PMs between players. (OFF BY DEFAULT) #define LOG_DEATHS //comment this to stop logging deaths. #define LOG_ADMINS //comment this to stop logging when an admin logs in. (RCON ONLY) //============================================================================== new Float:x[MAX_PLAYERS]; new Float:y[MAX_PLAYERS]; new Float:z[MAX_PLAYERS]; new Interior[MAX_PLAYERS]; new Float:RandomJail[3][3] = { {197.35707092285, 173.41456604004, 1002.672668457}, {192.8564453125, 173.4140625, 1002.672668457}, {188.6064453125, 173.4140625, 1002.672668457} }; new File:LogFile; #if defined LOG_PMS new File:PMLogFile; #endif new ClickedPlayer[MAX_PLAYERS]; new Wired[MAX_PLAYERS]; new Godmode[MAX_PLAYERS]; new Jailed[MAX_PLAYERS]; new Spectating[MAX_PLAYERS]; new LastPlayerReceivedFrom[MAX_PLAYERS]; new Cage0[MAX_PLAYERS], Cage1[MAX_PLAYERS], Cage2[MAX_PLAYERS], Cage3[MAX_PLAYERS]; new Caged[MAX_PLAYERS]; new HasPlayerLeftTimer[MAX_PLAYERS]; new HasPlayerDisconnected[MAX_PLAYERS]; forward WriteToLogFile(string[]); forward Unwire(playerid); forward Uncage(playerid); forward HasPlayerLeft(playerid); public OnFilterScriptInit() { print("\n ========================================="); print(" =========AdminClick v1.3.2 loaded!========="); print(" =========================================\n"); new year, month, day, hour, minute, second; gettime(hour, minute, second); getdate(year, month, day); if(!fexist("ACLog.txt")) { LogFile = fopen("ACLog.txt", io_write); WriteToLogFile(""); WriteToLogFile("========================================================"); WriteToLogFile("Log File Created"); WriteToLogFile("========================================================"); WriteToLogFile(""); fclose(LogFile); print("\n[ADMINCLICK] Log file not found, creating...\n"); printf("[ADMINCLICK] Log file created on %02d-%02d-%02d at %02d:%02d:%02d", year, month, day, hour, minute, second); } if(fexist("ACLog.txt")) { WriteToLogFile(""); WriteToLogFile("========================================================"); WriteToLogFile("Log file opened"); WriteToLogFile("========================================================"); WriteToLogFile(""); printf("[ADMINCLICK] Log file opened on %02d-%02d-%02d at %02d:%02d:%02d", year, month, day, hour, minute, second); } for(new i; i < MAX_PLAYERS; i++) { LastPlayerReceivedFrom[i] = -1; } #if defined LOG_PMS if(!fexist("ACLog_PMs.txt")) { PMLogFile = fopen("ACLog_PMs.txt", io_write); WriteToPMLogFile(""); WriteToPMLogFile("========================================================"); WriteToPMLogFile("PM Log File Created"); WriteToPMLogFile("========================================================"); WriteToPMLogFile(""); fclose(PMLogFile); print("\n[ADMINCLICK] PM Log file not found, creating...\n"); printf("[ADMINCLICK] PM Log file created on %02d-%02d-%02d at %02d:%02d:%02d", year, month, day, hour, minute, second); } if(!fexist("ACLog_PMs.txt")) { WriteToPMLogFile(""); WriteToPMLogFile("========================================================"); WriteToPMLogFile("PM Log File Opened"); WriteToPMLogFile("========================================================"); WriteToPMLogFile(""); fclose(PMLogFile); printf("[ADMINCLICK] PM Log file opened on %02d-%02d-%02d at %02d:%02d:%02d", year, month, day, hour, minute, second); } #endif return 1; } public OnPlayerText(playerid, text[]) { if(Wired[playerid] == 1) { SendClientMessage(playerid, 0xFF3333AA, "You are wired and may not speak!"); return 0; } else return 1; } public OnPlayerConnect(playerid) { #if defined LOG_CONNECTS new string[64], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "%s connected.", name); WriteToLogFile(string); #endif HasPlayerDisconnected[playerid] = 0; return 1; } public OnPlayerDisconnect(playerid, reason) { Wired[playerid] = -1; Jailed[playerid] = -1; Godmode[playerid] = -1; ClickedPlayer[playerid] = -1; Spectating[playerid] = -1; #if defined LOG_DISCONNECTS new string[96], name[MAX_PLAYER_NAME], reasons[16]; GetPlayerName(playerid, name, sizeof(name)); switch(reason) { case 0: format(reasons, sizeof(reasons), "(Timeout)"); case 1: format(reasons, sizeof(reasons), "(Left)"); case 2: format(reasons, sizeof(reasons), "(Kicked/banned)"); } format(string, sizeof(string), "%s disconnected. %s", name, reasons); WriteToLogFile(string); #endif HasPlayerDisconnected[playerid] = 1; KillTimer(HasPlayerLeftTimer[playerid]); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new name[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME]; GetPlayerName(ClickedPlayer[playerid], name, sizeof(name)); GetPlayerName(playerid, adminname, sizeof(adminname)); if(dialogid == 0 && response) { if(ClickedPlayer[playerid] == playerid) return SendClientMessage(playerid, 0xFF33AA, "ERROR: You can't PM yourself!"); else { if(!strlen(inputtext)) SendClientMessage(playerid, 0xFF0000AA, "ERROR: Invalid message."); else { new string[128]; format(string, sizeof(string), inputtext); new string2[64], sendername[MAX_PLAYER_NAME], sentname[MAX_PLAYER_NAME], string3[64], gtstring[64]; GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(ClickedPlayer[playerid], sentname, sizeof(sentname)); format(string2, sizeof(string2), "Message sent to %s.", sentname); SendClientMessage(playerid, 0xFFD700AA, string2); format(string3, sizeof(string3), "New PM from %s:", sendername); format(gtstring, sizeof(gtstring), "New ~y~PM ~w~from ~y~%s", sendername); SendClientMessage(ClickedPlayer[playerid], 0xFFD700AA, string3); SendClientMessage(ClickedPlayer[playerid], 0xFFD700AA, string); GameTextForPlayer(ClickedPlayer[playerid], gtstring, 3000, 5); LastPlayerReceivedFrom[ClickedPlayer[playerid]] = playerid; #if defined LOG_PMS new logstring[256]; format(logstring, sizeof(logstring), "%s sent %s a PM: %s", sendername, sentname, string); WriteToPMLogFile(logstring); #endif return 1; } } return 1; } if(dialogid == 1 && response) { switch(listitem) { case 0: ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Personal Message", "Type your message: ", "Send", "Cancel"); case 1: ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "AdminClick - Kick", "Reason? (Optional, just click accept for no reason)", "Accept", "Cancel"); case 2: ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "AdminClick - Ban", "Reason? (Optional, just click accept for no reason)", "Accept", "Cancel"); case 3: { TogglePlayerControllable(ClickedPlayer[playerid], false); new string[128]; format(string, sizeof(string), "Administrator %s has frozen %s.", adminname, name); SendClientMessageToAll(0x0BBF6AA, string); GameTextForPlayer(ClickedPlayer[playerid], "You are ~b~FROZEN~w~!", 2000, 5); return 1; } case 4: { TogglePlayerControllable(ClickedPlayer[playerid], true); new string[128]; format(string, sizeof(string), "Administrator %s has unfrozen %s.", adminname, name); SendClientMessageToAll(0x0BBF6AA, string); GameTextForPlayer(ClickedPlayer[playerid], "You are now ~g~unfrozen~w~.", 2000, 5); return 1; } case 5: { ShowPlayerDialog(ClickedPlayer[playerid], 6, DIALOG_STYLE_INPUT, "AdminClick - Wire", "How long (in minutes) do you want to wire the player for? \nClicking forever will wire the player until you unwire him/her.", "Accept", "Forever"); return 1; } case 6: { if(Wired[ClickedPlayer[playerid]] == 1) { Wired[ClickedPlayer[playerid]] = 0; SendClientMessage(ClickedPlayer[playerid], 0xFF9900AA, "You have been unwired."); GameTextForPlayer(ClickedPlayer[playerid], "You are now ~g~unwired~w~.", 2000, 5); return 1; } else return SendClientMessage(playerid, 0xFF0000AA, "ERROR: That player isn't wired!"); } case 7: { new rand = random(2); GetPlayerPos(ClickedPlayer[playerid], x[ClickedPlayer[playerid]], y[ClickedPlayer[playerid]], z[ClickedPlayer[playerid]]); Interior[ClickedPlayer[playerid]] = GetPlayerInterior(ClickedPlayer[playerid]); Jailed[ClickedPlayer[playerid]] = 1; SetPlayerPos(ClickedPlayer[playerid], RandomJail[rand][0], RandomJail[rand][1], RandomJail[rand][2]); SetPlayerInterior(ClickedPlayer[playerid], 3); ResetPlayerWeapons(ClickedPlayer[playerid]); new string[128]; format(string, sizeof(string), "Administrator %s has jailed %s.",adminname, name); SendClientMessageToAll(0xFF3300AA, string); GameTextForPlayer(ClickedPlayer[playerid], "You have been ~r~JAILED~w~!", 2000, 5); HasPlayerLeftTimer[ClickedPlayer[playerid]] = SetTimerEx("HasPlayerLeft", 1000, true, "i", ClickedPlayer[playerid]); return 1; } case 8: { if(Jailed[ClickedPlayer[playerid]] == 1) { SetPlayerInterior(ClickedPlayer[playerid], 0); SetPlayerPos(ClickedPlayer[playerid], x[ClickedPlayer[playerid]], y[ClickedPlayer[playerid]], z[ClickedPlayer[playerid]]); new string[128]; format(string, sizeof(string), "Administrator %s has unjailed %s", adminname, name); SendClientMessageToAll(0xFF3300AA, string); GameTextForPlayer(ClickedPlayer[playerid], "You have been ~g~set free~w~.", 2000, 5); KillTimer(HasPlayerLeftTimer[ClickedPlayer[playerid]]); return 1; } else SendClientMessage(playerid, 0xFF3300AA, "ERROR: That player isn't jailed!"); return 1; } case 9: { SetPlayerHealth(ClickedPlayer[playerid], 0.0); new string[64], string1[64]; format(string, sizeof(string), "You force-killed %s", name); format(string1, sizeof(string1), "Administrator %s force-killed you.", adminname); SendClientMessage(ClickedPlayer[playerid], 0xFF3300AA, string1); SendClientMessage(playerid, 0xFF3300AA, string); return 1; } case 10: { if(playerid == ClickedPlayer[playerid]) return SendClientMessage(playerid, 0xFF3300AA, "ERROR: You can't spectate yourself!"); TogglePlayerSpectating(playerid, true); PlayerSpectatePlayer(playerid, ClickedPlayer[playerid]); Spectating[playerid] = 1; return 1; } case 11: { SetPlayerHealth(ClickedPlayer[playerid], 0.0); ForceClassSelection(ClickedPlayer[playerid]); new string[64], string2[64]; format(string, sizeof(string), "Administrator %s has forced you to class selection.",adminname); SendClientMessage(ClickedPlayer[playerid], 0xFFFFFFAA, string); format(string2, sizeof(string2), "You forced %s to class selection.", name); SendClientMessage(playerid, 0xFFFFFFAA, string2); return 1; } case 12: { Godmode[ClickedPlayer[playerid]] = 1; SetPlayerHealth(ClickedPlayer[playerid], 10000000.0); new string[64], string2[64]; format(string, sizeof(string), "Administrator %s has given you Godmode!", adminname); SendClientMessage(ClickedPlayer[playerid], 0x33FF33AA, string); format(string, sizeof(string), "You have given %s Godmode!", name); SendClientMessage(playerid, 0x33FF33AA, string2); return 1; } case 13: { if(Godmode[ClickedPlayer[playerid]] == 1) { SetPlayerHealth(ClickedPlayer[playerid], 100.0); Godmode[ClickedPlayer[playerid]] = 1; new string[64], string2[64]; format(string, sizeof(string), "Administrator %s has taken away your Godmode!", adminname); SendClientMessage(ClickedPlayer[playerid], 0xFF3300AA, string); format(string, sizeof(string), "You have taken %s's Godmode away!", name); SendClientMessage(playerid, 0xFF3300AA, string2); return 1; } else return SendClientMessage(playerid, 0xFF3300AA, "ERROR: That player doesn't have godmode!"); } case 14: { ResetPlayerWeapons(ClickedPlayer[playerid]); new string[64], string2[64]; format(string, sizeof(string), "Your weapons were reset by Administrator ~y~%s~w~.",adminname); SendClientMessage(ClickedPlayer[playerid], 0xFF3300AA, string); format(string2, sizeof(string2), "You reset %s's weapons.",name); SendClientMessage(playerid, 0xFF3300AA, string2); return 1; } case 15: { if(IsPlayerInAnyVehicle(ClickedPlayer[playerid])) { SendClientMessage(playerid, 0xFF6600AA, "Player Ejected~w~!"); KickFromVehicle(ClickedPlayer[playerid]); new string[64]; format(string, sizeof(string), "Administrator %s ejected you from your vehicle.", adminname); SendClientMessage(ClickedPlayer[playerid], 0xFF3300AA, string); return 1; } else return SendClientMessage(playerid, 0xFF3300AA, "ERROR: That player is not in a vehicle!"); } case 16: { SetPlayerHealth(ClickedPlayer[playerid], 100.0); new string[64]; format(string, sizeof(string), "Administrator %s has healed you.", adminname); GameTextForPlayer(playerid, "~g~Healed~", 2000, 5); SendClientMessage(ClickedPlayer[playerid], 0x33FF33AA, string); return 1; } case 17: { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); SetPlayerPos(ClickedPlayer[playerid], X+1, Y+1, Z); new string[64]; format(string, sizeof(string), "Administrator %s has teleported you to him/her.", adminname); SendClientMessage(ClickedPlayer[playerid], 0xFFFFFFFF, string); return 1; } case 18: { new Float:X, Float:Y, Float:Z; GetPlayerPos(ClickedPlayer[playerid], X, Y, Z); SetPlayerPos(playerid, X+1, Y+1, Z); GameTextForPlayer(playerid, "~g~Teleported.", 2000, 5); return 1; } case 19: { SetPlayerArmour(ClickedPlayer[playerid], 100.0); new string[64], string2[64]; format(string, sizeof(string), "Administrator %s has given you armour.", adminname); format(string2, sizeof(string2), "You gave %s armour.", name); SendClientMessage(ClickedPlayer[playerid], 0x0BBF6AA, string); SendClientMessage(playerid, 0x0BBF6AA, string2); return 1; } case 20: { ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "AdminClick - Cage", "How long(in minutes) do you want to cage the player for? (Required)", "Accept", "Cancel"); TogglePlayerControllable(playerid, 0); return 1; } case 21: { GetPlayerPos(ClickedPlayer[playerid], x[ClickedPlayer[playerid]], y[ClickedPlayer[playerid]], z[ClickedPlayer[playerid]]); CreateExplosion(x[ClickedPlayer[playerid]], y[ClickedPlayer[playerid]], z[ClickedPlayer[playerid]], 11, 2.0); new string[96]; format(string, sizeof(string), "Administrator %s has exploded you.", adminname); SendClientMessage(ClickedPlayer[playerid], 0xFF3300FF, string); GameTextForPlayer(playerid, "~r~Exploded~w~!", 2000, 5); return 1; } } } if(dialogid == 2 && response) { new reason[128], kickstring[128]; format(reason, sizeof(reason), inputtext); if(!strlen(reason)) { format(kickstring, sizeof(kickstring), "%s has been kicked by %s.", name, adminname); WriteToLogFile(kickstring); } else { format(kickstring, sizeof(kickstring), "%s has been kicked by %s. Reason: %s", name, adminname, reason); WriteToLogFile(kickstring); } SendClientMessageToAll(0xFF3300AA, kickstring); Kick(ClickedPlayer[playerid]); return 1; } if(dialogid == 3 && response) { new reason[128], banstring[128]; format(reason, sizeof(reason), inputtext); if(!strlen(reason)) { new IP[17]; GetPlayerIp(ClickedPlayer[playerid], IP, sizeof(IP)); format(banstring, sizeof(banstring), "%s has been banned by %s.", name, adminname); SendClientMessageToAll(0xFF3300AA, banstring); format(banstring, sizeof(banstring), "%s has been banned by %s. IP: %s", name, adminname, IP); WriteToLogFile(banstring); Ban(ClickedPlayer[playerid]); } else { new IP[17]; GetPlayerIp(ClickedPlayer[playerid], IP, sizeof(IP)); format(banstring, sizeof(banstring), "%s has been banned by %s. Reason: %s", name, adminname, reason); SendClientMessageToAll(0xFF3300AA, banstring); format(banstring, sizeof(banstring), "%s has been banned by %s. Reason: %s IP: IP: %s", name, adminname, reason, IP); WriteToLogFile(banstring); BanEx(ClickedPlayer[playerid], reason); } return 1; } if(dialogid == 4 && response) { if(ClickedPlayer[playerid] == playerid) return SendClientMessage(playerid, 0xFF3300AA, "ERROR: You can't PM yourself!"); else { if(!strlen(inputtext)) SendClientMessage(playerid, 0xFF0000AA, "Invalid message."); else { new string[128]; format(string, sizeof(string), inputtext); new string2[64], sendername[MAX_PLAYER_NAME], sentname[MAX_PLAYER_NAME], string3[64], gtstring[64]; GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(ClickedPlayer[playerid], sentname, sizeof(sentname)); format(string2, sizeof(string2), "Message sent to %s.", sentname); SendClientMessage(playerid, 0xFFD700AA, string2); format(string3, sizeof(string3), "New PM from Administrator %s:", sendername); format(gtstring, sizeof(gtstring), "New ~y~PM ~w~from ~g~Administrator ~y~%s", sendername); SendClientMessage(ClickedPlayer[playerid], 0xFFD700AA, string3); SendClientMessage(ClickedPlayer[playerid], 0xFFD700AA, string); GameTextForPlayer(ClickedPlayer[playerid], gtstring, 3000, 5); LastPlayerReceivedFrom[ClickedPlayer[playerid]] = playerid; #if defined LOG_PMS new logstring[256]; format(logstring, sizeof(logstring), "Administrator %s sent %s a PM: %s", sendername, sentname, string); WriteToPMLogFile(logstring); #endif return 1; } } } if(dialogid == 5) { if(response) { GetPlayerPos(ClickedPlayer[playerid], x[ClickedPlayer[playerid]], y[ClickedPlayer[playerid]], z[ClickedPlayer[playerid]]); Cage0[ClickedPlayer[playerid]] = CreateObject(985, x[ClickedPlayer[playerid]], y[ClickedPlayer[playerid]]+4, z[ClickedPlayer[playerid]], 0.0, 0.0, 0.0); Cage1[ClickedPlayer[playerid]] = CreateObject(985, x[ClickedPlayer[playerid]]+4, y[ClickedPlayer[playerid]], z[ClickedPlayer[playerid]], 0.0, 0.0, 90.0); Cage2[ClickedPlayer[playerid]] = CreateObject(985, x[ClickedPlayer[playerid]]-4, y[ClickedPlayer[playerid]], z[ClickedPlayer[playerid]], 0.0, 0.0, 270.0); Cage3[ClickedPlayer[playerid]] = CreateObject(985, x[ClickedPlayer[playerid]], y[ClickedPlayer[playerid]]-4, z[ClickedPlayer[playerid]], 0.0, 0.0, 180.0); Caged[playerid] = 1; new time = strval(inputtext); SetTimerEx("Uncage", 60000*time, false, "i", playerid); HasPlayerLeftTimer[ClickedPlayer[playerid]] = SetTimerEx("HasPlayerLeft", 1000, true, "i", playerid); TogglePlayerControllable(playerid, 1); new string[128]; format(string, sizeof(string), "Administrator %s has caged %s for %d minutes.", adminname, name, time); return 1; } if(!response) ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "AdminClick - Cage", "How long(in minutes) do you want to cage the player for? (Required)", "Accept", "Cancel"); return 1; } if(dialogid == 6) { if(response) { new time = strval(inputtext); SetTimerEx("Unwire", 60000*time, false, "i", playerid); Wired[ClickedPlayer[playerid]] = 1; new string[128]; format(string, sizeof(string), "Administrator %s has wired %s",adminname, name); SendClientMessageToAll(0xFF9900AA, string); GameTextForPlayer(ClickedPlayer[playerid], "You are ~r~wired~w~!", 2000, 5); new string2[32]; format(string2, sizeof(string2), "You will be unwired in %d minutes.", inputtext); return 1; } if(!response) { Wired[ClickedPlayer[playerid]] = 1; new string[128]; format(string, sizeof(string), "Administrator %s has wired %s",adminname, name); SendClientMessageToAll(0xFF9900AA, string); GameTextForPlayer(ClickedPlayer[playerid], "You are ~r~wired~w~!", 2000, 5); return 1; } } return 1; } public Unwire(playerid) { if(Wired[playerid] == 1) { Wired[playerid] = 0; SendClientMessage(playerid, 0x33FF33FF, "You have been unwired. Be careful next time."); GameTextForPlayer(playerid, "You have been ~g~Unwired~w~!", 2000, 5); } } public Uncage(playerid) { Cage0[playerid] = DestroyObject(Cage0[playerid]); Cage1[playerid] = DestroyObject(Cage1[playerid]); Cage2[playerid] = DestroyObject(Cage2[playerid]); Cage3[playerid] = DestroyObject(Cage3[playerid]); GameTextForPlayer(playerid, "You have been ~g~set free~w~!", 2000, 5); KillTimer(HasPlayerLeftTimer[playerid]); Caged[playerid] = 0; } public HasPlayerLeft(playerid) { if(Jailed[playerid]) { if(!IsPlayerInRangeOfPoint(playerid, 12, 197.35707092285, 173.41456604004, 1002.672668457)) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); printf("Player %s tried to escape from jail, putting him/her back.", name); new rand = random(2); SetPlayerPos(playerid, RandomJail[rand][0], RandomJail[rand][1], RandomJail[rand][2]); SetPlayerInterior(playerid, 3); SendClientMessage(playerid, 0xFF3300FF, "You can't escape from jail!"); } } else if(Caged[playerid]) { if(!IsPlayerInRangeOfPoint(playerid, 4, x[playerid], y[playerid], z[playerid])) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); printf("Player %s tried to escape from his/her cage, putting him/her back.", name); SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]); SetPlayerInterior(playerid, Interior[playerid]); SendClientMessage(playerid, 0xFF3300FF, "You can't escape from your cage!"); } } } public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp("/specoff", cmdtext, false, 9)) { if(IsPlayerAdmin(playerid)) { if(Spectating[playerid] == 1) { TogglePlayerSpectating(playerid, 0); SendClientMessage(playerid, 0xFFFFFFAA, "You stopped spectating."); return 1; } else return SendClientMessage(playerid, 0xFF3300AA, "ERROR: You aren't spectating anyone!"); } return 1; } if(!strcmp("/reply", cmdtext, false, 3)) { if(!HasPlayerDisconnected[LastPlayerReceivedFrom[playerid]]) { if(LastPlayerReceivedFrom[playerid] != -1) { ClickedPlayer[playerid] = LastPlayerReceivedFrom[playerid]; ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Personal message", "Type your message:", "Send", "Cancel"); return 1; } else return SendClientMessage(playerid, 0xFF3300FF, "ERROR: Nobody has sent you a PM yet!"); } else { LastPlayerReceivedFrom[playerid] = -1; SendClientMessage(playerid, 0xFF3300FF, "ERROR: That player has disconnected since he/she sent you a message!"); return 1; } } return 0; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { ClickedPlayer[playerid] = clickedplayerid; if(!IsPlayerAdmin(playerid)) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Personal message", "Type your message: ", "Send", "Cancel"); else { new name[MAX_PLAYER_NAME], string[96]; GetPlayerName(clickedplayerid, name, sizeof(name)); format(string, sizeof(string), "AdminClick - What do you want to do with %s?", name); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, string, "\nPM \nKick \nBan \nFreeze \nUnfreeze \nWire \nUnwire \nJail \nUnjail \nKill \nSpectate \nForce \nGodmode \nGodmode off \nConfiscate guns \nEject \nHeal \nTeleport to me \nGoto \nGive Armour \nCage \nExplode", "Accept", "Cancel"); ClickedPlayer[playerid] = clickedplayerid; } return 1; } public OnPlayerDeath(playerid, killerid, reason) { #if defined LOG_DEATHS new logstring[128], killedname[MAX_PLAYER_NAME]; GetPlayerName(playerid, killedname, sizeof(killedname)); if(killerid != INVALID_PLAYER_ID) { new killername[MAX_PLAYER_NAME]; GetPlayerName(killerid, killername, sizeof(killername)); format(logstring, sizeof(logstring), "DEATH: %s(%d) killed %s(%d). Cause: %d", killedname, playerid, killername, killerid, reason); } else format(logstring, sizeof(logstring), "DEATH: %s(%d) died. Cause: %d", killedname, playerid, reason); WriteToLogFile(logstring); #endif return 1; } public OnRconLoginAttempt(ip[], password[], success) { #if defined LOG_ADMINS new logstring[64]; new IP[17]; format(IP, sizeof(IP), ip); if(success) { for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { new plrip[17]; GetPlayerIp(i, plrip, sizeof(plrip)); if(!strcmp(IP, plrip, false, 17)) { new name[MAX_PLAYER_NAME]; GetPlayerName(i, name, sizeof(name)); format(logstring, sizeof(logstring), "RCON: Player %s(ID %d, IP: %s) logged in.", name, i, IP); } else format(logstring, sizeof(logstring), "RCON: IP %s logged in.", IP); } } WriteToLogFile(logstring); } if(!success) { for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { new plrip[17]; GetPlayerIp(i, plrip, sizeof(plrip)); if(!strcmp(IP, plrip, false, 17)) { new name[MAX_PLAYER_NAME]; GetPlayerName(i, name, sizeof(name)); format(logstring, sizeof(logstring), "RCON: Player %s(ID %d, IP: %s) tried to login as RCON, but failed.", name, i, IP); } else format(logstring, sizeof(logstring), "RCON: IP %s tried to login as RCON, but failed.", IP); } } WriteToLogFile(logstring); } #endif return 1; } public OnFilterScriptExit() { print("\n ========================================="); print(" ========AdminClick v1.3.2 unloaded!========"); print(" =========================================\n"); WriteToLogFile(""); WriteToLogFile("========================================================"); WriteToLogFile("Log file closed"); WriteToLogFile("========================================================"); WriteToLogFile(""); #if defined LOG_PMS WriteToPMLogFile(""); WriteToPMLogFile("========================================================"); WriteToPMLogFile("PM Log file closed"); WriteToPMLogFile("========================================================"); WriteToPMLogFile(""); #endif return 1; } stock KickFromVehicle(playerid) { new Float:posx, Float:posy, Float:posz; GetPlayerPos(playerid, posx, posy, posz); SetPlayerPos(playerid, posx, posy, posz+1); } WriteToLogFile(string[]) { new Hour, Minute, Second, Year, Month, Day; getdate(Year, Month, Day); gettime(Hour, Minute, Second); LogFile = fopen("ACLog.txt", io_append); new logstring[256]; format(logstring, sizeof(logstring), "[%02d-%02d-%02d at %02d:%02d:%02d]%s\r\n", Year, Month, Day, Hour, Minute, Second, string); fwrite(LogFile, logstring); fclose(LogFile); } #if defined LOG_PMS WriteToPMLogFile(string[]) { new Hour, Minute, Second, Year, Month, Day; getdate(Year, Month, Day); gettime(Hour, Minute, Second); PMLogFile = fopen("ACLog_PMs.txt", io_append); new logstring[256]; format(logstring, sizeof(logstring), "[%02d-%02d-%02d at %02d:%02d:%02d]%s\r\n", Year, Month, Day, Hour, Minute, Second, string); fwrite(PMLogFile, logstring); fclose(PMLogFile); } #endif