A few questions.
#7

Quote:
Originally Posted by Pghpunkid
Quote:
Originally Posted by Kevon
Alright guys, tell me if this is right?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
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;
}

public OnPlayerCommandText(playerid,cmdtext[]){
  if(!strcmp("/b ",cmdtext,true,3)){
    if(cmdtext[3]){
      OnPlayerText(playerid,cmdtext[3]);
    }else SendClientMessage(playerid,COLOR_YOUWANT,"Usage:/b [text]");
     return true;
  }
  return false;
}
No.

Код:
public OnPlayerCommandText(playerid,cmdtext[]){
  if(!strcmp("/b ",cmdtext,true,3)){
    if(cmdtext[3]){
      OnPlayerText(playerid,cmdtext[3]);
    }else SendClientMessage(playerid,COLOR_YOUWANT,"Usage:/b [text]");
     return true;
  }
  return false;
}

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;
}
Well now I get this error

C:\Documents and Settings\Owner\My Documents\Goodfellas Server\pawno\Goodfellas.pwn(103) : error 017: undefined symbol "COLOR_YOUWANT"
C:\Documents and Settings\Owner\My Documents\Goodfellas Server\pawno\Goodfellas.pwn(104) : warning 217: loose indentation
C:\Documents and Settings\Owner\My Documents\Goodfellas Server\pawno\Goodfellas.pwn(106) : warning 209: function "OnPlayerCommandText" should return a value
C:\Documents and Settings\Owner\My Documents\Goodfellas Server\pawno\Goodfellas.pwn(106) : error 010: invalid function or declaration
C:\Documents and Settings\Owner\My Documents\Goodfellas Server\pawno\Goodfellas.pwn(197) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply


Messages In This Thread
A few questions. - by Kevon - 09.07.2009, 17:10
Re: A few questions. - by Anarkien - 09.07.2009, 17:12
Re: A few questions. - by arnutisz - 09.07.2009, 17:13
Re: A few questions. - by Kevon - 09.07.2009, 17:23
Re: A few questions. - by Pghpunkid - 09.07.2009, 17:25
Re: A few questions. - by Geekzor - 09.07.2009, 17:28
Re: A few questions. - by Kevon - 09.07.2009, 17:29
Re: A few questions. - by Pghpunkid - 09.07.2009, 17:35
Re: A few questions. - by Kevon - 09.07.2009, 17:47
Re: A few questions. - by Pghpunkid - 11.07.2009, 20:09

Forum Jump:


Users browsing this thread: 1 Guest(s)