demote offline player using name[+rep]
#1

How can I demote or promote offline player using a CMD in the server?
For example : /apromote [name] [level].
All my users are saved in scriptfiles/Admin/users
There are .ini files for every user and it contains LEVEL = levelno.
Please help me, thank you!
Reply
#2

Quote:
Originally Posted by maaz
View Post
How can I demote or promote offline player using a CMD in the server?
For example : /apromote [name] [level].
All my users are saved in scriptfiles/Admin/users
There are .ini files for every user and it contains LEVEL = levelno.
Please help me, thank you!
You should try to open his .ini file and them format the string inside and save the file.
You can easily do this in SQL/MySQL but for INI i think that will be tricky to do
Reply
#3

Quote:
Originally Posted by Flamehaze7
View Post
You should try to open his .ini file and them format the string inside and save the file.
You can easily do this in SQL/MySQL but for INI i think that will be tricky to do
if you could help me with it. I would be thankful.
Or anyone else can help me with this?
i use y_ini.
Reply
#4

will this work?
Code:
CMD:osetlvl(playerid,params[])
{
    if(!(PlayerInfo[playerid][Level] >= 6)) return SendClientMessage(playerid, COLOR_LIGHTRED,"You are not authorized to use this command");
    new
		_name[ 24 ],
		_level
	;
	if(sscanf(params, "s[24]d", _name, _level)) return SendClientMessage(playerid, COLOR_LIGHTRED,"Usage: /osetlvl <Name> <level>");
	new
		string[ 32 ]
	;
	format(string,sizeof(string),"Admin/Users/%s.ini",_name);
    if(fexist(string))
    {
        new INI:File = INI_Open(string);
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Level", _level);
        INI_Close(File);
        // I don't really understand that message
    }
    else SendClientMessage(playerid,COLOR_YELLOW,"{FF0000}..::{FF6347}[Database]:Account not found{FF0000}::..");
    return 1;
}
Reply
#5

Quote:
Originally Posted by maaz
View Post
will this work?
Code:
CMD:osetlvl(playerid,params[])
{
    if(!(PlayerInfo[playerid][Level] >= 6)) return SendClientMessage(playerid, COLOR_LIGHTRED,"You are not authorized to use this command");
    new
		_name[ 24 ],
		_level
	;
	if(sscanf(params, "s[24]d", _name, _level)) return SendClientMessage(playerid, COLOR_LIGHTRED,"Usage: /osetlvl <Name> <level>");
	new
		string[ 32 ]
	;
	format(string,sizeof(string),"Admin/Users/%s.ini",_name);
    if(fexist(string))
    {
        new INI:File = INI_Open(string);
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Level", _level);
        INI_Close(File);
        // I don't really understand that message
    }
    else SendClientMessage(playerid,COLOR_YELLOW,"{FF0000}..::{FF6347}[Database]:Account not found{FF0000}::..");
    return 1;
}
Try it and let me know, by checking it, it should work.
Reply
#6

Quote:
Originally Posted by Flamehaze7
View Post
Try it and let me know, by checking it, it should work.
It didn't work. i have no idea why :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)