SA-MP Forums Archive
[HELP] Possibly unattendend assignment - 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: [HELP] Possibly unattendend assignment (/showthread.php?tid=73232)



[HELP] Possibly unattendend assignment - NtCat - 13.04.2009

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.


Re: [HELP] Possibly unattendend assignment - GanG$Ta - 13.04.2009

Код:
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;
}



Re: [HELP] Possibly unattendend assignment - NtCat - 13.04.2009

What is changed?


Re: [HELP] Possibly unattendend assignment - Nubotron - 13.04.2009

To compare variables, use ==. = is to set variables


Re: [HELP] Possibly unattendend assignment - GanG$Ta - 13.04.2009

from:

if(pickupid = LVElevPickup[0])

else if(pickupid = LVElevPickup[1])


to:

if(pickupid == LVElevPickup[0])

else if(pickupid == LVElevPickup[1])





Re: [HELP] Possibly unattendend assignment - NtCat - 13.04.2009

Oh, yes, I forgot, thanks