Hallo,
ich bin an einem DM dran, und möchte Pickups erstellen, die beim Aufnehmen zerstört werden, und für alle Spieler im DM nach 45 Sekunden respawnt.
new BF_Weapon[10];
public OnGameModeInit()
{
BF_Weapon[0] = CreateDynamicPickup(342, 1, 120.5242, 1934.8777, 22.7578, 7, -1, -1, 100.0); //Grenade
BF_Weapon[1] = CreateDynamicPickup(342, 1, 279.4142, 1829.5718, 21.4766, 7, -1, -1, 100.0); //Grenade
BF_Weapon[2] = CreateDynamicPickup(342, 1, 116.2530, 1875.0065, 22.4375, 7, -1, -1, 100.0); //Grenade
BF_Weapon[3] = CreateDynamicPickup(342, 1, 136.4600, 1874.9723, 22.4375, 7, -1, -1, 100.0); //Grenade
BF_Weapon[4] = CreateDynamicPickup(359, 1, 189.9938, 1940.4785, 17.6406, 7, -1, -1, 100.0); //Rocket Launcher
BF_Weapon[5] = CreateDynamicPickup(359, 1, 206.2279, 1932.8312, 23.2422, 7, -1, -1, 100.0); //Rocket Launcher
BF_Weapon[6] = CreateDynamicPickup(360, 1, 144.0044, 1850.1791, 25.2610, 7, -1, -1, 100.0); //Heat Seeker
BF_Weapon[7] = CreateDynamicPickup(360, 1, 211.4619, 1809.8109, 25.1172, 7, -1, -1, 100.0); //Heat Seeker
BF_Weapon[8] = CreateDynamicPickup(360, 1, 146.3869, 1907.3638, 26.3924, 7, -1, -1, 100.0); //Heat Seeker
BF_Weapon[9] = CreateDynamicPickup(360, 1, 197.3199, 1835.0059, 23.2422, 7, -1, -1, 100.0); //Heat Seeker
return DM_OnGameModeInit();
}
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
if(pickupid == BF_WEAPON[0])
{
GivePlayerWeapon(playerid, GRENADE, 5);
DestroyDynamicPickup(BF_WEAPON[0]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[1])
{
GivePlayerWeapon(playerid, GRENADE, 5);
DestroyDynamicPickup(BF_WEAPON[1]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[2])
{
GivePlayerWeapon(playerid, GRENADE, 5);
DestroyDynamicPickup(BF_WEAPON[2]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[3])
{
GivePlayerWeapon(playerid, GRENADE, 5);
DestroyDynamicPickup(BF_WEAPON[3]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[4])
{
GivePlayerWeapon(playerid, ROCKET_LAUNCHER, 4);
DestroyDynamicPickup(BF_WEAPON[4]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[5])
{
GivePlayerWeapon(playerid, ROCKET_LAUNCHER, 4);
DestroyDynamicPickup(BF_WEAPON[5]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[6])
{
GivePlayerWeapon(playerid, HEAT_SEEKER, 3);
DestroyDynamicPickup(BF_WEAPON[6]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[7])
{
GivePlayerWeapon(playerid, HEAT_SEEKER, 3);
DestroyDynamicPickup(BF_WEAPON[7]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[8])
{
GivePlayerWeapon(playerid, HEAT_SEEKER, 3);
DestroyDynamicPickup(BF_WEAPON[8]);
SetTimer("PickupRespawn", 45000, false);
}
if(pickupid == BF_WEAPON[9])
{
GivePlayerWeapon(playerid, HEAT_SEEKER, 3);
DestroyDynamicPickup(BF_WEAPON[9]);
SetTimer("PickupRespawn", 45000, false);
}
return DM_OnPlayerPickUpDynamicPickup(playerid, pickupid);
}
forward (PickupRespawn(pickupid);
public PickupRespawn(pickupid)
{
if(pickupid == BF_WEAPON[0]) return CreateDynamicPickup(342, 1, 120.5242, 1934.8777, 22.7578, 7, -1, -1, 100.0); //Grenade
if(pickupid == BF_WEAPON[1]) return CreateDynamicPickup(342, 1, 279.4142, 1829.5718, 21.4766, 7, -1, -1, 100.0); //Grenade
if(pickupid == BF_WEAPON[2]) return CreateDynamicPickup(342, 1, 116.2530, 1875.0065, 22.4375, 7, -1, -1, 100.0); //Grenade
if(pickupid == BF_WEAPON[3]) return CreateDynamicPickup(342, 1, 136.4600, 1874.9723, 22.4375, 7, -1, -1, 100.0); //Grenade
if(pickupid == BF_WEAPON[4]) return CreateDynamicPickup(359, 1, 189.9938, 1940.4785, 17.6406, 7, -1, -1, 100.0); //Rocket Launcher
if(pickupid == BF_WEAPON[5]) return CreateDynamicPickup(359, 1, 206.2279, 1932.8312, 23.2422, 7, -1, -1, 100.0); //Rocket Launcher
if(pickupid == BF_WEAPON[6]) return CreateDynamicPickup(360, 1, 144.0044, 1850.1791, 25.2610, 7, -1, -1, 100.0); //Heat Seeker
if(pickupid == BF_WEAPON[7]) return CreateDynamicPickup(360, 1, 211.4619, 1809.8109, 25.1172, 7, -1, -1, 100.0); //Heat Seeker
if(pickupid == BF_WEAPON[8]) return CreateDynamicPickup(360, 1, 146.3869, 1907.3638, 26.3924, 7, -1, -1, 100.0); //Heat Seeker
if(pickupid == BF_WEAPON[9]) return CreateDynamicPickup(360, 1, 197.3199, 1835.0059, 23.2422, 7, -1, -1, 100.0); //Heat Seeker
return 1;
}
Allerdings, wenn ich in ein Pickup reinlaufe, dann passiert absolut nichts. Was mache ich falsch?
EDIT: Ich kriege folgende Errors:
D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(349) : error 017: undefined symbol "BF_WEAPON"
D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(349) : warning 215: expression has no effect
D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(349) : error 001: expected token: ";", but found "]"
D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(349) : error 029: invalid expression, assumed zero
D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(349) : fatal error 107: too many error messages on one line
EDIT2: "PickupRespawn" public updated.