Global Announce - 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: Global Announce (
/showthread.php?tid=281076)
Global Announce -
Razwan - 04.09.2011
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] >= 7 )
{
GetPlayerName(playerid, sendername, sizeof(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(playerid, COLOR_GRAD2, "USAGE: /global [text]");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "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(playerid, COLOR_GRAD1, "* Not authorized!");
return 1;
}
}
return 1;
}
Re: Global Announce -
Basicz - 04.09.2011
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;
}