SA-MP Forums Archive
WARNING 206 - 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: WARNING 206 (/showthread.php?tid=67942)



WARNING 206 - thuron - 05.03.2009

Hello,
in the next part of my script i get 2 warnings:

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == MainHallEnter)
{
  GameTextForPlayer(playerid, "Type /enter to enter the main hall.", 3000, 3);
return 1;
  }
if(pickupid == MainHallExit)
{
  GameTextForPlayer(playerid, "Type /exit to exit the main hall.", 3000, 3);
return 1;
}
return 0;
}
These are the warnings:
Код:
C:\Users\thuron\Desktop\SIR server\gamemodes\SIRRP.pwn(513) : warning 206: redundant test: constant expression is non-zero
C:\Users\thuron\Desktop\SIR server\gamemodes\SIRRP.pwn(518) : warning 206: redundant test: constant expression is non-zero
Pawn compiler 3.2.3664   Copyright © 1997-2006, ITB CompuPhase
2 Warnings.

The warnings point at this line:
Код:
if(pickupid == MainHallEnter)
And this line:
Код:
if(pickupid == MainHallExit)
this are the pickups:
Код:
	CreatePickup(1318,23,MainHallEnter);
	CreatePickup(1318,23,MainHallExit);
Does anyone know how to fix this problem??

thuron


Re: WARNING 206 - ғαιιοцт - 05.03.2009

Код:
	MainHallEnter = CreatePickup(1318, 23, X, Y, Z);
	MainHallExit = CreatePickup(1318, 23, X, Y, Z);
https://sampwiki.blast.hk/wiki/CreatePickup

and don't forget to fill in the X, Y and Z position of the pickup.


Re: WARNING 206 - Nubotron - 05.03.2009

And if MainHallEnter and MainHallExit are declared like this:
pawn Код:
#define MainHallEnter xxxx.xx, yyyy.yy, zzzz.zz
#define MainHallExit xxxx.xx, yyyy.yy, zzzz.zz
then on these lines you are doing:
pawn Код:
if(pickupid == xxxx.xx, yyyy.yy, zzzz.zz)
..

solution, declare 2 other variables, like
pawn Код:
new MainHallEnter_PickupId;
new MainHallExit_PickupId;
and then assign them to the CreatePickups
pawn Код:
MainHallEnter_PickupId = CreatePickup(1318,23,MainHallEnter);
MainHallExit_PickupId = CreatePickup(1318,23,MainHallExit);
and finally
pawn Код:
if (pickupid == MainHallEnter_PickupId)
voila


Re: WARNING 206 - ғαιιοцт - 05.03.2009

and... why would you do that for?
you can also define X, Y and Z in the function CreatePickup.. so why define them at the top of the script? for me it makes no sense ><


Re: WARNING 206 - Snyper18 - 05.03.2009

Warnings arent deadly.. So dont freak out about them. Although they cause bugs


Re: WARNING 206 - ғαιιοцт - 05.03.2009

Quote:
Originally Posted by Bruzer18
Warnings arent deadly.. So dont freak out about them. Although they cause bugs
he probally doesn't have
pawn Код:
#define MainHallEnter xxxx.xx, yyyy.yy, zzzz.zz
#define MainHallExit xxxx.xx, yyyy.yy, zzzz.zz


so thuron, you won't see any pickups this way


Re: WARNING 206 - thuron - 05.03.2009

i do: on top of my script:
Код:
#define MainHallEnter   -1704.5681, 785.7525, 25.2848
#define MainHallExit   246.6510,109.3008,1003.2188



Re: WARNING 206 - ғαιιοцт - 05.03.2009

Quote:
Originally Posted by thuron
i do: on top of my script:
Код:
#define MainHallEnter  -1704.5681, 785.7525, 25.2848
#define MainHallExit   246.6510,109.3008,1003.2188
ok that's good, it should compile without errors now


Re: WARNING 206 - thuron - 05.03.2009

i already had that, but the error showed up



Re: WARNING 206 - ғαιιοцт - 05.03.2009

Try this:
Код:
	MainHallEnter = CreatePickup(1318, 23, -1704.5681, 785.7525, 25.2848);
	MainHallExit = CreatePickup(1318, 23, 246.6510,109.3008,1003.2188);
and delete the defines on the top of your script.