SA-MP Forums Archive
[HELP] TextCommands! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] TextCommands! (/showthread.php?tid=97044)



[HELP] TextCommands! - Smiths - 12.09.2009

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!


Re: [HELP] TextCommands! - [eLg]Timmy - 12.09.2009

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


Re: [HELP] TextCommands! - Smiths - 12.09.2009

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"


Re: [HELP] TextCommands! - Smiths - 12.09.2009

i got errors in this line

cmd = strtok(cmdtext, idx);


Re: [HELP] TextCommands! - [eLg]Timmy - 12.09.2009

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;
}



Re: [HELP] TextCommands! - Smiths - 12.09.2009

where do i put this? oO


Re: [HELP] TextCommands! - [eLg]Timmy - 12.09.2009

e.g. at the end of your script.


Re: [HELP] TextCommands! - Smiths - 12.09.2009

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


Re: [HELP] TextCommands! - Smiths - 12.09.2009

bump please help!


Re: [HELP] TextCommands! - MadeMan - 12.09.2009

Change cmd to cmdtext.

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