I Need Setlevel CMD That Using zcmd And Sscanf - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I Need Setlevel CMD That Using zcmd And Sscanf (
/showthread.php?tid=564566)
I Need Setlevel CMD That Using zcmd And Sscanf -
dh240473 - 22.02.2015
Help me I Trying To Making Own Administrator System

I Need Setlevel Command And I already done to make register/login
Re: I Need Setlevel CMD That Using zcmd And Sscanf -
CalvinC - 22.02.2015
First, what's your specific problem?
Second, we can't guess how you define "admin", show the enumerator or whatever you use.
Re: I Need Setlevel CMD That Using zcmd And Sscanf -
dh240473 - 22.02.2015
enum Extra
{
Name[MAX_PLAYER_NAME],
Password,
Ip[16],
Regged,
Logged,
Admin,
Vip,
#if EnableTwoRcon == true
MaxRcon,
#endif
Money,
Score,
Skin,
Kills,
Deaths,
Attempts,
}
Re: I Need Setlevel CMD That Using zcmd And Sscanf -
Arastair - 22.02.2015
Quote:
Originally Posted by CalvinC
First, what's your specific problem?
|
He doesn't seem to have any, he is asking for it
Re: I Need Setlevel CMD That Using zcmd And Sscanf -
zork - 22.02.2015
Considering you've this:
PHP код:
new PlayerInfo[MAX_PLAYERS][Extra];
Defines:
PHP код:
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
Command would be:
PHP код:
CMD:setlevel( playerid, cmdtext[] ) {
new targetid,
adminlevel,
string[128],
targetname[MAX_PLAYER_NAME],
playername[MAX_PLAYER_NAME];
GetPlayerName(targetid, targetname, sizeof(targetname));
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][Admin] < 6) // or whatever admin level you want
return SendClientMessage(playerid, COLOR_RED, "SERVER: You can't use this command.");
if(sscanf(cmdtext, "ud", targetid, adminlevel))
return SendClientMessage(playerid, COLOR_RED, "USAGE: /setlevel [playerid] [adminlevel]");
if(PlayerInfo[targetid][Admin] <= adminlevel) {
format(string, sizeof(string), "* You have promoted %s to Admin Level %d.", targetname);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string, "* You have been promoted by %s to Admin Level %d.", playername, adminlevel);
SendClientMessage(targetid, COLOR_YELLOW, string);
}
if(PlayerInfo[targetid][Admin] > adminlevel ) {
format(string, sizeof(string), "You demoted %s to Admin Level %d.", targetname);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "* You have been demoted by %s to Admin Level %d.", playername, adminlevel);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
I haven't tried it out. Please reply if you've any problems.