sscanf problem
#5

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
First of all you are doing all the stuff when sscanf stuff. It returns 0 if it succeeds so change
Код:
if (sscanf...)
to
Код:
if (!sscanf...)
if (!...) is the same thing as if (... == 0)
so as sscanf fails the targetid is 0 or INVALID_PLAYER_ID I assume.
Second you are using strcmp on params when you check the type, you must use it on the "type" string.
Third you should also check if the target ID is invalid by checking if it's INVALID_PLAYER_ID.

Also it's printing something else because targetid is an integer and you are trying to print it as a string, use %i or %d instead. Also you don't need 256 cells for messages because the max length of a client message is 144 as far as I know. You should even use less than 144.
I understand this. I tried using ! before but it still didn't work. I fixed the print but it now displays the 'targetid' as 111. How did that happen? It still says "You are too far away from the player." It clearly is something wrong with targetid.
Reply


Messages In This Thread
sscanf problem - by boy - 24.01.2017, 02:05
Re: sscanf problem - by TheAngryBird - 24.01.2017, 02:31
Re: sscanf problem - by bugmenotlol - 24.01.2017, 03:28
Re: sscanf problem - by GoldenLion - 24.01.2017, 05:18
Re: sscanf problem - by boy - 24.01.2017, 20:48
Re: sscanf problem - by iamjems - 24.01.2017, 20:54
Re: sscanf problem - by boy - 24.01.2017, 21:44
Re: sscanf problem - by iamjems - 24.01.2017, 21:48
Re: sscanf problem - by boy - 24.01.2017, 21:56
Re: sscanf problem - by BroZeus - 25.01.2017, 06:18

Forum Jump:


Users browsing this thread: 3 Guest(s)