Admin commands?
#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


Messages In This Thread
Admin commands? - by CesarLT - 07.06.2014, 20:56
Re: Admin commands? - by SilentSoul - 07.06.2014, 23:11
Re: Admin commands? - by iFiras - 07.06.2014, 23:26
Re: Admin commands? - by CesarLT - 08.06.2014, 11:01
Re: Admin commands? - by CesarLT - 09.06.2014, 12:47
Re: Admin commands? - by Stanford - 09.06.2014, 12:59
Re: Admin commands? - by Stanford - 09.06.2014, 13:02
Re: Admin commands? - by CesarLT - 09.06.2014, 16:29

Forum Jump:


Users browsing this thread: 1 Guest(s)