Need a /announce command
#1

Heyy

I really need a /announce command that displays it as a client message and gametext for all, if something can help, i would really be a big help, maybe +rep if it works, we need it without ZCMD, it needs to look like this.

mp = strtok(cmdtext, idx);
new msg = strval(tmp);

/announce (text)

the client meesgae come though alright but the gametext is blank and doesnt show.
Reply
#2

pawn Код:
CMD:announce(playerid,params[]) {
    if(IsPlayerAdmin(playerid)) {
        if(!strlen(params)) return SendClientMessage(playerid,-1,"USAGE: /announce <text>");
        return SendClientMessageToAll(-1,params);
    } else return SendClientMessage(playerid,-1,"ERROR: You are not an admin");
}
Reply
#3

sry forgot to metion something , and also you forgot the gametext for all.
Reply
#4

pawn Код:
CMD:announce2(playerid,params[]) {
    if(IsPlayerAdmin(playerid)) {
        if(!strlen(params)) return SendClientMessage(playerid,-1,"USAGE: /announce <text>");
        return GameTextForAll(params,5000,5);
    } else return SendClientMessage(playerid,-1,"ERROR: You are not an admin");
}
Reply
#5

Here, you need sscanf and zcmd.

pawn Код:
CMD:announce(playerid, params[])
{
    new text[64];
    if(sscanf(params, "s[64]", text)) return SendClientMessage(playerid, 0xFFFFFFF, "{F79900}[USAGE]: {FFFFFF}/announce [text]");
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFF, "{F79900}[ERROR]: {FFFFFF}You have no access to this command");
    GameTextForAll(text, 4000, 6);
    return 1;
}
Only works when you are logged into RCON, you can change it, of course.
Oh, sorry, didn't read through all the topic.
But you can use this command anyway, or maybe someone else can.
Reply
#6

this one we tried to make but when we do the command and enter the text nothing comes up at all not as a client message or gametext but also doesnt say server unknown command


if(strcmp(cmd, "/announce", true) == 0)
{

tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xA0A0A0FF, "Use /announce [TEXT].");
return 1;
}
new text,announce[40];
text = strval(tmp);
format(announce,sizeof(announce), "%s", text);
if(PlayerAdmin[playerid][Admin] > 1)
GameTextForAll(announce, 5000, 6);
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)