Hi.
Wenn man stirbt, wie kann man es machen das die Waffen die man hat am Boden liegen.
Und auch ein Herz.
Hi.
Wenn man stirbt, wie kann man es machen das die Waffen die man hat am Boden liegen.
Und auch ein Herz.
#define MAX_PICKUPS 400
#define PICKUP_TYPE_WEAPON 1
new PickupType[MAX_PICKUPS];
new PickupWeapon[MAX_PICKUPS];
new PickupAmmo[MAX_PICKUPS];
new DestroyPickupTimer[MAX_PICKUPS];
forward DropWeapons(playerid);
public DropWeapons(playerid)
{
if(IsPlayerConnected(playerid))
{
#define MAX 300
new weaponid,ammo,modelid,pickupid;
new success=false;
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=1;i<12;i++)
{
GetPlayerWeaponData(playerid,i,weaponid,ammo);
if(weaponid)
{
if(ammo>MAX)
ammo=MAX;
modelid=GetWeaponModel(weaponid);
if(modelid)
{
pickupid=CreatePickup(modelid,1,x+(random(10)-random(10)),y+(random(10)-random(10)),z);
PickupType[pickupid]=PICKUP_TYPE_WEAPON;
PickupWeapon[pickupid]=weaponid;
PickupAmmo[pickupid]=ammo;
DestroyPickupTimer[pickupid]=SetTimerEx("DestroyWeaponPickup",10000+random(1000),false,"i",pickupid);
success=true;
}
}
}
ResetPlayerWeapons(playerid);
#undef MAX
return success;
}
return 0;
}
forward DestroyWeaponPickup(pickupid);
public DestroyWeaponPickup(pickupid)
{
if(PickupType[pickupid]==PICKUP_TYPE_WEAPON)
{
PickupType[pickupid]=PICKUP_TYPE_NONE;
PickupWeapon[pickupid]=0;
PickupAmmo[pickupid]=0;
DestroyPickup(pickupid);
return 1;
}
return 0;
}
stock GetWeaponModel(weaponid)
{
switch(weaponid)
{
case 1:
return 331;
case 2..8:
return weaponid+331;
case 9:
return 341;
case 10..15:
return weaponid+311;
case 16..18:
return weaponid+326;
case 22..29:
return weaponid+324;
case 30,31:
return weaponid+325;
case 32:
return 372;
case 33..45:
return weaponid+324;
case 46:
return 371;
}
return 0;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
switch(PickupType[pickupid])
{
case PICKUP_TYPE_WEAPON:
{
GivePlayerWeapon(playerid,PickupWeapon[pickupid],PickupAmmo[pickupid]);
KillTimer(DestroyPickupTimer[pickupid]);
DestroyWeaponPickup(pickupid);
}
}
return 1;
}
Alles anzeigen#define MAX_PICKUPS 400
#define PICKUP_TYPE_WEAPON 1
new PickupType[MAX_PICKUPS];
new PickupWeapon[MAX_PICKUPS];
new PickupAmmo[MAX_PICKUPS];
new DestroyPickupTimer[MAX_PICKUPS];
forward DropWeapons(playerid);
public DropWeapons(playerid)
{
if(IsPlayerConnected(playerid))
{
#define MAX 300
new weaponid,ammo,modelid,pickupid;
new success=false;
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=1;i<12;i++)
{
GetPlayerWeaponData(playerid,i,weaponid,ammo);
if(weaponid)
{
if(ammo>MAX)
ammo=MAX;
modelid=GetWeaponModel(weaponid);
if(modelid)
{
pickupid=CreatePickup(modelid,1,x+(random(10)-random(10)),y+(random(10)-random(10)),z);
PickupType[pickupid]=PICKUP_TYPE_WEAPON;
PickupWeapon[pickupid]=weaponid;
PickupAmmo[pickupid]=ammo;
DestroyPickupTimer[pickupid]=SetTimerEx("DestroyWeaponPickup",10000+random(1000),false,"i",pickupid);
success=true;
}
}
}
ResetPlayerWeapons(playerid);
#undef MAX
return success;
}
return 0;
}
forward DestroyWeaponPickup(pickupid);
public DestroyWeaponPickup(pickupid)
{
if(PickupType[pickupid]==PICKUP_TYPE_WEAPON)
{
PickupType[pickupid]=PICKUP_TYPE_NONE;
PickupWeapon[pickupid]=0;
PickupAmmo[pickupid]=0;
DestroyPickup(pickupid);
return 1;
}
return 0;
}
stock GetWeaponModel(weaponid)
{
switch(weaponid)
{
case 1:
return 331;
case 2..8:
return weaponid+331;
case 9:
return 341;
case 10..15:
return weaponid+311;
case 16..18:
return weaponid+326;
case 22..29:
return weaponid+324;
case 30,31:
return weaponid+325;
case 32:
return 372;
case 33..45:
return weaponid+324;
case 46:
return 371;
}
return 0;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
switch(PickupType[pickupid])
{
case PICKUP_TYPE_WEAPON:
{
GivePlayerWeapon(playerid,PickupWeapon[pickupid],PickupAmmo[pickupid]);
KillTimer(DestroyPickupTimer[pickupid]);
DestroyWeaponPickup(pickupid);
}
}
return 1;
}
Geht net
: error 017: undefined symbol "MAX_PICKUPS"
: error 009: invalid array size (negative, zero or out of bounds)
: error 017: undefined symbol "MAX_PICKUPS"
: error 009: invalid array size (negative, zero or out of bounds)
: error 017: undefined symbol "MAX_PICKUPS"
: error 009: invalid array size (negative, zero or out of bounds)
: error 017: undefined symbol "MAX_PICKUPS"
: error 009: invalid array size (negative, zero or out of bounds)
: error 017: undefined symbol "PICKUP_TYPE_NONE"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
9 Errors.
[/pwn]