04.04.2013, 21:25
Ok i got a problem with this 2 cmds, i spent like 20 minutes without finding nothing that can "disturb" the cmd.
The first is /banacc, it works good with a problem:
It doesn't show admin name and is always id 0. Code:
2nd is more complex, in addition with no name and id 0, it CRASHES the server after i execute the commands (but the account is unbanned)
Thanks for help guys.
The first is /banacc, it works good with a problem:
Quote:
** Admin (0) banned chucky_jax's account - 05/04/2013 - 01:42:23 |
pawn Код:
CMD:banacc(playerid,params[])
{
if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
if(pInfo[playerid][Admin] >= 5)
{
new id;
new name[128];
new aName[MAX_PLAYER_NAME];
GetPlayerName(id, aName, sizeof(aName));
if(sscanf(params, "s[128]",name)) return SCM(playerid,-1,"{F70505}Usage: {FFFFFF}/banacc <account name>");
if(GetPVarInt(id,"CmdTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait before using this command again.");
new string[250];
new echos[250];
new Year, Month, Day, Hour, Minute, Second;
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
new stringo[90];
new filestring[128];
format(filestring, sizeof(filestring), "/Users/%s.ini", name);
if(!fexist(filestring)) return SCM(playerid,red, "Player account not found.");
else
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "Player's Data");
INI_WriteInt(File, "Banned",1);
INI_Close(File);
format(stringo, sizeof(stringo),"Success! You have banned %s", name);
SCM(playerid, red,stringo);
}
format(string, sizeof(string), "** Admin %s (%d) banned %s's account - %02d/%02d/%02d - %02d:%02d:%02d", aName,id,name,Day,Month,Year,Hour,Minute,Second);
format(echos, sizeof(echos), "1,4** Admin %s (%d) banned %s's account - %02d/%02d/%02d - %02d:%02d:%02d", aName,id,name,Day,Month,Year,Hour,Minute,Second);
SendMessageToAdmins(red,string);
IRC_Say(gGroupID, IRC_CHANNEL, echos);
IRC_Say(gGroupID, IRC_ACHANNEL, echos);
SetPVarInt(id,"CmdTime",GetTickCount()+2000);
AccBanLog(string);
}
return 1;
}
pawn Код:
CMD:unbanacc(playerid,params[])
{
if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
if(pInfo[playerid][Admin] >= 5)
{
new aid;
if(GetPVarInt(aid,"CmdTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait before using this command again.");
new name;
new string[200];
new echos[200];
new Year, Month, Day, Hour, Minute, Second;
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
new aName[MAX_PLAYER_NAME];
GetPlayerName(aid, aName, sizeof(aName));
if(sscanf(params, "s[128]",name)) return SCM(playerid,-1,"{F70505}Usage: {FFFFFF}/unbanacc <account name>");
new stringo[90];
new filestring[128];
format(filestring, sizeof(filestring), "/Users/%s.ini", name);
if(!fexist(filestring)) return SCM(playerid,red, "Player account not found.");
else
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "Player's Data");
INI_WriteInt(File, "Banned",0);
INI_Close(File);
format(stringo, sizeof(stringo),"Success! You have unbanned %s", name);
SCM(playerid, red,stringo);
}
format(string, sizeof(string), "** Admin %s (%d) unbanned %s's account - %02d/%02d/%02d - %02d:%02d:%02d", aName,aid,name,Day,Month,Year,Hour,Minute,Second);
format(echos, sizeof(echos), "1,4** Admin %s (%d) unbanned %s's account - %02d/%02d/%02d - %02d:%02d:%02d", aName,aid,name,Day,Month,Year,Hour,Minute,Second);
SendMessageToAdmins(red,string);
IRC_Say(gGroupID, IRC_CHANNEL, echos);
IRC_Say(gGroupID, IRC_ACHANNEL, echos);
SetPVarInt(aid,"CmdTime",GetTickCount()+2000);
UnBanLog(string);
}
return 1;
}