[HELP] Admin Protection
#1

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 :/
Reply
#2

Which ini system are you using?
Reply
#3

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
Reply
#4

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.
Reply
#5

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
Reply
#6

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
Reply
#7

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.
Reply
#8

Xir:

i didn't understand :/

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

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>
Reply
#10

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
Reply
#11

Here is a nice tutorial.

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

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;
}
Reply
#13

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

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
Reply
#15

Try this

http://pastebin.com/YWhqdja3
Reply
#16

No errors / Warnings but not working :///
Reply
#17

What is not working?
Reply
#18

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

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

Yes im sure
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)