OnPlayerPickUpPickup
#1

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

So... What you want us to do?
Reply
#3

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

You have to define the pickup:

Код:
new Pickup;

// OnPlayerPickUpPickup

if(pickupid == Pickup)

// rest of the code
Reply
#5

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)