Scripting Help. Admin Chat
#7

That code won't work
pawn Код:
result = strtok(cmdtext, idx);
strtok will return the next word separated by a space ( not the whole line )
pawn Код:
if(!strlen(strval(result)))
is incorrect, strval returns an integer

also, you have %s in the format, and you are formatting an integer.
you have defined str[128] and then used string
try this
pawn Код:
if(!strcmp(cmd, "/admin", true) || !strcmp(cmd, "/a", true))
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new result[128], str[128], sendername[MAX_PLAYER_NAME];
        strmid(result,cmdtext,idx,strlen(cmdtext),sizeof(result));
        if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/a)dmin [admin chat]");
   
        GetPlayerName(playerid,sendername,sizeof(sendername));
        format(str, sizeof(str), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
        SendAdminMessage(COLOR_YELLOW, str);
        return 1;
    }
    SendClientMessage(playerid,COLOR_GRAD2,"Unauthorized command");
    return 1;
}
In this instance, idx will already hold the reference for the start of the 'chat' portion of cmdtext
Reply


Messages In This Thread
Scripting Help. Admin Chat - by Floyd_Pink - 20.12.2010, 20:39
Respuesta: Scripting Help. Admin Chat - by admantis - 20.12.2010, 21:39
Re: Respuesta: Scripting Help. Admin Chat - by notime - 21.12.2010, 00:01
Respuesta: Re: Respuesta: Scripting Help. Admin Chat - by admantis - 21.12.2010, 00:07
Re: Respuesta: Re: Respuesta: Scripting Help. Admin Chat - by notime - 21.12.2010, 11:56
Re: Scripting Help. Admin Chat - by [NWA]Hannes - 21.12.2010, 12:23
Re: Scripting Help. Admin Chat - by Rachael - 21.12.2010, 12:40
Re: Scripting Help. Admin Chat - by Floyd_Pink - 22.12.2010, 02:32

Forum Jump:


Users browsing this thread: 1 Guest(s)