How to get RId of this
#6

That is not the problem.
You have problems with the code..
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/god", cmdtext, true, 10) == 0) {
        new cmd[128],idx,tmp[128];
        cmd = strtok(cmdtext,idx);
        tmp = strtok(cmd,idx);
        if(IsPlayerAdmin(playerid)) {
            if(!strlen(tmp)) return SendClientMessage(playerid,white,"USAGE: /god [on | off]");
            if(strcmp(tmp,"on",true) == 0) {
                SendClientMessage(playerid, SERVER," .Godmode Activated. ");
                SetPlayerHealth(playerid, GOD_HEALTH);
                GivePlayerWeapon(playerid, GOD_WEAPON,GOD_AMMO);
            } else if(strcmp(tmp,"on",true) == 0) {
                SendClientMessage(playerid,SERVER,".Godmode Deactivated.");
            } else {
                return SendClientMessage(playerid,red,"USAGE: /god [on | off]");
            }
        } else {
            return SendClientMessage(playerid, SERVER,"ERROR: This command is only avaible for RCON Administrators.");
        }
        return 1;
    }
    return SendClientMessage(playerid,white,"Unknown Command. Please type /help to see avaible commands.");
}
EDIT: you need strtok:
pawn Код:
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;
}
I don't know much about strtok() but it should work
Reply


Messages In This Thread
How to get RId of this - by Artix - 07.05.2011, 21:50
Re: How to get RId of this - by BizzyD - 07.05.2011, 21:58
Re: How to get RId of this - by Artix - 07.05.2011, 22:10
Re: How to get RId of this - by BizzyD - 07.05.2011, 22:13
Re: How to get RId of this - by Artix - 07.05.2011, 22:14
Re: How to get RId of this - by Seven_of_Nine - 08.05.2011, 05:02
Re: How to get RId of this - by Joe Staff - 08.05.2011, 08:07

Forum Jump:


Users browsing this thread: 1 Guest(s)