Announce Cmd.
#1

Hey Scripters.

Can anyone tell me how do i make an Announce command.

Like one /announce and another one /announce2 [Style (0-6)] [Time(Miliseconds)] [Text]

Thanks.
Reply
#2

pawn Код:
CMD:announce(playerid, params[])
{
    #define Msg SendClientMessage
    if (!IsPlayerAdmin(playerid)) return
        Msg(playerid, 0xFF0000AA, "Only for admins.");
       
    new text[64], timems, style;
    if (sscanf(params, "iis[64]", style, timems, text)) return
        Msg(playerid, 0xFF0000AA, "Usage: /announce <style[0-6]> <time in ms> <text>");

    if (strlen(text) > 64) return
        Msg(playerid, 0xFF0000AA, "Message is too long (64 characters)");

    if (style < 0 || style > 6) return
        Msg(playerid, 0xFF0000AA, "Invalid style");

    if (time > 20*1000) return
        Msg(playerid, 0xFF0000AA, "No longer than 20 seconds");
       
    GameTextForAll(text, timems, style);
    #undef Msg
    return true;
}
Reply
#3

Thanks for the code.
Reply
#4

There is one bug when i do /announce 2 1000 hi

The text stay display in my screen and not go? why.

other all are fine.

thnx for that.

please help me in this.
Reply
#5

Text 2 doesnt dissapear. Add this:

pawn Код:
if(style == 2) return Msg(playerid, 0xFF0000AA, "You can't choose 2");
Reply
#6

Ugh yes, I was about to say that.
Look at the game text styles at wiki to see what effect they may have, sometimes 'time' parameter is not accurate with determinated styles.
Reply
#7

thnx you both.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)