Sscanf problem
#1

Hello,
I am new at sscanf and i'm am busy with the tutorial of it on wikipedia
but i made one sscanf command this is the command

Код:
	{
	dcmd(heal, 4, cmdtext);
	return 0;
	}

	dcmd_heal(playerid, params[])
	{
	new
	id;
	if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
	else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	else
	{
		SetPlayerHealth(id, 100.0);
		SendClientMessage(id, 0x00FF00AA, "You have been healed");
		SendClientMessage(playerid, 0x00FF00AA, "Player healed");
	}
	return 1;
	}
but i get undefined symbol errors and everything

Код:
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1596) : error 017: undefined symbol "dcmd_heal"
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1600) : warning 225: unreachable code
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1600) : error 017: undefined symbol "dcmd_heal"
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1604) : error 017: undefined symbol "params"
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1614) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
help plz
if i learned this i can make alot of new things
Reply
#2

1. Do you have dcmd #define on top of your script?

2. Are you sure that dcmd_heal(playerid, params[]) is OUTSIDE of OnPlayerCommandText ?
Reply
#3

I have the define line above on my script under the includes

and yea

the command is in onplayercommandtext
Reply
#4

Quote:
Originally Posted by ekeleke
the command is in onplayercommandtext
In OnPlayerCommandText? Should be out
Reply
#5

Ok i'll try
Reply
#6

Srry for double post

if i put it outside of onplayercommandtext i get these errors

Код:
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1862) : error 055: start of function body without function header
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1863) : error 010: invalid function or declaration
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1864) : error 010: invalid function or declaration
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(2158) : warning 203: symbol is never used: "dcmd_heal"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#7

Can you show lines 1862 - 1864?
Reply
#8

1862 {
1863 dcmd(heal, 4, cmdtext);
1864 return 0;
1865 }
Reply
#9

Maybe you misunderstood something but dcmd(heal, 4, cmdtext); should be inside OnPlayerCommandText and dcmd_heal(playerid, params[]) outside.
Reply
#10

oh i did that

now i only have one warning

but it is a stupid warning... unreachable code

Код:
C:\Gta Sa Server Vernieuwd\gamemodes\freeroam.pwn(1599) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
i have done what you said
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)