I didnt got you but i'v this code also:
Код:
CMD:settemplevel(playerid,params[])
{
if(pInfo[playerid][Admin] > 5 || IsPlayerAdmin(playerid))
{
new player1 = strval(params);
new level = strval(params);
new query[200];
new date,year,month;
if(sscanf(params,"uiiii",player1,level,date,month,year))return DUsage(playerid,"/settemplevel [playerid] [level] [day] [month] [year]");
if(level < 0) return SendClientMessage(playerid,Red,"[ERROR]:- {FFFFFF}Invalid Level");
if(level > 6) return SendClientMessage(playerid,Red,"[ERROR]:- {FFFFFF}Invalid Level");
if(!IsPlayerConnected(player1))return SendClientMessage(playerid,Red,"[ERROR]:- {FFFFFF}Player Not Connected!");
if(pInfo[player1][Admin] == level) return SendClientMessage(playerid,Red,"[ERROR]:- {FFFFFF}Player Already Has That Level");
if(date == 0 || month == 0 || year == 0)
{
if(level > 0) return DError(playerid,"Please Use ADMIN LEVEL as '0' As you have setted either the date or month as 0");
else return DError(playerid,"Please Enter A Correct Date,Month Or Year!");
}
SendCommandToAdmins(playerid,"{FF0000}SETTEMPLEVEL");
//new old_level = pInfo[player1][Admin];
new string[256];
format(string,sizeof(string),"{00FFFF}-> Administrator %s(%d) Has Set Your Admin Level [Level %d]",pName(playerid),playerid,level);
SendClientMessage(player1,White,string);
format(string,sizeof(string),"{00FFFF}-> You Have Set %s's(%d) Admin Level [Level %d]",pName(player1),player1,level);
SendClientMessage(playerid,White,string);
PlayerPlaySound(player1,1057,0.0,0.0,0.0);
if(level > pInfo[player1][Admin])
{
GameTextForPlayer(player1,"~r~~h~Promoted!",7000,3);
}
if(level < pInfo[player1][Admin])
{
GameTextForPlayer(player1,"~r~~h~Demoted!",7000,3);
}
if(level == 0)
{
mysql_format(Con_Handle, query, sizeof(query), "UPDATE Users SET Admin = 0,TempAdmin = 0,TempAdminDay = 0,TempAdminMonth = 0,TempAdminYear = 0 WHERE Name= '%e'",pName(player1));
mysql_tquery(Con_Handle, query);
}
pInfo[player1][Admin] = level;
pInfo[player1][TempAdmin] = 1;
pInfo[player1][TempAdmDay] = date;
pInfo[player1][TempAdmMonth] = month;
pInfo[player1][TempAdmYear] = year;
mysql_format(Con_Handle, query, sizeof(query), "UPDATE Users SET Admin = %d,TempAdmin = 1,TempAdminDay = %d,TempAdminMonth = %d,TempAdminYear = %d WHERE Name= '%e'",level,date,month,year,pName(player1));
mysql_tquery(Con_Handle, query);
return 1;
}
else return LevelMSG(playerid,6);
}
And this
Код:
forward BanTheUser(playerid, name, reason);
public BanTheUser(playerid, name, reason)
{
new query [256];
new Date,Month,Year;
new Hour,Minute,Second;
getdate(Year,Month,Date);
gettime(Hour,Minute,Second);
if(cache_num_rows() == 0) return DError(playerid,"Player does not have an account on data base!");
if(cache_num_rows() == 1)
{
mysql_format(Con_Handle, query, sizeof(query),"UPDATE `Users` SET Banned = 1, BannedReason = '%s',BannedByAdmin = '%s' WHERE Name = '%e'",reason,pName(playerid),name);
mysql_tquery(Con_Handle, query);
}
new string[256];
format(string,sizeof(string),"{FFFFFF}_____________Ban-User: Status: Succesfull_____________\nName: '%s'\nReason: '%s'\n{FF0000}BAN TYPE: Permanent\n{FFFFFF}TIME: %d:%d:%d\nDATE: %d/%d/%d",name,reason,Hour,Minute,Second,Date,Month,Year);
ShowPlayerDialog(playerid,2522,DIALOG_STYLE_MSGBOX,"{FFFFFF}User Banned!",string,"Ok","");
return 0;
}
This help?