SA-MP Forums Archive
Need a /announce command - 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: Need a /announce command (/showthread.php?tid=442663)



Need a /announce command - Captain_jeffree95 - 08.06.2013

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.


Re: Need a /announce command - jackci - 08.06.2013

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");
}



Re: Need a /announce command - Captain_jeffree95 - 08.06.2013

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


Re: Need a /announce command - jackci - 08.06.2013

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");
}



Re: Need a /announce command - Chasm - 08.06.2013

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.


Re: Need a /announce command - Captain_jeffree95 - 10.06.2013

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;
}