27.09.2018, 19:05
Well i just made a weapon and health pickups and everything seem to work but , the pickup sound sometimes is not synced on the moment you taking the pickup, it seems like once you took it the sounds are looping or even before you taking them. Well that's just a lost case which i dont seem to understand what's causing it.
This is the drop pickups
Even tho... i'm not using any sounds here
This is the drop pickups
PHP код:
function create_player_drops(playerid)
{
new Float: x, Float: y, Float: z, p_weapon, p_ammo, getspace;
GetPlayerPos(playerid, x, y, z);
pickup_Health = CreatePickup(1240, 3, x, y+1, z, -1);
for (new i = 0; i < 12; i++)
{
GetPlayerWeaponData(playerid, i, p_weapon, p_ammo);
getspace++;
pickup_Weapon[i] = CreatePickup(WeaponObject(p_weapon), 3, x+getspace, y, z, -1);
}
SetTimerEx("DestroyPlayerDrops", 10000, false, "i", playerid);
return 1;
}
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new Float: HP;
if(pickupid == pickup_Weapon[playerid]) DestroyPickup(pickup_Weapon[playerid]);
if(pickupid == pickup_Health)
{
GetPlayerHealth(playerid, HP);
if(HP < 80) SetPlayerHealth(playerid, HP+20);
DestroyPickup(pickup_Health);
}
return 1;
}