Admin Protection.
#1

Hello, I have some commands I want to protect, What I mean?....

I mean i have this code:



Код:
}
 	if (strcmp(cmdtext, "/joinbot", true) == 0)
    {
        SendClientMessageToAll(COLOR_GREY, "Jeremy has joined the server.");
        return 1;
    }
    if (strcmp(cmdtext, "/leftbot", true) == 0)
    {
        SendClientMessageToAll(COLOR_GREY, "Jeremy has left the server (Left).");
        return 1;
    }
    if (strcmp(cmdtext, "/kickbot", true) == 0)
    {
        SendClientMessage(playerid,0xff0000ff, "----------------------------------");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Kicking the bot simulation successful now type: ( /bot toggle off )");
		SendClientMessageToAll(COLOR_RED,"Administrator has kicked Jeremy (Reason: Go away Jeremy :p)");
		SendClientMessageToAll(COLOR_GREY, "Jeremy has left the server (Kicked).");
        return 1;
    }
    if (strcmp(cmdtext, "/banbot", true) == 0)
    {
        SendClientMessage(playerid,0xff0000ff, "----------------------------------");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Banning the bot simulation successful, If the bot still talking unloadhim with the rcon.");
		SendClientMessageToAll(COLOR_RED,"Administrator has banned Jeremy (Reason: Ban Evading)");
		SendClientMessageToAll(COLOR_GREY, "Jeremy has left the server (Kicked).");
        return 1;
    }
I want to protect it without zcmd, like if is player admin can execute it, if player is not admin say You are not admin.
Plese Help (This is a test text ) Thanks.
Reply
#2

try this
pawn Код:
if(IsPlayerAdmin(playerid))
//blah blah bla ur cmd here
else
{
SendClientMessage(playerid, 0xff0000ff, "You Need To Be A RCON Admin To Do this cmd");
}
return 1;
}
and thats all , happy xmas all
if u got any erros tell me, i'll try fix it out
Reply
#3

Plese send me my code with this protection icluded, Just quote me and add the protection plese Its because when i put that protection it doesnt execute the commad.
Reply
#4

?
Reply
#5

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение
Plese send me my code with this protection icluded, Just quote me and add the protection plese Its because when i put that protection it doesnt execute the commad.
He gave you what you need to do it. Learn a bit about scripting and dont expect everything to be handed to you. You put that under strcmp.
Reply
#6

pawn Код:
if (strcmp(cmdtext, "/banbot", true) == 0)
    {
if(IsPlayerAdmin(playerid))
{
        SendClientMessage(playerid,0xff0000ff, "----------------------------------");
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Banning the bot simulation successful, If the bot still talking unloadhim with the rcon.");
        SendClientMessageToAll(COLOR_RED,"Administrator has banned Jeremy (Reason: Ban Evading)");
        SendClientMessageToAll(COLOR_GREY, "Jeremy has left the server (Kicked).");
}
else
{
SendClientMeesage(playerid,COLOR_RED,"You're not authorized!");
}
        return 1;
    }
sorry for indentation, you can base on that
Reply
#7

Ok, Im trying to put all this commands with protection, I put this protection to all of them and just the 1st one executes.

So...Can you guys send me the code with all the protection included D:
Reply
#8

?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)