New Admin Command Not WORKING (filterscript) -
flamur2012 - 14.07.2014
So i have this problem when the command doesnt detect me as an admin.
Old CMD
Код:
CMD:ban(playerid,params[])
{
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[playerid][pAdminLevel] >= 2)
{
if(IsPlayerConnected(playerid))
{
new targetid,reason[105],string[256];
if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
format(string, sizeof(string), ""chat""COL_LIGHTBLUE" %s %s has banned %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
SendClientMessageToAll(-1,string);
printf("%s %s has banned %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
pInfo[targetid][pBanned] = 1;
BanPlayer(targetid,reason,GetAdminName(playerid));
}
}
else
{
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
}
}
else if(pInfo[playerid][pLogged] == 0)
{
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!");
printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
Kick(playerid);
}
return 1;
}
New CMD
Код:
COMMAND:ban(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000FF,"This command is only for administrators.");
new PlayerID;
new Days;
new Reason[30];
if(sscanf(params,"iis[30]",PlayerID,Days,Reason)) return SendClientMessage(playerid,0xFF0000FF,"Usage /Ban [Player ID] [Days] [Reason].");
if(!IsPlayerConnected(PlayerID)) return SendClientMessage(playerid,0xFF0000FF,"Player with this ID isnt available.");
if(Days <= 0) return SendClientMessage(playerid,0xFF0000FF,"You entered bad time.");
if(strlen(Reason) <= 0 || strlen(Reason) > 30) return SendClientMessage(playerid,0xFF0000FF,"You must give reason, but not too long, maximally 30 characters.");
new String[300];
TB_BanPlayerByID(PlayerID,Days * 24 * 60 * 60,Reason,playerid);
new PlayerName[30];
GetPlayerName(PlayerID,PlayerName,sizeof(PlayerName));
format(String,sizeof(String),"You banned player %s (ID: %d) at time %s. Reason: %s",PlayerName,PlayerID,TB_ConvertTime(Days * 24 * 60 * 60),Reason);
SendClientMessage(playerid,0xFF0000FF,String);
return 1;
}
So is there anyway i can replace the new cmd with the old one. Everytime i try to use the new cmd /ban even tho im admin it shows me the message "This command is only for administrators."
I really need help on this one maybe some explanations too. Thanks. +1 Rep for the solver <3
Re: New Admin Command Not WORKING (filterscript) -
azzerking - 14.07.2014
[Second Example]
if(!IsPlayerAdmin(playerid)) // You need to be logged into rcon, and is not part of your own custom admin system.
[Change]
if(!IsPlayerAdmin(playerid))
[TO]
if(pInfo[playerid][pAdminLevel] >= 2) // Change level if needed
Hope this helps.
Re : New Admin Command Not WORKING (filterscript) -
ManuelNeuer - 14.07.2014
pawn Код:
COMMAND:ban(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid,0xFF0000FF,"This command is only for administrators."); // Your old CMD was detecting if a player is not RCON admin.
new PlayerID;
new Days;
new Reason[30];
if(sscanf(params,"iis[30]",PlayerID,Days,Reason)) return SendClientMessage(playerid,0xFF0000FF,"Usage /Ban [Player ID] [Days] [Reason].");
if(!IsPlayerConnected(PlayerID)) return SendClientMessage(playerid,0xFF0000FF,"Player with this ID isnt available.");
if(Days <= 0) return SendClientMessage(playerid,0xFF0000FF,"You entered bad time.");
if(strlen(Reason) <= 0 || strlen(Reason) > 30) return SendClientMessage(playerid,0xFF0000FF,"You must give reason, but not too long, maximally 30 characters.");
new String[300];
TB_BanPlayerByID(PlayerID,Days * 24 * 60 * 60,Reason,playerid);
new PlayerName[30];
GetPlayerName(PlayerID,PlayerName,sizeof(PlayerName));
format(String,sizeof(String),"You banned player %s (ID: %d) at time %s. Reason: %s",PlayerName,PlayerID,TB_ConvertTime(Days * 24 * 60 * 60),Reason);
SendClientMessage(playerid,0xFF0000FF,String);
return 1;
}
Re: New Admin Command Not WORKING (filterscript) -
flamur2012 - 14.07.2014
C:\Users\Administrator\Desktop\zma4.pwn(4565) : warning 219: local variable "String" shadows a variable at a preceding level
C:\Users\Administrator\Desktop\zma4.pwn(4566) : error 017: undefined symbol "TB_BanPlayerByID"
C:\Users\Administrator\Desktop\zma4.pwn(4567) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\Users\Administrator\Desktop\zma4.pwn(4569) : error 017: undefined symbol "TB_ConvertTime"
How do i define those to symbols? Im confused
Re: New Admin Command Not WORKING (filterscript) -
flamur2012 - 14.07.2014
HELP... I really need help on this one.