WARNING 206
#1

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
Reply
#2

Код:
	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.
Reply
#3

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
Reply
#4

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 ><
Reply
#5

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

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
Reply
#7

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

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
Reply
#9

i already had that, but the error showed up
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)