[HELP] Chat command.
#1

Hello,
I've made a command, a chat one.
PHP код:
    if(strcmp(cmd"/s"true) == || strcmp(cmd"/shout"true) == 0)
    {
        if(!
strlen(result))
            return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /s(hout) [text]");
        
format(stringsizeof(string), "%s shouts: %s!"Name(playerid), result);
        
ProxDetector(15.0,playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        return 
1;
    } 
cmd assigned to strtok(cmdtext, idx);
result assigned to sttrest(cmdtext, idx);

When I'm writing, it will send me that I'm not writing(!strlen(result)).
It doesn't recognize the result..

Strrest:
PHP код:
stock strrest(const string[],index)
{
    new 
length strlen(string),offset index,result[256];
    while((
index length) && ((index offset) < (sizeof(result) - 1)) && (string[index] > '\r')) result[index offset] = string[index],index++;
    
result[index offset] = EOS;
    if(
result[0] == ' ' && string[0] != ' 'strdel(result,0,1);
    return 
result;

Strtok:
PHP код:
strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

Thanks advance.
Reply


Messages In This Thread
[HELP] Chat command. - by BlackSA - 25.11.2011, 20:28
Re: [HELP] Chat command. - by Rob_Maate - 25.11.2011, 20:53
Re: [HELP] Chat command. - by Joshb93 - 25.11.2011, 21:06
Re: [HELP] Chat command. - by iNorton - 25.11.2011, 21:18
Re: [HELP] Chat command. - by Rob_Maate - 25.11.2011, 21:20
Re: [HELP] Chat command. - by BlackSA - 26.11.2011, 05:55

Forum Jump:


Users browsing this thread: 1 Guest(s)