Hi leude,
ich zeig euch mal wie ihr Weapon Drop in eurem Script eibauen könnt .
1.Die Includes
#include <a_samp>
#include <core>
#include <float>
2.Forwards
forward DropPlayerWeapons(playerid);
forward DeletePickup(pickupid);
forward GetWeaponModel(weaponid);
3.New's
new DropLimit=6;
new DeleteTime=10;
DropLimit=X = wieviele Waffen gedropt werden
DeleteTime=x = wieviele Sekunden die Waffe/n liegen bleiben
4.Publics
public OnPlayerDeath(playerid, killerid, reason)
{
DropPlayerWeapons(playerid);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
DestroyPickup(pickupid);
return 1;
}
public DropPlayerWeapons(playerid)
{
new playerweapons[13][2];
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0;i<13;i++){
GetPlayerWeaponData(playerid, i, playerweapons[i][0], playerweapons[i][1]);
new model=GetWeaponModel(playerweapons[i][0]);
new times=floatround(playerweapons[i][1]/10.0001);
new string[256];
format(string, sizeof(string), "%d", times);
times=strval(string);
new Float:X=x+(random(3)-random(3));
new Float:Y=y+(random(3)-random(3));
if(playerweapons[i][1]!=0)
{
if(times>DropLimit) times=DropLimit;
for(new a=0;a<times;a++)
{
if(model!=-1)
{
new pickupid=CreatePickup(model, 3, X, Y, z);
SetTimerEx("DeletePickup", DeleteTime*1000, false, "d", pickupid);
}
}
}
}
return 1;
}
public DeletePickup(pickupid)
{
DestroyPickup(pickupid);
return 1;
}
public GetWeaponModel(weaponid)
{
new model;
switch(weaponid)
{
case 1: model=331; case 2: model=333; case 3: model=334;
case 4: model=335; case 5: model=336; case 6: model=337;
case 7: model=338; case 8: model=339; case 9: model=341;
case 10: model=321; case 11: model=322; case 12: model=323;
case 13: model=324; case 14: model=325; case 15: model=326;
case 16: model=342; case 17: model=343; case 18: model=344;
case 22: model=346; case 23: model=347; case 24: model=348;
case 25: model=349; case 26: model=350; case 27: model=351;
case 28: model=352; case 29: model=353; case 30: model=355;
case 31: model=356; case 32: model=372; case 33: model=357;
case 34: model=358; case 35: model=359; case 36: model=360;
case 37: model=361; case 38: model=362; case 39: model=363;
case 41: model=365; case 42: model=366; case 46: model=371;
}
if(model<300) return -1;
return model;
}
soo beschreiben werd ich's später vllt nochmal besser x)
MfG