Admin commands?
#1

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

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

You can download an admin system and edit it well. To be honest, MySQL is hard (I don't even understand it yet), I'd suggest to use y_ini, it is good and fast. Good at login/register systems.

For the anti-bike fall off, see this topic: https://sampforum.blast.hk/showthread.php?tid=33245
Reply
#4

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

Bumpy bumpy
Reply
#6

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

About the non-fall bike script, I think you can do that by getting the OLD vehicle that the player was driving and using OnPlayerStateChange

https://sampwiki.blast.hk/wiki/OnPlayerStateChange
Reply
#8

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
Посмотреть сообщение
About the non-fall bike script, I think you can do that by getting the OLD vehicle that the player was driving and using OnPlayerStateChange

https://sampwiki.blast.hk/wiki/OnPlayerStateChange
Thanks Jameel!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)