Making an easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 19.11.2011
Making a easy /setadmin command with a admin commands (zcmd & sscanf)
Hello everyone, in this tutorial i would tell you how to make a simple setadmin command for people that thinks it is hard, you must need zcmd and sscanf to make this work.
On the top under your colors you defined add
pawn Code:
enum pData
{
AdminLevel
};
new PlayerData[MAX_PLAYERS][pData];
new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
With that you have defined AdminLevel so you wouldn't get errors like "AdminLevel not defined."
Now you add this script below
pawn Code:
CMD:setadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly
if(levels > 4) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-4!");//Available levels
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,red,"That user is not connected.");//Detect if the id/partofname is connected
if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
if(levels == 0)
{
format(str, sizeof(str),"%s has your Admin level to %d on the server. *cry *cry",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
PlayerData[ID][AdminLevel] = levels;//this sets the player level
return 1;
}
format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
PlayerData[ID][AdminLevel] = levels;
return 1;
}
Now you guys would be wondering how to change the max admin level so this is what you do, search for
pawn Code:
if(levels > 4) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-4!");//Available levels
Then you change the if(levels >
4) to any number you want, for example if you want 5 do
pawn Code:
if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-5!");//Available levels
Now i will show you how to make a command like /akill (admin killed)
pawn Code:
CMD:akill(playerid,params[])
{
if(PlayerData[playerid][AdminLevel] < 1) return 0;//Edit the number to what admin level + you want to use, i put 1 so only level 2 and higher could use it
if(sscanf(params,"u",ID)) return SendClientMessage(playerid,grey,"USAGE: /akill [playerid / Partofname]");//if player doesnt use the /akill format properly
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,red,"ERROR: That user is not connected!");//checks if player is not connected
GetPlayerName(playerid,Nam,sizeof(Nam));//define playerid name
GetPlayerName(ID,pname,sizeof(pname));//define other person name
format(str,sizeof(str),"Administrator %s has admin killed you",Nam);
SendClientMessage(ID,orange,str);
format(str,sizeof(str),"You have admin killed %s",pname);
SendClientMessage(playerid,orange,str);
SetPlayerHealth(ID,0);
return 1;
}
Includes Download
Sscanf.inc
Zcmd.inc
Plugins Download
sscanf.dll (Windows ONLY!)
sscanf.so (Linux ONLY!)
You could also get all those in 1 winzip/winrar file with the link below
Winzip/Winrar Download
Now if you guys have any question please post below, if this helped you please subscribe me and thank you.
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) - Astralis - 19.11.2011
woah. Nice dude. Goodly explained. And useful. 5/5
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 19.11.2011
Thank you
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Infinity - 19.11.2011
Quote:
Originally Posted by Neonman
woah. Nice dude. Goodly explained. And useful. 5/5
|
Tbh, No. If I would be new to scripting, it would be hard/almost impossible for me to figure out what some of the code is doing.
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Hiddos - 19.11.2011
Quote:
Originally Posted by Neonman
woah. Nice dude. Goodly explained. And useful. 5/5
|
The tutorial is just as goodly and fully as your level of English.
Quote:
Originally Posted by Infinity
Tbh, No. If I would be new to scripting, it would be hard/almost impossible for me to figure out what some of the code is doing.
|
You even understood anything at all 0.o?
This is just a copy-paste tutorial, which you copy-pasted from some other guy's work.
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 19.11.2011
Quote:
Originally Posted by Infinity
Tbh, No. If I would be new to scripting, it would be hard/almost impossible for me to figure out what some of the code is doing.
|
Usually when new scripter joins they would just use ******* first then know a bit and i added // for some of the lines so they could read and know what does it do.
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
nogh445 - 20.11.2011
did everything and this is what I got:
Code:
C:\Users\user\Desktop\SAMP SERVER STUFF\samp server\pawno\FADM.pwn(586) : error 017: undefined symbol "ID"
C:\Users\user\Desktop\SAMP SERVER STUFF\samp server\pawno\FADM.pwn(587) : error 017: undefined symbol "ID"
C:\Users\user\Desktop\SAMP SERVER STUFF\samp server\pawno\FADM.pwn(588) : error 017: undefined symbol "Nam"
C:\Users\user\Desktop\SAMP SERVER STUFF\samp server\pawno\FADM.pwn(588) : error 017: undefined symbol "Nam"
C:\Users\user\Desktop\SAMP SERVER STUFF\samp server\pawno\FADM.pwn(588) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\SAMP SERVER STUFF\samp server\pawno\FADM.pwn(588) : fatal error 107: too many error messages on one line
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 20.11.2011
strange i added new ID near the setadmin. PM your full script to me
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
nogh445 - 20.11.2011
I took out the /akill and it fixed it. I dont really need it.
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
=WoR=G4M3Ov3r - 20.11.2011
...
This is more than funny...
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 20.11.2011
Sorry nogh let me edit that, and wor how is it funny
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
=WoR=G4M3Ov3r - 20.11.2011
https://sampforum.blast.hk/showthread.php?tid=65567
Read this, before posting a tutorial.
+ Nothing here is explained.. You just copy pasted..
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 20.11.2011
i explained it with //
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
-Rebel Son- - 21.11.2011
This may be a setadmin command, and some admin commands, but How does it save the level? How does it load it? How does one know their level?
Explain it more, good thought, but needs more explaining.
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 22.11.2011
Lol rebel i didnt add how to save admin level, i only added /setadmin and a admin command on my title
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
CSSI - 25.11.2011
pawn Code:
format(str,sizeof(str),"Administrator %s has admin killed you",Nam);
format(str,sizeof(str),"You have admin killed %s",pname);
Same Strings for Both?
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 25.11.2011
CSSI when i use /akill it works properly, did you test it?
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
CSSI - 25.11.2011
I mean if you will use same strings for both messages it will send to both players!
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
krystiang1 - 25.11.2011
You should add some links of where to download sscanf and zcmd.
I know its simple just easy to use ******.ca but would make your tutorial better
Re: Making a easy /setadmin command with some admin commands (zcmd & sscanf) -
Tanush123 - 25.11.2011
Quote:
Originally Posted by CSSI
I mean if you will use same strings for both messages it will send to both players!
|
it doesnt happen to me