[Tutorial] Admin Script (y_ini,sscanf,zcmd)
#13

Sorry, I just realised what a dumb idiot I am. It's like I'm not even thinking lol xD. I managed to do it myself (the "else" that I didn't even notice was needing something to be else for (SendClientMessage).

EDIT: Altough, now that I test it, the SendClientMessage works, but the command itself responds with Unknown command.

Here it is:

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 SendClientMessage(playerid, -1,""COL_LIGHTBLUE"Koristi: /promote [ID] [LVL]");
        else
        {
            if(level > 5) return SendClientMessage(playerid, -1,""COL_LIGHTBLUE"Ne smijete ici iznad 5!");
            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
            }
        }
    }
}
There's a warning: 212) : warning 209: function "cmd_promote" should return a value

212 is the last bracket in the code.
Reply


Messages In This Thread
Admin Script (y_ini,sscanf,zcmd) - by HDFord - 04.06.2012, 13:45
Re: Admin Script (y_ini,sscanf,zcmd) - by Spookie98 - 04.06.2012, 14:47
Re: Admin Script (y_ini,sscanf,zcmd) - by mickos - 04.06.2012, 14:53
Re: Admin Script (y_ini,sscanf,zcmd) - by Firo - 04.06.2012, 15:13
Re: Admin Script (y_ini,sscanf,zcmd) - by InfinityCOD - 04.06.2012, 15:17
Re: Admin Script (y_ini,sscanf,zcmd) - by HDFord - 04.06.2012, 16:15
Re: Admin Script (y_ini,sscanf,zcmd) - by [DX]Aru12345 - 17.03.2013, 06:15
Re: Admin Script (y_ini,sscanf,zcmd) - by Ryan_Bowe - 17.03.2013, 14:58
Re: Admin Script (y_ini,sscanf,zcmd) - by lean1337 - 18.03.2013, 15:52
Re: Admin Script (y_ini,sscanf,zcmd) - by Scrillex - 18.03.2013, 16:16
Re: Admin Script (y_ini,sscanf,zcmd) - by Strummer - 16.07.2014, 22:47
Re: Admin Script (y_ini,sscanf,zcmd) - by Jack_Leslie - 16.07.2014, 23:58
Re: Admin Script (y_ini,sscanf,zcmd) - by Strummer - 17.07.2014, 00:01
Re: Admin Script (y_ini,sscanf,zcmd) - by Jack_Leslie - 17.07.2014, 00:11
Re: Admin Script (y_ini,sscanf,zcmd) - by Strummer - 17.07.2014, 00:15
Re: Admin Script (y_ini,sscanf,zcmd) - by canadianclass - 23.09.2014, 16:29
Re: Admin Script (y_ini,sscanf,zcmd) - by Sibuscus - 13.03.2017, 20:50

Forum Jump:


Users browsing this thread: 4 Guest(s)