[SOLVED]Problem with command
#10

try:
pawn Код:
//in your onplayercommandtext
        new cmd[256],idx = 0;
        if(strcmp(cmd, "/orgkick", true)==0)
        {
            new text[256];
            text = strtok(cmdtext, idx);
            if(!strlen(text))
            {
                SendClientMessage(playerid, CWARN, "Server: /orgkick text");
                return 1;
            }
            if(orgleader[playerid])
            {
                new string55[256];
                format(string55,sizeof string55,"*** %s ***",text);
                SendClientMessageToAll(COLOR_ORANGE,string55);
                print(string55);
                return 1;
            }else if(!orgleader[playerid])return SendClientMessage(playerid, COLOR_ORANGE, "You Aren not an Organization Leader");
            return 1;
        }
//somewhere in your script.. at the end or whatever
stock strtok(const string[], &index,seperator=' ')
{
    new length = strlen(string);
    new offset = index;
    new result[MAX_STRING];
    while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }

    result[index - offset] = EOS;
    if ((index < length) && (string[index] == seperator))
    {
        index++;
    }
    return result;
}
If something is wrong please correct me
Reply


Messages In This Thread
[SOLVED]Problem with command - by Jakku - 19.07.2009, 18:34
Re: Problem with command - by James_Alex - 19.07.2009, 18:36
Re: Problem with command - by Jakku - 19.07.2009, 18:37
Re: Problem with command - by James_Alex - 19.07.2009, 18:38
Re: Problem with command - by Jakku - 19.07.2009, 18:43
Re: Problem with command - by yezizhu - 20.07.2009, 01:41
Re: Problem with command - by Jakku - 20.07.2009, 07:15
Re: Problem with command - by yezizhu - 20.07.2009, 07:48
Re: Problem with command - by Jakku - 20.07.2009, 08:04
Re: Problem with command - by Gamer_Z - 20.07.2009, 08:18

Forum Jump:


Users browsing this thread: 3 Guest(s)