[HELP] TextCommands!
#1

I got this :

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
   

    if(strcmp(cmd, "/help", true) == 0) {
    SendClientMessage(playerid, 0x33AA33AA, "•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
    SendClientMessage(playerid, 0xFFFF00AA, "JOBS: /plane /taxidriver /busdriver");
    SendClientMessage(playerid, 0xFFFF00AA, "CMDS: /pm /sendmoney /help");
    SendClientMessage(playerid, 0x33AA33AA, "•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
  return 1;
    }

   
    if(strcmp(cmd, "/rules", true) == 0) {
    SendClientMessage(playerid, 0x33AA33AA, "•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
    SendClientMessage(playerid, 0xFFFF00AA, "Welcome to Orizon RolePlay And Thank You for reading our Rules!");
    SendClientMessage(playerid, 0xFFFF00AA, "1. DeathMatch And DriveBy : ");
    SendClientMessage(playerid, 0xFFFF00AA, "   If you are NOT a Hitman, you are not allowed to kill ");
    SendClientMessage(playerid, 0xFFFF00AA, "   peoples for no reasons. DriveBy are not allowed. If ");
    SendClientMessage(playerid, 0xFFFF00AA, "   someone report you for DriveBy Kills, You will be");
    SendClientMessage(playerid, 0xFFFF00AA, "   kicked from the server and your name will be added");
    SendClientMessage(playerid, 0xFFFF00AA, "   in our Black List.");
    SendClientMessage(playerid, 0x33AA33AA, "•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
  return 1;
    }

    return 1;
}
When i do /help it say the help text but when i do /rules it say the help text... why?

sorry for my english!
Reply
#2

pawn Код:
new idx;
cmd = strtok(cmdtext, idx);
Put that under cmd[256];
Reply
#3

i got this error


C:\Documents and Settings\Daniel\My Documents\GTA San Andreas\RC44\gamemodes\orrp.pwn(13 : error 017: undefined symbol "strtok"
C:\Documents and Settings\Daniel\My Documents\GTA San Andreas\RC44\gamemodes\orrp.pwn(13 : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Daniel\My Documents\GTA San Andreas\RC44\gamemodes\orrp.pwn(137) : warning 203: symbol is never used: "idx"
Reply
#4

i got errors in this line

cmd = strtok(cmdtext, idx);
Reply
#5

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;
}
Reply
#6

where do i put this? oO
Reply
#7

e.g. at the end of your script.
Reply
#8

ok now it say warning 203: symbol is never used: "strtok" why?
Reply
#9

bump please help!
Reply
#10

Change cmd to cmdtext.

pawn Код:
if(strcmp(cmdtext, "/help", true) == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)