I'm need chat admin.
#1

Hello, the function of admin:
GetPVarInt > Level
in CMD:command( playerid, params[ ] )
thanks you.
Reply
#2

pawn Код:
CMD:a(playerid, params[])
{
    if(GetPVarInt < Level) return ErrorMessage(playerid);
    {
        new message[91];
        if(sscanf(params, "s[90]", message)) return SendClientMessage( playerid, white, "USAGE: /a [message]");
        if(strlen(params)>90) return SendClientMessage(playerid, red, "Invalid length. The length must be between 1 and 90 characters.");
        new string[128]=0;
        foreach (Player, i)
        {
            if(PlayerInfo[i][pAdmin] != 0) { format(string,sizeof(string),"[Admin Chat] {FFFFFF}%s{FF0000}:{FFFFFF} %s", GetPName(playerid), message); SendClientMessage(i, red, string); }
        }
    }
    return 1;
}
Reply
#3

pawn Код:
CMD:command( playerid, params[ ] )
{
    if( GetPVarInt( playerid, "Level" ) < 1 )
        return SendClientMessage(playerid, 0xFFFFFFFF, "Only admins!");
   
    if(isnull( params ))
        return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /command [text]");
   
    new
        i = -1,
        message[148 + MAX_PLAYER_NAME + 14 + 1]
    ;
   
    GetPlayerName(playerid, message, MAX_PLAYER_NAME);
    format(message, sizeof(message), "[AdminChat] %s: %s", message, params);
   
    for( ;++i < MAX_PLAYERS; )
    {
        if( IsPlayerConnected( i ) && ( GetPVarInt( i , "Level" ) > 1) )
        {
            SendClientMessage( i, 0xFFFFFFFF, params );
        }
    }
    return true;
}
Reply
#4

First add stock for admin chat..
pawn Код:
stock SendMessageToAdmins(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPVarInt > Level)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}

CMD:a(playerid,params[])
{
    #pragma unused params
    //new pname[MAX_PLAYER_NAME]; //Your playername stock..
    new string[128];
    if(GetPVarInt > Level)
   {
     if(!strlen(params)) return SendClientMessage(playerid,COLOR_ERROR,"Usage: /ac (Message)");

     //GetPlayerName(playerid, pname, sizeof(pname)); //Your player name stock..
     format(string,sizeof(string), "[ADMIN MESSAGE] %s(%d): %s",pname, playerid, params);
     SendMessageToAdmins(COLOR_RED, string);
   
     return 1;
     }
}
EDITED: to fit with your admin level defining
Reply
#5

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
First add stock for admin chat..
pawn Код:
stock SendMessageToAdmins(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPVarInt > Level)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}

CMD:a(playerid,params[])
{
    #pragma unused params
    //new pname[MAX_PLAYER_NAME]; //Your playername stock..
    new string[128];
    if(GetPVarInt > Level)
   {
     if(!strlen(params)) return SendClientMessage(playerid,COLOR_ERROR,"Usage: /ac (Message)");

     //GetPlayerName(playerid, pname, sizeof(pname)); //Your player name stock..
     format(string,sizeof(string), "[ADMIN MESSAGE] %s(%d): %s",pname, playerid, params);
     SendMessageToAdmins(COLOR_RED, string);
   
     return 1;
     }
}
EDITED: to fit with your admin level defining
I'm have error in stock - SendMessageToAdmins.
in line: if(GetPVarInt > Level)
Reply
#6

It's YOUR admin level saving, show me your Y_INI enum or something..
also copy me the compiler error
Reply
#7

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
It's YOUR admin level saving, show me your Y_INI enum or something..
also copy me the compiler error
compiler error:error 076: syntax error in the expression, or invalid function call
LOL i have no Y_INI, what to do?
I'm have YSI/y_ini, it okay?
Reply
#8

Dunno sorry :/
I'm not familiar with anything but Y_INI..
Don't know MySQL or anything else..

show me your player saving codes.
Reply
#9

Quote:
Originally Posted by Drake1994
Посмотреть сообщение
pawn Код:
CMD:command( playerid, params[ ] )
{
    if( GetPVarInt( playerid, "Level" ) < 1 )
        return SendClientMessage(playerid, 0xFFFFFFFF, "Only admins!");
   
    if(isnull( params ))
        return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /command [text]");
   
    new
        i = -1,
        message[148 + MAX_PLAYER_NAME + 14 + 1]
    ;
   
    GetPlayerName(playerid, message, MAX_PLAYER_NAME);
    format(message, sizeof(message), "[AdminChat] %s: %s", message, params);
   
    for( ;++i < MAX_PLAYERS; )
    {
        if( IsPlayerConnected( i ) && ( GetPVarInt( i , "Level" ) > 1) )
        {
            SendClientMessage( i, 0xFFFFFFFF, params );
        }
    }
    return true;
}
I dont know, that are you blind or not, but my code is full perfect, and working, any code here is a such of bug and made me laugh
Reply
#10

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
Dunno sorry :/
I'm not familiar with anything but Y_INI..
Don't know MySQL or anything else..

show me your player saving codes.
I'm will give you an example of a command that you know it functions.
if ( GetPVarInt( playerid, "Level" ) < 1 )
it my functions of the admin.
PHP код:
it stock, (1487) : error 076syntax error in the expression, or invalid function call
stock SendMessageToAdmins
(color, const string[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
GetPVarInt Level)
            {
                
SendClientMessage(icolorstring);
            }
        }
    }
    return 
1;
}
it line 1487: if(GetPVarInt Level)
How do i fix it
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)