SA-MP Forums Archive
[Solved] Small command problem. - 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: [Solved] Small command problem. (/showthread.php?tid=414480)



[Solved] Small command problem. - Smikkeltoetje - 09.02.2013

well i hope its a simple problem...

Let me explain what is going on,

I want a command that is like "/rcon say [text]" but without using rcon
(EXAMPLE) Admin Announcement: text comes here
long story short... i dont want to show any names whilest someone uses this command
(Because if use it now it says "Admin Announcement: playername, text")

let me place the code here for the person that can help me out !

pawn Код:
CMD:achat(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be level 2 admin and up to use this command.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /achat [text]");
    if(AntiAdv(playerid, params)) return 1;
    if(PlayerInfo[playerid][pAdmin]) format(string, sizeof(string), "* Admin Accouncement: %s %s *", RPN(playerid), params);
    else format(string, sizeof(string), "*Admin Announcement: %s %s *", RPN(playerid), params);
    SendClientMessageToAll(COLOR_CYAN, string);
    return 1;
}
I hope i have explained what im trying to do here well enough
so someone can help me

if i didn't, please let me know so i can explain what i actually mean ghehehe

Thanks alot for reading already and hopefully someone brings a solution


Re: A simple problem with my command - Peach - 09.02.2013

If this is what I think you're asking for.. this should work.

Код:
CMD:achat(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be level 2 admin and up to use this command.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /achat [text]");
    if(AntiAdv(playerid, params)) return 1;
    format(string, sizeof(string), "*Admin Announcement: %s *", params); // REMOVED  RPN(playerid) and the %s.
    SendClientMessageToAll(COLOR_CYAN, string);
    return 1;
}



Re: A simple problem with my command - Smikkeltoetje - 09.02.2013

Quote:
Originally Posted by Peach
Посмотреть сообщение
If this is what I think you're asking for.. this should work.

Код:
CMD:achat(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be level 2 admin and up to use this command.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /achat [text]");
    if(AntiAdv(playerid, params)) return 1;
    format(string, sizeof(string), "*Admin Announcement: %s *", params); // REMOVED  RPN(playerid) and the %s.
    SendClientMessageToAll(COLOR_CYAN, string);
    return 1;
}
Compiled, tested and....
That's exactly what i wanted
Thank you very much for the fast reply.

!