Posts: 265
Threads: 59
Joined: Sep 2013
Hello everyone, recently I was searching for a good tutorial, here on the forums and on ******* aswell, but I failed, some of the tutorials were based on MySQL, and others were just unhelpful. Could anyone here please, explain to me how do I script an administrator command, with details about every function? I would be glad.
And, another question is..how to script a non-fall bike code?
Thanks ahead!
Posts: 265
Threads: 59
Joined: Sep 2013
Quote:
Originally Posted by SilentSoul
Hello, firstly you should learn how to use mysql follow this Mysql registration system from this tutorial you will learn some mysql functions, as mentioned on this tutorial you will use something called 'enum' pInfo[playerid][Admin] you can later create any admin command by checking this enum example:
pawn Код:
if(pInfo[playerid][Admin] > 2) // If the player who type any command his admin level higher than 2 actually equal three //do something
You should just use this function , if there's no admin system tutorial just search for custom commands like /mute etc just change to your variables. hope i helped you!
|
So, shall it work like this?
pawn Код:
CMD:healme(playerid, params[])
{
if(pInfo[playerid][pAdmin] > 2)
{
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
}
return 1;
}
Or how shall I code that? Thanks in advance!
Posts: 265
Threads: 59
Joined: Sep 2013
Bumpy bumpy
Posts: 265
Threads: 59
Joined: Sep 2013
Quote:
Originally Posted by Stanford
Alright,
Let's script a slap command:
pawn Код:
CMD:slap(playerid, params[]) { new playa, string[128]; if(sscanf(params,"u",playa)) // I guess that you know what SSCANF does, in one word we can sum up and say RESTRICTIONS!. { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [playerid/PartOfName]"); return 1; } if(pInfo[playerid][AdminLevel] >= 2) // this means IF the admin level EQUALS to (2) or MORE he can do this ACTION. { if(IsPlayerConnected(playa)) // Checking if the player that we're slapping is even online { new Float:slx, Float:sly, Float:slz; GetPlayerPos(playa, slx, sly, slz); // getting his current position SetPlayerPos(playa, slx, sly, slz+5); // slapping him up (increased Z's according to his previous coordinates) PlayerPlaySound(playa, 1130, slx, sly, slz+5); // played some sound. } } else { SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !"); // if the admin level doesn't equals to 2 or more then send this message ONLY } return 1; }
I hope I helped you, your friend Jameel, you could've asked in skype anyway!
|
Quote:
Originally Posted by Stanford
|
Thanks Jameel!