[HELP] Pickups -
Dudits - 11.04.2011
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == dPickup)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health +25);
DestroyPickup(dPickup);
return 1;
}
if(pickupid == bPickup)
{
GameTextForPlayer(playerid, "~r~CDM ~w~Bank~n~~w~Type ~r~/enter~w~ to go inside", 5000, 5);
return 1;
}
return 1;
}
When someone dies dPickup gets created.
dPickup gets created under ongamemodeinit.
The problem is bPickup doesn't work unless I delete the if conditional for dPickup, any ideas?
Re: [HELP] Pickups -
Dudits - 12.04.2011
Now bPickup get's destroyed due to the effect of dPickup, still having problems.
I actually do need to use return 1; here to prevent it from going through all pickups after it has already found the pickup if needs.
Edit: I thought about putting an array for the dPickup but I can't find a way to make it check through all dPickup[MAX_PLAYERS] then check if the pickup is active or not.
Re: [HELP] Pickups -
pagie1111 - 12.04.2011
Show us how you created the pickups also please.
Re: [HELP] Pickups -
Dudits - 12.04.2011
Under OnPlayerDeath
pawn Код:
GetPlayerPos(playerid, tx[playerid], ty[playerid], tz[playerid]);
DestroyPickup(dPickup);
dPickup = CreatePickup(1240, 23, tx[playerid], ty[playerid], tz[playerid], 0);
Under OnGameModeInit
pawn Код:
bPickup = CreatePickup(1239, 23, -794.9199, 1557.0032, 27.1244, 0);
Re: [HELP] Pickups -
pagie1111 - 12.04.2011
So, what happens here is that you make a non-destroyable pickup for when someone dies, but you destroy the current one that is out where some one died already and then you create another one under the same variable?
That just sounds weird... I'm guessing you're trying to develop a death drop script, am I correct?
EDIT:
Try something like this:
pawn Код:
new dPickup[MAX_PLAYERS];
new bPickup;
public OnGameModeInit()
{
bPickup = CreatePickup(1239, 23, -794.9199, 1557.0032, 27.1244, 0);
return 1;
}
public OnPlayerDeath(playerid,killerid, reason)
{
new Float:PlayerPos[3];
GetPlayerPos(playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]);
dPickup[playerid] = CreatePickup(1240, 23, PlayerPos[0], PlayerPos[1], PlayerPos[2], 0);
return 1;
}
public OnPlayerPickupPickup(playerid, pickupid)
{
if(pickupid == bPickup)
{
GameTextForPlayer(playerid, "~r~CDM ~w~Bank~n~~w~Type ~r~/enter~w~ to go inside", 5000, 5);
}
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(pickupid == dPickup[i])
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health +25);
DestroyPickup(dPickup[i]);
break;
}
else continue;
}
return 1;
}
Re: [HELP] Pickups -
Dudits - 12.04.2011
The bPickup works well now, but question:
Why does it do the same effect of dPickup if I put dPickup first on the script lines?
Re: [HELP] Pickups -
pagie1111 - 12.04.2011
Please show me your whole script. There must be something that is affecting this and it doesn't seem right because you are doing everything that should work.. I am determined to help you
Re: [HELP] Pickups -
Dudits - 12.04.2011
Hmmm showing my full script won't be a good idea lol

I started it all from scratch and it has some systems made up from scratch already.
What would affect the pickups anyways...?
Re: [HELP] Pickups -
pagie1111 - 12.04.2011
Hmm, Im not sure..
Re: [HELP] Pickups -
Dudits - 12.04.2011
Nothing... lol