Global Announce
#1

I need some help with global announce(message) in dialog style
Why not working, what is wrong?
PHP код:
    if(strcmp(cmd"/global"true) == 0)    
{
if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] >= )
            {
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /global [text]");
                return 
1;
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
format(string256"ADMIN %s used global announce."sendername);
            
ABroadCast(COLOR_LIGHTRED,string,1);
            
format(string,sizeof(string),"%s"result);
            
ShowPlayerDialog(playerid,123321,DIALOG_STYLE_MSGBOX,"Announce",string,"Ok","Cancel");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"* Not authorized!");
                return 
1;
            }
        }
return 
1;

Reply
#2

pawn Код:
format(string,sizeof(string),"%s", result)
Why are you formatting it's result?

Try to delete that line

I don't see anything wrong, though

Try to change this :
pawn Код:
ShowPlayerDialog(playerid,123321,DIALOG_STYLE_MSGBOX,"Announce",string,"Ok","Cancel");
To:
pawn Код:
ShowPlayerDialog(playerid,123321,DIALOG_STYLE_MSGBOX,"Announce",result,"Ok","Cancel");
Please be more specific, I can't see what's the problem.

If you have ZCMD + sscanf2 + foreach
pawn Код:
COMMAND:announce( playerid, params[ ] )
{
    if ( !IsPlayerAdmin( playerid ) ) // rcon
        return 0;

    new result[ 128 ];

    if ( sscanf( params, "s[128]", result ) )
        return SendClientMessage( playerid, -1, "/announce < msg >" );

    foreach (Player, i)
        if ( i != playerid )
           ShowPlayerDialog( playerid, 1234, DIALOG_STYLE_MSGBOX, "Announce", result, "Okay", "" );

    ShowPlayerDialog( playerid, 1234, DIALOG_STYLE_MSGBOX, "Announce", "Announce send", "Okay", "" );

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)