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



OnPlayerPickUpPickup - amrour - 20.02.2009

my friend has scripted this:
Код:
	if (pickupid == 0)
	{
	GivePlayerMoney(playerid, 200);
	SendClientMessage(playerid, COLOR_GREEN, "Congratulations, you have found 200$");
	}
	return 1;
now i wanna do another pick up but i dunno how, i wrote:
Код:
	if (pickupid == 1)
	{
	SetPlayerHealth(playerid,100.0);
	}
	return 1;
}
and i get error unreachable code in line
Код:
	if (pickupid == 1)
i appriciate all the help


Re: OnPlayerPickUpPickup - SpiderPork - 20.02.2009

So... What you want us to do?


Re: OnPlayerPickUpPickup - amrour - 20.02.2009

i accidently saved before finishing post first time, read now.


Re: OnPlayerPickUpPickup - SpiderPork - 20.02.2009

You have to define the pickup:

Код:
new Pickup;

// OnPlayerPickUpPickup

if(pickupid == Pickup)

// rest of the code



Re: OnPlayerPickUpPickup - amrour - 20.02.2009

C:\Program Files\1 Igre\GTA San Andreas\GTA San Andreas\gamemodes\CnR.pwn(286) : warning 225: unreachable code
C:\Program Files\1 Igre\GTA San Andreas\GTA San Andreas\gamemodes\CnR.pwn(286) : error 017: undefined symbol "pickup"
C:\Program Files\1 Igre\GTA San Andreas\GTA San Andreas\gamemodes\CnR.pwn(330) : warning 203: symbol is never used: "Pickup"


Re: OnPlayerPickUpPickup - Vyorel - 20.02.2009

Exemple.
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if (pickupid == DMexitICON) GameTextForPlayer(playerid,"Type: ~r~/exitdm~n~~w~to exit the arena.",5000,5);
	return 1;
}



Re: OnPlayerPickUpPickup - Ghett0 - 20.02.2009

Here's an example.

pawn Код:
//Top of script
new Money;
Money = CreatePickup(blah blah blah);
//Rest of script
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if (pickupid == Money) {
        SendClientMessage(playerid, 0x00FF00FF, "You found $200!");
        GivePlayerMoney(playerid, 200);
    }
    return 1;
}
//Rest of script



Re: OnPlayerPickUpPickup - yom - 20.02.2009

Anything under a return obviously isn't executed. So the compiler throw a warning to tell you there is a problem near the indicated line.