SA-MP Forums Archive
Need some help. - 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)
+--- Thread: Need some help. (/showthread.php?tid=305606)



Need some help. - nogh445 - 23.12.2011

Pawn Code:
pawn Код:
if (strcmp("/adminpack", cmdtext, true, 10) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
        SendClientMessage(playerid,0x0077BB00,"~Command denied~");
        return 1;
        }
        {
        SetPlayerHealth(playerid,100000);
        SetPlayerArmour(playerid,100000);
        GivePlayerWeapon(playerid,38,99999);
        }
        {
        SendClientMessage(playerid, 0x0077BB00, "~Command Accepted~");
        SendClientMessage(playerid, 0xAFAFAFAA, "Your hp has been set to 100000.");
        SendClientMessage(playerid, 0xAFAFAFAA, "Your armour has been set to 100000.");
        SendClientMessage(playerid, 0xAFAFAFAA, "You have recieved a minigun with 99999 bullets.");
        SendClientMessage(playerid, 0xAFAFAFAA, "Enjoy your admin pack.");
        }
        return 1;
    }
I'm trying to make it the where if your not logged into the RCON it will show "~Command denied~" but I test it IG, when i'm not logged into the RCON, and it gives me the health, armour and the minigun.


Re: Need some help. - iGetty - 23.12.2011

pawn Код:
if (strcmp("/adminpack", cmdtext, true, 10) == 0)
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid,0x0077BB00,"~Command denied~");
        return 1;
    }
    else
    {
        SetPlayerHealth(playerid,100000);
        SetPlayerArmour(playerid,100000);
        GivePlayerWeapon(playerid,38,99999);
        SendClientMessage(playerid, 0x0077BB00, "~Command Accepted~");
        SendClientMessage(playerid, 0xAFAFAFAA, "Your hp has been set to 100000.");
        SendClientMessage(playerid, 0xAFAFAFAA, "Your armour has been set to 100000.");
        SendClientMessage(playerid, 0xAFAFAFAA, "You have recieved a minigun with 99999 bullets.");
        SendClientMessage(playerid, 0xAFAFAFAA, "Enjoy your admin pack.");
    }
    return 1;
}
Untested.


Re: Need some help. - nogh445 - 23.12.2011

^That worked.^ Thank you very much.


Re: Need some help. - [ABK]Antonio - 23.12.2011

IsPlayerAdmin(playerid) = if they're admin
!IsPlayerAdmin(playerid) = if they aren't admin

It's good to remember if you're going to be using RCON :P


Re: Need some help. - iGetty - 23.12.2011

Quote:
Originally Posted by nogh445
Посмотреть сообщение
^That worked.^ Thank you very much.
Not a problem.

& Antonio; +1!

Merry Christmas to you both!


Re: Need some help. - nogh445 - 23.12.2011

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
IsPlayerAdmin(playerid) = if they're admin
!IsPlayerAdmin(playerid) = if they aren't admin

It's good to remember if you're going to be using RCON :P
I'll be sure to remember.
Thank you.