13.03.2017, 20:50
I hate it when someone does a tutorial and doesn't fully test it. First of all, your admin command /promote does not save.
needs to be changed to
otherwise it doesn't save. Kush's system already has a save thing for when you disconnect, so there's no need to open or close the file, you just change the variable and it saves when the player disconnects.
In the kick/ban command, there are no timers, so the player getting kicked/banned won't receive the text on his screen. He will only get: Server closed the connection, so add timers. Also for the ban command, you need to redefine the parameters when the player registers/logins because the pBanned won't save.
Sorry for bumping a really old thread, but yeah It's in the useful tutorials sections and the tutorials need to be maintained regularly
Code:
CMD:promote(playerid,params[])
{
new id,level;
if(IsPlayerAdmin(playerid)) //this will check if the player is logged into RCON
{
if(sscanf(params,"ud",id,level) return //add the sendclientmessage usage: /promote name/id level or something "u" checks the if the player wrote a id or name "d" checks what level you wrote
else
{
if(level > 5) return //if the player writes a level thats over 5 he will get a error, write the error here
else
{
new INI:File = INI_Open(UserPath(id));//this is the example used in Kush's tut link above, make it fit in your system, note that i've changed the UserPath(playerid) to UserPath(id) to promote the chosen player not yourself
INI_WriteInt(File,"Admin",level); // writes the admin level in the ini file and makes the player admin.
INI_Close(File); //closes the ini file
}
}
}
else
{
//send a message that the player is not logged in as RCON
}
}
Code:
CMD:promote(playerid,params[])
{
new id,level;
if(IsPlayerAdmin(playerid)) //this will check if the player is logged into RCON
{
if(sscanf(params,"ud",id,level) return //add the sendclientmessage usage: /promote name/id level or something "u" checks the if the player wrote a id or name "d" checks what level you wrote
else
{
if(level > 5) return //if the player writes a level thats over 5 he will get a error, write the error here
else
{
PlayerInfo[id][pAdmin] = level;
}
}
}
else
{
//send a message that the player is not logged in as RCON
}
}
In the kick/ban command, there are no timers, so the player getting kicked/banned won't receive the text on his screen. He will only get: Server closed the connection, so add timers. Also for the ban command, you need to redefine the parameters when the player registers/logins because the pBanned won't save.
Sorry for bumping a really old thread, but yeah It's in the useful tutorials sections and the tutorials need to be maintained regularly

