hey ich habe das Problem das wenn ich in das Pickup laufe es 1000x ausgeführt wird
Oben
Code
#define Max_Weapon_Drop 100
enum Weapondrop_enum
{
wd_Weaponid,
wd_Muni,
wd_ID
}
new drop[Max_Weapon_Drop][Weapondrop_enum];
Alles anzeigen
OnFilterscriptInit
Code
for(new i = 0; i < sizeof(drop); i++)
{
drop[i][wd_ID] = -1;
drop[i][wd_Weaponid] = -1;
drop[i][wd_Muni] = -1;
if(i == sizeof(drop)) break;
}
OnPlayerDeath
Code
if(GetPlayerWeapon(playerid) != 0)
{
for(new i = 0; i < sizeof(drop); i++)
{
if(drop[i][wd_ID] == -1
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
drop[i][wd_Muni] = GetPlayerAmmo(playerid);
drop[i][wd_Weaponid] = GetPlayerWeapon(playerid);
drop[i][wd_ID] = CreatePickup(384,1,x,y,z,0);
}
}
}
Alles anzeigen
OnPlayerPickupPickup
Code
for(new i = 0; i < Max_Weapon_Drop; i++)
{
if(pickupid != drop[i][wd_ID]) continue;
if(drop[i][wd_ID] == -1)continue;
if(drop[i][wd_Weaponid] == -1);
if(drop[i][wd_Muni] == -1)continue;
GetWeaponName(drop[i][wd_Weaponid],wname,50);
format(string,sizeof(string),"%s mit %d Munnition",wname,drop[i][wd_Muni]);
SendClientMessage(playerid,-1,string);
GivePlayerWeapon(playerid,drop[i][wd_Weaponid],drop[i][wd_Muni]);
DestroyPickup(drop[i][wd_ID]);
drop[i][wd_ID] = -1;
ResetWeaponData(i);
}
}
Stock ResetWeaponData(i)
{
drop[i][wd_Muni] = -1;
drop[i][wd_Weaponid] = -1;
Return 1;
}
Alles anzeigen