[HELP] Possibly unattendend assignment
#1

Hi. I have this code:
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(IsPlayerConnected(playerid))
	{
		if(pickupid = LVElevPickup[0])
		{
			SetPlayerPos(playerid, 1616.606, 1153.107, -214.306);
		}
		else if(pickupid = LVElevPickup[1])
		{
			SetPlayerPos(playerid, 1614.222, 1166.552, 14.633);
		}
	}
	return 1;
}
and I get a warning "possibly unattended assignment". How to fix it? Defines:
Код:
new LVElevPickup[2];
LVElevPickup[0] = CreatePickup(1318, 23, 1614.143, 1164.305, 14.367); // LV-Elev-Up-Pickup
LVElevPickup[1] = CreatePickup(1318, 23, 1616.587, 1154.803, -214.248); // LV-Elev-Down-Pickup
Thanks.
Reply
#2

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(IsPlayerConnected(playerid))
	{
		if(pickupid == LVElevPickup[0])
		{
			SetPlayerPos(playerid, 1616.606, 1153.107, -214.306);
		}
		else if(pickupid == LVElevPickup[1])
		{
			SetPlayerPos(playerid, 1614.222, 1166.552, 14.633);
		}
	}
	return 1;
}
Reply
#3

What is changed?
Reply
#4

To compare variables, use ==. = is to set variables
Reply
#5

from:

if(pickupid = LVElevPickup[0])

else if(pickupid = LVElevPickup[1])


to:

if(pickupid == LVElevPickup[0])

else if(pickupid == LVElevPickup[1])


Reply
#6

Oh, yes, I forgot, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)