Help please
#2

  • Your strcmp check is wrong, strcmp returns 0 when a match was found, so you need to check if its return is equal to 0.
  • You're using strtok wrong in this example as well. Strtok tokenizes a string, and returns a token based on the current index. In the example you are getting the command itself, instead of the parameters. To fix this use strtok in the OnPlayerCommandText callback to get the command first, use strcmp to compare the token to make sure its the right command, and then use strtok again to get the parameters (all while using the same index, its passed by reference and will increment itself so you get the next token).
  • You're using a bad method to check if a string is null, you should use isnull by ******.
  • Your SendClientMessages are completely messed up (this is where the errors come from). In pawn, hex is represented by the constant "0x" so if you want a white color, you dont use #FFFFFFFF, you use 0xFFFFFFFF. The operator "#" is known as the stringize operator and turns the preceding hex color into a string, and thats why you're getting a type mismatch.
  • Another problem with you're SendClientMessage(ToAll) is that you're trying to use format specifiers, which doesnt work, for that you have to use the function format. Information can be found here
  • Indent your code so its easier to read and understand.

Also i'd look into sscanf and zcmd, its a LOT simpler and does a hell of a lot more in terms of functionality.
Reply


Messages In This Thread
Help please - by darkknight123 - 12.01.2011, 03:23
Re: Help please - by Kyosaur - 12.01.2011, 03:38
Re: Help please - by darkknight123 - 12.01.2011, 03:51
Re: Help please - by Kyosaur - 12.01.2011, 05:39

Forum Jump:


Users browsing this thread: 2 Guest(s)