22.05.2016, 11:12
Hello.
I made a command for offline banning (suspension)
But, when i enter the command ingame, it keeps showing UNKNOWN COMMAND.
If i only do /osuspend it shows: [Exact_Name] [Reason]
This is the code:
Can someone help me?
I made a command for offline banning (suspension)
But, when i enter the command ingame, it keeps showing UNKNOWN COMMAND.
If i only do /osuspend it shows: [Exact_Name] [Reason]
This is the code:
pawn Код:
COMMAND:osuspend(playerid, params[])
{
if(!PlayerInfo[playerid][power]) return SendClientError(playerid, CANT_USE_CMD);
if(strcmp(glob_toban,"NoBodY", true))
{
return SendClientError(playerid, "Try again in 1 second!");
}
new iPlayer, eReason[ 128 ];
if( sscanf ( params, "ss", iPlayer, eReason)) return SCP(playerid, "[Exact_Name] [Reason]");
new name[MAX_PLAYER_NAME],query1337[128];
GetPlayerName(playerid, name, sizeof(name));
format(query1337,sizeof(query1337),"SELECT * FROM user WHERE username ='%s'",iPlayer);
mysql_function_query(dbhandle,query1337,true,"","");
new num_rows, num_fields;
cache_get_data(num_rows,num_fields,dbhandle);
if(num_rows==0)
{
SendClientError(playerid, "That account doesn't exist!");
return 1;
}
else
{
if(!IsPlayerConnected(iPlayer))
{
new query[400],query2[400],playerserial[128],string2[128],playerip[32],messaggio[MAX_STRING], string[MAX_STRING];
format(query,sizeof(query),"INSERT INTO suspended (username,reason,bannedby,whendidithappen) VALUES ('%s','%s','%s','%s')",iPlayer,eReason,AnonAdmin(playerid),TimeDate());
mysql_function_query(dbhandle,query,false,"","");
format(messaggio,sizeof(messaggio),"{FF0000}[Admin]{FF6347} %s has offline-suspended %s. Reason: %s",AnonAdmin(playerid),iPlayer,eReason);
format(string,sizeof(string), "4{ OSUSPEND } %s[%d] has offline-suspended %s. Reason: %s %s",AnonAdmin(playerid), playerid, iPlayer, eReason, TimeDate());
format(string2,sizeof(string2),"[OSUSPEND] By %s for %s",AnonAdmin(playerid),eReason);
gpci(playerid,playerserial,sizeof(playerserial));
GetPlayerIp(playerid,playerip,32);
SendMessageToAll(COLOR_RED,messaggio);
iEcho(string);
format(query2,sizeof(query2),"INSERT INTO adminlogs (username,ip,bywho,gpci,wat,whendidithappen) VALUES ('%s','%s','%s','%s','%s','%s')",iPlayer,playerip,AnonAdmin(playerid),playerserial,string2,TimeDate());
mysql_function_query(dbhandle,query2,false,"","");
//AdminDB(PlayerName(iPlayer), string);
}
else
{
SendClientError(playerid, "That player is currently online!");
return 1;
}
}
return 1;
}