Chat problem
#1

Got a small problem and I actually realize the problem, the problem is
pawn Код:
if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
the main problem is the IsPlayerAdmin which checks if player is a rcon admin which I dont want but I want it to be replaced with my one but not sure how it is done
pawn Код:
if(pData[playerid][Admin] < 1
this checks if player is an admin in my script tho it works that admins with that one can speak in the admin chat but they dont see messages unless they are rcon admin logged in... Here is the code

pawn Код:
COMMAND:psm(playerid,params[]) {
    new
        poster[40],
        mess[128];

    sscanf(params,"s",mess);
    if(pData[playerid][Admin] < 1 && !IsPlayerAdmin(playerid))
    return SendError(playerid, NOT_ADMIN_LEVEL_1 );
    if(!isnull(mess)) {
            for(new i = 0; i < MAX_PLAYERS; ++i) {
                if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
                    new
                        text[512];

                    GetPlayerName(playerid,poster,sizeof(poster));
                    format(text,sizeof(text),"[Public Safety Chat] | %s: %s",poster,mess);
                    SendClientMessage(i,COLOR_MOCCASIN ,text);
                }
            }
        } else {
            return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /psm [Message]");
        }
    return 1;
}
this is a admin chat (I call it Public Safety beside admins to make it sound unique ^^) (The main problem is at when it starts isplayerconnected)
Reply
#2

pawn Код:
COMMAND:psm(playerid,params[])
{
    new
        poster[40],
        mess[128];

    if(sscanf(params,"s[128]",mess)
    {
        return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /psm [Message]");
    }
    if(pData[playerid][Admin] < 1 && !IsPlayerAdmin(playerid))
    {
        return SendError(playerid, NOT_ADMIN_LEVEL_1 );
    }
    if(!isnull(mess))
    {
        for(new i = 0; i < MAX_PLAYERS; ++i)
        {
            if(IsPlayerConnected(i) && IsPlayerAdmin(i))
            {
                new
                    text[512];

                GetPlayerName(playerid,poster,sizeof(poster));
                format(text,sizeof(text),"[Public Safety Chat] | %s: %s",poster,mess);
                SendClientMessage(i,COLOR_MOCCASIN ,text);
            }
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
pawn Код:
COMMAND:psm(playerid,params[])
{
    new
        poster[40],
        mess[128];

    if(sscanf(params,"s[128]",mess)
    {
        return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /psm [Message]");
    }
    if(pData[playerid][Admin] < 1 && !IsPlayerAdmin(playerid))
    {
        return SendError(playerid, NOT_ADMIN_LEVEL_1 );
    }
    if(!isnull(mess))
    {
        for(new i = 0; i < MAX_PLAYERS; ++i)
        {
            if(IsPlayerConnected(i) && IsPlayerAdmin(i))
            {
                new
                    text[512];

                GetPlayerName(playerid,poster,sizeof(poster));
                format(text,sizeof(text),"[Public Safety Chat] | %s: %s",poster,mess);
                SendClientMessage(i,COLOR_MOCCASIN ,text);
            }
        }
    }
    return 1;
}
Oh thank u but just got one error ^^,

pawn Код:
(635) : error 001: expected token: ")", but found "{"
pawn Код:
if(sscanf(params,"s[128]",mess)
    {
Reply
#4

pawn Код:
if(sscanf(params,"s[128]",mess))
He forgot a )
Reply
#5

Sorry change to

pawn Код:
if(sscanf(params,"s[128]",mess))
Edit: to slow
Reply
#6

Still not working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)