SA-MP Forums Archive
[HELP] Admin Protection - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Admin Protection (/showthread.php?tid=237909)

Pages: 1 2


[HELP] Admin Protection - kemppis_ - 10.03.2011

I've made menu, /veh <-it's a vehicle menu

Ok, it works PERFECTLY but i wanna protect it, than only admins can use it?

im very happy if someone help me :/


Re: [HELP] Admin Protection - xir - 10.03.2011

Which ini system are you using?


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

Quote:
Originally Posted by xir
Посмотреть сообщение
Which ini system are you using?
Omm, What do you mean?
If you mean User file, i have name.ini in my scriptfiles/users/name.ini


Re: [HELP] Admin Protection - Riddick94 - 10.03.2011

pawn Код:
if(!IsPlayerAdmin(playerid))return false;
Over ShowPlayerDialog.

P.S
false can be changed to SendClientMessage. Then when it'll player and type this command it'll send player a message.


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
pawn Код:
if(!IsPlayerAdmin(playerid))return false;
Over ShowPlayerDialog.

P.S
false can be changed to SendClientMessage. Then when it'll player and type this command it'll send player a message.
i try, thanks


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

If you mean, This way?

Код:
	if(strcmp("/veh", cmdtext, true)==0)
	{
	    if(!IsPlayerAdmin(playerid))return false;
		    {
		    	SendClientMessage(playerid, COLOR_YELLOW, "ADMIN: You are not an admin!");
			}else
			{
				ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Vehicles","1.Elegy\n2.Hotring Racer\n3.Super GT\n4.Bullet\n5.Police LSPD\n6.Firetruck LA","Spawn","Exit");
				return 0;
			}

	}
It doesn't work? if im doing it wrong, fix it pls :S


Re: [HELP] Admin Protection - xir - 10.03.2011

Which ini system you use? Dini, mysql etc..

And the IsPlayerAdmin is for RCON use, do you want players/admins to log in the RCON and use the cmds? I don't recommend that.

But if you use dini, you can do this.

pawn Код:
enum pInfo
{
    AdminLevel,
};
This under OnPlayerDisconnect

pawn Код:
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel]); // saves the admin level
Something like this under your register cmd/dialog

pawn Код:
dini_Create(file); // creates file
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
Then add this to your CMDS

pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 1) return 0; // If player is admin level 1 and above, this command will be executed, otherwise it will return "SERVER: Unknown command.
But afterall it is you who decide if it should be rcon or this.


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

Xir:

i didn't understand :/

What do you mean Dini etc..
how can i see that?


Re: [HELP] Admin Protection - xir - 10.03.2011

Dini is an ini system which can save stats.

Here is the download link http://dracoblue.net/download/dini-16/35/

When downloaded, goto pawno/include and copy the Dini.inc to your pawno/include. When done that, go to your script and next to your includes write
pawn Код:
#include <Dini>



Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

Ok, if i wanna use dini now?

But, i don't really know how to code Register/login Dialog/cmd

can u help me a little :S


Re: [HELP] Admin Protection - xir - 10.03.2011

Here is a nice tutorial.

https://sampforum.blast.hk/showthread.php?tid=167937


Re: [HELP] Admin Protection - Riddick94 - 10.03.2011

LOL! he wan't a command for admin.. =_=

pawn Код:
if(strcmp("/veh", cmdtext, true)==0)
{
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_YELLOW, "ADMIN: You are not an admin!");
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Vehicles","1.Elegy\n2.Hotring Racer\n3.Super GT\n4.Bullet\n5.Police LSPD\n6.Firetruck LA","Spawn","Exit");
    return 1;
}



Re: [HELP] Admin Protection - xir - 10.03.2011

Yes, but maybe he would like to build an admin team and make alot of cmds. Then rcon is not recommended. -.-


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

XIR:

I don't have errors but few warnings..
now, when i join the server, doesn't pop up any dialog Register/login
What is wrong?

http://pastebin.com/SwpepAPe

Warnings are in those lines ->

Spawn.pwn(151) : warning 217: loose indentation
Spawn.pwn(152) : warning 202: number of arguments does not match definition
Spawn.pwn(336) : warning 204: symbol is assigned a value that is never used: "string"
Spawn.pwn(396) : warning 217: loose indentation
Spawn.pwn(452) : warning 217: loose indentation


Re: [HELP] Admin Protection - xir - 10.03.2011

Try this

http://pastebin.com/YWhqdja3


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

No errors / Warnings but not working :///


Re: [HELP] Admin Protection - xir - 10.03.2011

What is not working?


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

Dialogs won't pop up
im testing it with grandlarc gamemode


Re: [HELP] Admin Protection - xir - 10.03.2011

Hmm, I can see you made this as a filterscript. Are you sure you added the filterscript name in server.cfg?


Re: [HELP] Admin Protection - kemppis_ - 10.03.2011

Yes im sure