#define CMD:%1(%2) \ forward cmd_%1(%2); \ public cmd_%1(%2)
#define <zcmd>
CMD:ban(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 2) { new string[128], giveplayerid, reason[64]; if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]) { format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid)); ABroadCast(COLOR_YELLOW,string,2); PlayerInfo[playerid][pBanned] = 1; new ip[32]; GetPlayerIp(playerid,ip,sizeof(ip)); AddBan(ip); Kick(playerid); return 1; } else { new year, month,day; getdate(year, month, day); new playerip[32]; GetPlayerIp(giveplayerid, playerip, sizeof(playerip)); format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year); Log("logs/ban.log", string); format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); SendClientMessageToAllEx(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pBanned] = 1; format(PlayerInfo[giveplayerid][pFlag], 128, ""); new ip[32]; GetPlayerIp(giveplayerid,ip,sizeof(ip)); AddBan(ip); Kick(giveplayerid); return 1; } } } else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified."); return 1; }
CMD:ban(playerid, params[]) { if(playerVariables[playerid][pAdminLevel] >= 1) { new playerBanID, playerBanReason[60]; if(sscanf(params, "us[60]", playerBanID, playerBanReason)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/ban [playerid] [reason]"); if(playerVariables[playerBanID][pAdminLevel] >= playerVariables[playerid][pAdminLevel]) return SendClientMessage(playerid, COLOR_GREY, "You can't ban a higher (or equal) level administrator."); if(playerBanID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated."); new playerIP[32], playerNameBanned[MAX_PLAYER_NAME], aString[384]; // Due to the fact that we'll be dealing with a large query after the ban announcement... GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME); GetPlayerName(playerBanID, playerNameBanned, MAX_PLAYER_NAME); GetPlayerIp(playerBanID, playerIP, sizeof(playerIP)); playerVariables[playerBanID][pBanned] = 1; format(aString, sizeof(aString), "Ban: %s has been banned by %s, reason: %s", playerNameBanned, playerVariables[playerid][pAdminName], playerBanReason); SendClientMessageToAll(COLOR_LIGHTRED, aString); mysql_real_escape_string(aString, aString); adminLog(aString); mysql_real_escape_string(szPlayerName, szPlayerName); mysql_real_escape_string(playerNameBanned, playerNameBanned); format(aString, sizeof(aString), "INSERT INTO bans (playerNameBanned, playerBannedBy, playerBanReason, IPBanned) VALUES('%s', '%s', '%s', '%s')", playerNameBanned, szPlayerName, playerBanReason, playerIP); mysql_query(aString, THREAD_BAN_PLAYER, playerBanID); } return 1; }
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(13) : warning 201: redefinition of constant/macro (symbol "CMD:%1(%2)") C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 029: invalid expression, assumed zero C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 017: undefined symbol "cmd_ban" C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 029: invalid expression, assumed zero C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
CMD:ban(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_SYN, "[Syntax:]{FFFFFF} /ban [playerid] [reason]");
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
{
format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,string,2);
PlayerInfo[playerid][pBanned] = 1;
new ip[32];
GetPlayerIp(playerid,ip,sizeof(ip));
AddBan(ip);
Kick(playerid);
return 1;
}
else
{
new year, month,day;
getdate(year, month, day);
new playerip[32];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
Log("logs/ban.log", string);
format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pBanned] = 1;
format(PlayerInfo[giveplayerid][pFlag], 128, "");
new ip[32];
GetPlayerIp(giveplayerid,ip,sizeof(ip));
AddBan(ip);
Kick(giveplayerid);
return 1;
}
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(13) : warning 201: redefinition of constant/macro (symbol "CMD:%1(%2)") C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 029: invalid expression, assumed zero C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 017: undefined symbol "cmd_ban" C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 029: invalid expression, assumed zero C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Код:
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(13) : warning 201: redefinition of constant/macro (symbol "CMD:%1(%2)") C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 029: invalid expression, assumed zero C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 017: undefined symbol "cmd_ban" C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : error 029: invalid expression, assumed zero C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(556) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |
CMD:ban(playerid, params[])
#define CMD:%1(%2) \
forward cmd_%1(%2); \
public cmd_%1(%2)
Originally Posted by Vic1990
pawn Код:
|
#include <zcmd>
#include <a_samp> #include <zcmd> #include <YSI\y_ini>