01.06.2015, 13:26
This could bug, if more than 1 guy dies
Write it like this:
Greekz
Write it like this:
PHP код:
new Death_Pick[3][MAX_PLAYERS];
public OnPlayerDeath(playerid,killerid,reason)
{
if(GetPlayerMoney(playerid) > 0)
{
Death_Pick[0][playerid] = GetPlayerMoney(playerid);
GivePlayerMoney(playerid,-Death_Pick[0][playerid]);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
Death_Pick[1][playerid] = CreatePickup(1212, 2, x, y, z, GetPlayerVirtualWorld(playerid));
Death_Pick[2][playerid] = SetTimerEx("@dP",1000*15,0,"i",playerid);
}
else SendClientMessage(playerid,-1,"* Lucker, you have no money to loose!");
return 1;
}
@dP(i);@dP(i) return DestroyPickup(Death_Pick[1][i]),Death_Pick[1][i]=0;
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i; i<MAX_PLAYERS; i++) {
if(Death_Pick[1][i] != pickupid) continue;
GivePlayerMoney(playerid,Death_Pick[0][i]),
DestroyPickup(Death_Pick[1][i]),
KillTimer(Death_Pick[2][i]),
Death_Pick[1][i]=0;
break;
}
return 1;
}