SA-MP Forums Archive
YCMD 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: YCMD help (/showthread.php?tid=443393)



YCMD help - semaj - 11.06.2013

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;
}



Re: YCMD help - RALL0 - 11.06.2013

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;
}



Re: YCMD help - semaj - 11.06.2013

not working


Re: YCMD help - RALL0 - 11.06.2013

Oh I see it, try replacing GetPlayerAdminLevel with Admin_Level


Re: YCMD help - semaj - 11.06.2013

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


Re: YCMD help - RALL0 - 11.06.2013

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



Re: YCMD help - semaj - 11.06.2013

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


Re: YCMD help - RALL0 - 11.06.2013

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


Re: YCMD help - semaj - 11.06.2013

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;
}



Re: YCMD help - semaj - 11.06.2013

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