SA-MP Forums Archive
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: Admin Protection. (/showthread.php?tid=228070)



[UNSOLVED] NEED QUICK HELP Admin Protection. - Alex_Obando - 18.02.2011

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.


Re: Admin Protection. - MBX97 - 18.02.2011

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


Respuesta: Admin Protection. - Alex_Obando - 18.02.2011

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.


Respuesta: Admin Protection. - Alex_Obando - 19.02.2011

?


Re: Respuesta: Admin Protection. - Hal - 19.02.2011

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.


Re: Admin Protection. - Marricio - 19.02.2011

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


Respuesta: Admin Protection. - Alex_Obando - 19.02.2011

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:


Respuesta: Admin Protection. - Alex_Obando - 19.02.2011

?