Need a little help with this please ! :) -
Matej_ - 05.09.2010
I made in my script that when player is dead money pickup creates at there where
he was killed, but I need a litlle help with creating a timer so after 5 seconds that
pickup will be gone.
Please help me !
Re: Need a little help with this please ! :) -
LOLlolLOL - 05.09.2010
You have to assign an ID to the pickup and then in the function you run with the timer just use DestroyTImer for that timer ID.
Re: Need a little help with this please ! :) -
Matej_ - 05.09.2010
Quote:
Originally Posted by LOLlolLOL
You have to assign an ID to the pickup and then in the function you run with the timer just use DestroyTImer for that timer ID.
|
I created a pickup & other stuff, I just need a help creating a timer.

Where I need to put it & can you give me a example please ?
Re: Need a little help with this please ! :) -
Ironboy500[TW] - 05.09.2010
All you need to do is create DestroyPickup(pickupid); function, and add this timer under on player death.
Код:
SetTimerEx("DestroyPickup", 5000, false, "u", pickupid);
Re: Need a little help with this please ! :) -
Matej_ - 05.09.2010
Quote:
Originally Posted by Ironboy500[TW]
All you need to do is create DestroyPickup(pickupid); function, and add this timer under on player death.
Код:
SetTimerEx("DestroyPickup", 5000, false, "u", pickupid);
|
ok thanks !

But what is it there at "u" do I need to change that or just leave it ?
Re: Need a little help with this please ! :) -
Matej_ - 05.09.2010
It doesnt work, pickup is not gone after 5 seconds. !
Re: Need a little help with this please ! :) -
Hiddos - 05.09.2010
pawn Код:
new moneypickup[MAX_PICKUPS][2] = {-1, -1, ...};
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
new pickup = CreatePickup(1550, 23, pos[0], pos[1], pos[2]); //Might fuck around a bit with the '23'
moneypickup[pickup][0] = GetPlayerMoney(playerid); //The player loses all his money. Change this to whatever value the pickup must contain.
ResetPlayerMoney(playerid); //Resets the player's money, use GivePlayerMoney(playerid, -amount) to remove a specific amount.
moneypickup[p][1] = SetTimerEx("DeletePickupEx", 5*1000, 0, "d", pickup);
return 1;
}
forward DeletePickupEx(pickupid);
public DeletePickupEx(pickupid)
{
DestroyPickup(pickupid);
moneypickup[pickupid][0] = -1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new p; p < MAX_PICKUPS; p++)
{
if(moneypickup[p][0] != -1)
{
KillTimer(moneypickup[p][1]);
GivePlayerMoney(playerid, moneypickup[p][0]);
DestroyPickup(p);
}
}
return 1;
}
Didn't tested anything, and the typing box is a li'l small (Quick reply). Hope it works.
Re: Need a little help with this please ! :) -
Matej_ - 05.09.2010
Quote:
Originally Posted by Hiddos
pawn Код:
new moneypickup[MAX_PICKUPS][2] = {-1, -1, ...}; public OnPlayerDeath(playerid, killerid, reason) { new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
new pickup = CreatePickup(1550, 23, pos[0], pos[1], pos[2]); //Might fuck around a bit with the '23' moneypickup[pickup][0] = GetPlayerMoney(playerid); //The player loses all his money. Change this to whatever value the pickup must contain. ResetPlayerMoney(playerid); //Resets the player's money, use GivePlayerMoney(playerid, -amount) to remove a specific amount. moneypickup[p][1] = SetTimerEx("DeletePickupEx", 5*1000, 0, "d", pickup); return 1; }
forward DeletePickupEx(pickupid); public DeletePickupEx(pickupid) { DestroyPickup(pickupid); moneypickup[pickupid][0] = -1; }
public OnPlayerPickUpPickup(playerid, pickupid) { for(new p; p < MAX_PICKUPS; p++) { if(moneypickup[p][0] != -1) { KillTimer(moneypickup[p][1]); GivePlayerMoney(playerid, moneypickup[p][0]); DestroyPickup(p); } } return 1; }
Didn't tested anything, and the typing box is a li'l small (Quick reply). Hope it works.
|
I just get a lot of errors !
Re: Need a little help with this please ! :) -
Hiddos - 05.09.2010
Quote:
Originally Posted by Matej_
I just get a lot of errors ! 
|
Can you post em? I'll try to fix XD
Re: Need a little help with this please ! :) -
Matej_ - 06.09.2010
Quote:
Originally Posted by Hiddos
Can you post em? I'll try to fix XD
|
To much errors ! :/