Pickup

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • 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.

    Einmal editiert, zuletzt von Manyula ()

  • Hey,
    du gibst beim Timer ebenfalls nicht an welches Pickup


    Versuch es mal so


    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)
    {
    for(new i=0;i<10;i++)
    {
    if(i==0||i==1||i==2){ GivePlayerWeapon(playerid, GRENADE, 5); }
    if(i==3||i==4||i==5){ GivePlayerWeapon(playerid, ROCKET_LAUNCHER, 4); }
    if(i==6||i==7||i==8||i==9){ GivePlayerWeapon(playerid, HEAT_SEEKER, 5); }
    DestroyDynamicPickup(BF_WEAPON[i]);
    SetTimerEx("PickupRespawn", 45000, false,"i",i);
    }
    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;
    }

  • Mir bleiben noch die Errors:


    D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(130) : error 017: undefined symbol "BF_WEAPON"
    D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(130) : warning 215: expression has no effect
    D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(130) : error 001: expected token: ";", but found "]"
    D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(130) : error 029: invalid expression, assumed zero
    D:\Documents\SAMP 0.3x\pawno\include\Deathmatches.inc(130) : fatal error 107: too many error messages on one line


    Dürfte eigentlich nicht sein, da ich BF_WEAPON ja eigentlich definiert habe...
    Zeile 130 wäre hier:
    DestroyDynamicPickup(BF_WEAPON[i]);

  • 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)
    {
    for(new i=0;i<9;i++)
    {
    if(i==0||i==1||i==2){ GivePlayerWeapon(playerid, GRENADE, 5); }
    else if(i==3||i==4||i==5){ GivePlayerWeapon(playerid, ROCKET_LAUNCHER, 4); }
    else if(i==6||i==7||i==8||i==9){ GivePlayerWeapon(playerid, HEAT_SEEKER, 5); }
    DestroyDynamicPickup(BF_WEAPON[i]);
    SetTimerEx("PickupRespawn", 45000, false,"i",i);
    }
    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;
    }



    Hatte bei der Schleife statt 9 ne 10

  • Das ist auch nicht des Rätsels Lösung. Immer noch der Error auf Zeile 130.


    Stimmen die Parameter des Timer public's eigentlich? Oder muss da noch ein playerid dazu?


    EDIT: Ich Idiot... hab den Fehler gefunden. Im Script hatte ich den Waffenarray mit Großbuchstaben deklariert, und überall anders mit Kleinbuchstaben. -.-
    Vielen Dank!

    Einmal editiert, zuletzt von Manyula ()