SA-MP Forums Archive
Set myself admin on my own server - 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: Set myself admin on my own server (/showthread.php?tid=614213)



Set myself admin on my own server - xIs0BiHx - 05.08.2016

Hey, finally got my server to run but can't set myself an admin, even if I log into rcon. There are no userfiles getting saved and I can't find them in my mysql database aswell, it's all poorly set up with the mysql database and I'm just looking forward to furnish a little on that RP server.

Could someone make this command public for me? Like, anyone can type it and make someone/himself an admin.

Код:
COMMAND:makeadmin(playerid, params[])
{
	if(GetPVarInt(playerid, "Admin") < 9) return nal(playerid);
	new id, lvl, str[128];
	if(sscanf(params, "ud", id, lvl)) return usage(playerid, "/makeadmin [Player] [Level]");
	if(GetPVarInt(playerid, "Admin") < GetPVarInt(id, "Admin")) return nal(playerid);
	if(GetPVarInt(playerid, "Admin") < lvl) return nal(playerid);
	if(lvl < 0 || lvl > 10) return error(playerid, "Invalid admin lvl.");
	SetPVarInt(id, "Admin", lvl);
	format(str, sizeof(str), "You have set (%s) to admin level (%d).", PlayerName(id), lvl);
	SCM(playerid, -1, str);
	return 1;
}



Re: Set myself admin on my own server - Stinged - 05.08.2016

Replace this
Код:
if(GetPVarInt(playerid, "Admin") < 9) return nal(playerid);
with this:
Код:
if(!IsPlayerAdmin && GetPVarInt(playerid, "Admin") < 9) return nal(playerid);
Now RCON admins can use that command.


Re: Set myself admin on my own server - xIs0BiHx - 05.08.2016

Error, You have no permission for this command.

Thanks for the quick reply but that didn't fix it. :/


Re: Set myself admin on my own server - JustMe.77 - 05.08.2016

You have to log into RCON to be able to use the command..


Re: Set myself admin on my own server - xIs0BiHx - 05.08.2016

I already said I did.

Quote:
Originally Posted by xIs0BiHx
Посмотреть сообщение
even if I log into rcon.



Re: Set myself admin on my own server - xIs0BiHx - 05.08.2016

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Replace this
Код:
if(GetPVarInt(playerid, "Admin") < 9) return nal(playerid);
with this:
Код:
if(!IsPlayerAdmin && GetPVarInt(playerid, "Admin") < 9) return nal(playerid);
Now RCON admins can use that command.
../gamemodes/Commands.pwn(1184 : error 076: syntax error in the expression, or invalid function call

When I tried to compile the mainscript which is connected with my Commands.pwn


Re: Set myself admin on my own server - xIs0BiHx - 05.08.2016

Tried anything can't fix it myself. Would be a big help if someone could make this makeadmin command public


Re: Set myself admin on my own server - Shinja - 05.08.2016

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Replace this
Код:
if(GetPVarInt(playerid, "Admin") < 9) return nal(playerid);
with this:
Код:
if(!IsPlayerAdmin && GetPVarInt(playerid, "Admin") < 9) return nal(playerid);
Now RCON admins can use that command.
You made a little mistake, IsPlayerAdmin without playerid
PHP код:
if(!IsPlayerAdmin(playerid) && GetPVarInt(playerid"Admin") < 9) return nal(playerid); 



Re: Set myself admin on my own server - xIs0BiHx - 05.08.2016

Going to try that out right now, thank you


Re: Set myself admin on my own server - Stinged - 05.08.2016

Quote:
Originally Posted by Shinja
Посмотреть сообщение
You made a little mistake, IsPlayerAdmin without playerid
PHP код:
if(!IsPlayerAdmin(playerid) && GetPVarInt(playerid"Admin") < 9) return nal(playerid); 
Sorry, I was on my phone.