11.08.2009, 06:08
Hey guys,
Dunno whether this has already been posted but i've got a tutorial for the newbs, like me, out there who want to know how to make a command admin only!!
It's really simple!
first of all, lets say i want to use the awesome CCTV camera script (made by =>Sandra<=! !!!), and make that an admin only command......
ok so this is the code that when you type /cctv in sa-mp it comes up with the menu.....
but we could use any code..... any way what we would do is this.....
we would add that above the :
part, so we had this for our code...
But with the line (above) added in we should know have this for our code....
[color=blue]
NOTE!! Instead of :
we could have
if you want it to be shorter as both work.
AGAIN!! this can be used for any command, like a tele! just add:
[color=blue]above the code you want to make admin's only
E.G
From this......
So we get......
I Hope this makes sense and that it helped you!!!!
Dunno whether this has already been posted but i've got a tutorial for the newbs, like me, out there who want to know how to make a command admin only!!
It's really simple!
first of all, lets say i want to use the awesome CCTV camera script (made by =>Sandra<=! !!!), and make that an admin only command......
ok so this is the code that when you type /cctv in sa-mp it comes up with the menu.....
Code:
if (strcmp("/cctv", cmdtext, true) == 0) { PlayerMenu[playerid] = 0; TogglePlayerControllable(playerid, 0); ShowMenuForPlayer(CCTVMenu[0], playerid); return 1; }
Code:
{ if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!");
Code:
PlayerMenu[playerid] = 0;
Code:
if (strcmp("/cctv", cmdtext, true) == 0) { PlayerMenu[playerid] = 0; TogglePlayerControllable(playerid, 0); ShowMenuForPlayer(CCTVMenu[0], playerid); return 1; } }
But with the line (above) added in we should know have this for our code....
Code:
if (strcmp("/cctv", cmdtext, true) == 0) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!"); PlayerMenu[playerid] = 0; TogglePlayerControllable(playerid, 0); ShowMenuForPlayer(CCTVMenu[0], playerid); return 1; }
NOTE!! Instead of :
Code:
'if (strcmp("/cctv", cmdtext, true) == 0)'
Code:
'if (!strcmp("/cctv", cmdtext, true))'
AGAIN!! this can be used for any command, like a tele! just add:
Code:
{ if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!");
E.G
From this......
Code:
if (strcmp("/godmode", cmdtext, true, 10) == 0) { SendClientMessageToAll(0xDEEE20FF, "A Player Used God Mode [/god]"); SetPlayerHealth(playerid, 1000000000000000000000000000000000000000000000.0); return 1; }
So we get......
Code:
if (strcmp("/cctv", cmdtext, true) == 0) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!"); PlayerMenu[playerid] = 0; TogglePlayerControllable(playerid, 0); ShowMenuForPlayer(CCTVMenu[0], playerid); return 1; }
I Hope this makes sense and that it helped you!!!!