Newbie chat help
#2

You can use a set of if statements to check if the player is an admin, then use the format() to add the information in. Can you paste us another command from your script which requires admin or your variable names?

pawn Код:
MD:n(playerid, params[]) {
    new tmpstring[128], name[MAX_PLAYER_NAME];

    GetPlayerName(playerid, name, sizeof(name));
       
    if(isnull(params))
        return SendClientMessage(playerid, NEWBIE, "ERROR: Usage /n [message]");

    format(tmpstring, sizeof(tmpstring), "[N] %s: %s ", name, params);
    SendClientMessageToAll(0x00E3AEFF, tmpstring);
    return 1;
}
This code is more logical btw - when you only are dealing with one string, there's no need to use sscanf, you can just use the information directly from "params", and you can use isnull() to check if there's anything written after the command.

Also, message strings never exceed 128 characters usually. So it'd be wise to set the size to 128 as opposed to 164.
Reply


Messages In This Thread
Newbie chat help - by KiiD - 12.06.2012, 06:26
Re: Newbie chat help - by Calgon - 12.06.2012, 06:32
Re: Newbie chat help - by Jikesh - 12.06.2012, 06:36
Re: Newbie chat help - by KiiD - 12.06.2012, 07:00
Re: Newbie chat help - by Jikesh - 12.06.2012, 16:04

Forum Jump:


Users browsing this thread: 1 Guest(s)