YCMD help
#1

can anyone help? how do i set this command so that only a admin or owner can use it?
pawn Код:
YCMD:ban(playerid, params[], help)
{
    if (help)
    {
        return SendClientMessage(playerid, 0xFF0000AA, "Bans another player.");
    }
    else
    {
        new
            pid,
            reason[32];
        if (sscanf(params, "uS[32]", pid, reason))
        {
            return SendClientMessage(playerid, 0xFF0000AA, "Parameters: <playerid/name> [reason]");
        }
        if (reason[0])
        {
            SendClientMessage(pid, 0xFF0000AA, "You have been banned.  Reason:");
            SendClientMessage(pid, 0xFF0000AA, reason);
        }
        else
        {
            SendClientMessage(pid, 0xFF0000AA, "You have been banned.");
        }
        Ban(pid);
    }
    return 1;
}
GROUPS

pawn Код:
stock GetPlayerAdminLevel(playerid)
{
    new
        a_level_string[ 128 ];

    if ( userData[ playerid ][ Admin_Level ] == 1 )
        format( a_level_string, sizeof ( a_level_string ), "Mod" );
    else if ( userData[ playerid ][ Admin_Level ] == 2 )
        format( a_level_string, sizeof ( a_level_string ), "Super Mod" );
    else if ( userData[ playerid ][ Admin_Level ] == 3 )
        format( a_level_string, sizeof ( a_level_string ), "Admin" );
    else if ( userData[ playerid ][ Admin_Level ] == 4 )
        format( a_level_string, sizeof ( a_level_string ), "Owner" );
    else
        format( a_level_string, sizeof ( a_level_string ), "Unknown admin level!" );

    return a_level_string;
}
Reply
#2

Try this,
Код:
YCMD:ban(playerid, params[], help)
{
    if(GetPlayerAdminLevel(playerid) < 4) return SendClientMessage(playerid, 0xFFFFFF, "You aren't authorized to use this command."
    if (help)
    {
        return SendClientMessage(playerid, 0xFF0000AA, "Bans another player.");
    }
    else
    {
        new
            pid,
            reason[32];
        if (sscanf(params, "uS[32]", pid, reason))
        {
            return SendClientMessage(playerid, 0xFF0000AA, "Parameters: <playerid/name> [reason]");
        }
        if (reason[0])
        {
            SendClientMessage(pid, 0xFF0000AA, "You have been banned.  Reason:");
            SendClientMessage(pid, 0xFF0000AA, reason);
        }
        else
        {
            SendClientMessage(pid, 0xFF0000AA, "You have been banned.");
        }
        Ban(pid);
    }
    return 1;
}
Reply
#3

not working
Reply
#4

Oh I see it, try replacing GetPlayerAdminLevel with Admin_Level
Reply
#5

C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(499) : error 012: invalid function call, not a valid address
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(499) : warning 215: expression has no effect
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(499) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(499) : error 029: invalid expression, assumed zero
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(499) : fatal error 107: too many error messages on one line
Reply
#6

Like this
Код:
if(userData[playerid][Admin_Level] < 4) return SendClientMessage(playerid, 0xFFFFFF, "You aren't authorized to use this command."
Reply
#7

C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(526) : error 021: symbol already defined: "@yC_ban"
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(526) : error 021: symbol already defined: "@yC_ban"
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(526) : error 021: symbol already defined: "@_yCban"

dont see how this error
Reply
#8

That is another line you are showing me now, show the entire code.
Reply
#9

pawn Код:
YCMD:ban(playerid, params[], help)
{
    if(userData[playerid][Admin_Level] < 4) return SendClientMessage(playerid, 0xFFFFFF, "You aren't authorized to use this command."
    if (help)
    {
        return SendClientMessage(playerid, 0xFF0000AA, "Bans another player.");
    }
    else
    {
        new
            pid,
            reason[32];
        if (sscanf(params, "uS[32]", pid, reason))
        {
            return SendClientMessage(playerid, 0xFF0000AA, "Parameters: <playerid/name> [reason]");
        }
        if (reason[0])
        {
            SendClientMessage(pid, 0xFF0000AA, "You have been banned.  Reason:");
            SendClientMessage(pid, 0xFF0000AA, reason);
        }
        else
        {
            SendClientMessage(pid, 0xFF0000AA, "You have been banned.");
        }
        Ban(pid);
    }
    return 1;
}
Reply
#10

i was looking at y_groups but am not understanding the tutorial you done ****** am new to this lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)