PHP код:
COMMAND:osuspend(playerid, params[])
{
if(!PlayerInfo[playerid][power]) return SendClientError(playerid, CANT_USE_CMD);
new iPlayer[40], eReason[ 128 ];
if(sscanf(params,"ss", iPlayer, eReason)) return SCP(playerid, "[Exact_Name] [Reason]");
new query3[128];
format(query3,sizeof(query3),"SELECT * FROM user WHERE username ='%s'",iPlayer);
mysql_function_query(dbhandle,query3,true,"OnSuspend","iss",playerid,eReason,iPlayer);
return 1;
}
PHP код:
forward OnSuspend(playerid,eReason,iPlayer);
public OnSuspend(playerid,eReason,iPlayer)
{
// get the cache data and do whatever other needed operations
new num_rows,num_fields;
cache_get_data(num_rows,num_fields,dbhandle);
new query[400],query2[400],string2[128],messaggio[MAX_STRING], string[MAX_STRING],query3[128],temp_ip[32],temp_gpci[100],string6[32],string5[60];
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);
format(query3,sizeof(query3),"SELECT * FROM user WHERE username ='%s'",iPlayer);
mysql_function_query(dbhandle,query3,true,"","");
cache_get_field_content(0, "regip", temp_ip);
format(string6,sizeof(string6),"%s",temp_ip);
cache_get_field_content(0, "reggpci", temp_gpci);
format(string5,sizeof(string5),"%s",temp_gpci);
format(query2,sizeof(query2),"INSERT INTO adminlogs (username,bywho,wat,whendidithappen,ip,gpci) VALUES ('%s','%s','%s','%s','%s','%s')",iPlayer,AnonAdmin(playerid),string2,TimeDate(),string6,string5);
mysql_function_query(dbhandle,query2,false,"","");
SendMessageToAll(COLOR_RED,messaggio);
iEcho(string);
return true;
}
It all does the job good, thanks.
Only 1 thing: iPlayer now gets defined as "Ь" according to my database.