Admin Announce Command
#5

Try using sscanf...

SSCANF Version:
pawn Код:
CMD:adminann(playerid, params[])
{
    new message[100];
    if(PlayerInfo[playerid][pAdminLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not an admin");
    if(sscanf(params,"s",message)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /adminann [text]");
    if(strlen(message) > 100) return SendClientMessage(playerid, COLOR_GREY, "Your message must not exceed 100 characters");
    new str[128];
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|~~~~~~~~~~ Admin Announcement ~~~~~~~~~~|");
    format(str, sizeof(str), "%s", message);
    SendClientMessageToAll(COLOR_GREEN, str);
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|");
    return 1;
}
NON-SSCANF Version:
pawn Код:
CMD:adminann(playerid,params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not an admin");
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /adminann [text]");
    if(strlen(params) > 100) return SendClientMessage(playerid, COLOR_GREY, "Your message must not exceed 100 characters");
    new str[128];
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|~~~~~~~~~~ Admin Announcement ~~~~~~~~~~|");
    format(str, sizeof(str), "%s", params);
    SendClientMessageToAll(COLOR_GREEN, str);
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|");
    return 1;
}
Reply


Messages In This Thread
Admin Announce Command - by StuartD - 31.12.2012, 22:21
Re : Admin Announce Command - by [HRD]Mar1 - 31.12.2012, 22:45
Re: Admin Announce Command - by StuartD - 31.12.2012, 22:57
Re: Admin Announce Command - by CrazyJin - 31.12.2012, 23:15
Re: Admin Announce Command - by Threshold - 31.12.2012, 23:21
Re: Admin Announce Command - by StuartD - 31.12.2012, 23:40
Re: Admin Announce Command - by CrazyJin - 31.12.2012, 23:43
Re: Admin Announce Command - by Threshold - 01.01.2013, 10:13

Forum Jump:


Users browsing this thread: 9 Guest(s)