Wieso spawnt er das Car nicht?

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
  • Hey Leute,


    habe jetzt meine Race Map fertig gemappt und wollte dieser jetzt noch die Funktionen scripten.


    Doch folgende Warnings welche verhindern, dass die Cars bei einem Pickup gaändert werden:


    I:\Testserver\gamemodes\DM.pwn(684) : warning 219: local variable "Infernus" shadows a variable at a preceding level
    I:\Testserver\gamemodes\DM.pwn(697) : warning 219: local variable "Infernus" shadows a variable at a preceding level
    I:\Testserver\gamemodes\DM.pwn(710) : warning 219: local variable "Infernus" shadows a variable at a preceding level
    I:\Testserver\gamemodes\DM.pwn(723) : warning 219: local variable "Infernus" shadows a variable at a preceding level
    I:\Testserver\gamemodes\DM.pwn(734) : warning 219: local variable "Hunter" shadows a variable at a preceding level
    I:\Testserver\gamemodes\DM.pwn(748) : warning 219: local variable "NRG" shadows a variable at a preceding level
    I:\Testserver\gamemodes\DM.pwn(761) : warning 219: local variable "NRG" shadows a variable at a preceding level
    I:\Testserver\gamemodes\DM.pwn(774) : warning 219: local variable "NRG" shadows a variable at a preceding level


    Code:


    if(pickupid == Infernus[0])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 522) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Infernus = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,Infernus,0);
    }
    }
    else if(pickupid == Infernus[1])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 522) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Infernus = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,Infernus,0);
    }
    }
    else if(pickupid == Infernus[2])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 522) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Infernus = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,Infernus,0);
    }
    }
    else if(pickupid == Infernus[3])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 522) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Infernus = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,Infernus,0);
    }
    }
    else if(pickupid == Hunter)
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 411) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Hunter = CreateVehicle(425, -3939.1460, 3331.2786, 483.8146, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,Hunter,0);
    SendClientMessage(playerid,0xFFFFFFFF,"Du hast den Hunter erreicht!");
    }
    }
    else if(pickupid == NRG[1])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 411) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new NRG = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,NRG,0);
    }
    }
    else if(pickupid == NRG[2])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 411) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new NRG = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,NRG,0);
    }
    }
    else if(pickupid == NRG[0])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 411) // 411 is the infernus model
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new NRG = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,NRG,0);
    }
    }


    Kann mir vielleicht jemand helfen?


    Mit freundlichen Grüßen .:Larso99:.

  • Jetzt habe ich dieses Problem: Wenn ich das Pickup betrete kommt kein Fahrzeug und es passiert nichts.


    Die Pickups:


    Infernus[0] = CreatePickup(1239,1, -3158.82813, 1766.37207, 31.7114,-1);
    NRG[0] = CreatePickup(1239,1, -3146.00439, 1866.65894, 43.66805,-1);
    Infernus[1] = CreatePickup(1239,1, -3263.30859, 2109.77002, 71.47034,-1);
    NRG[1] = CreatePickup(1239,1, -3409.01953, 2180.61523, 32.20464,-1);
    Infernus[2] = CreatePickup(1239,1, -3200.35742, 2424.35059, 33.83939,-1);
    NRG[2] = CreatePickup(1239,1, -3398.18457, 2257.15283, 33.92382,-1);
    Infernus[3] = CreatePickup(1239,1,-3420.92554, 2238.97681, 76.72187,-1);
    Hunter = CreatePickup(1239,1, -3945.85425, 3330.33398, 314.90033,-1);


    Weiß jemand wieso?

  • Infernus[0] = CreatePickup(1239,14, -3158.82813, 1766.37207, 31.7114);
    NRG[0] = CreatePickup(1239,14, -3146.00439, 1866.65894, 43.66805);
    Infernus[1] = CreatePickup(1239,14, -3263.30859, 2109.77002, 71.47034);
    NRG[1] = CreatePickup(1239,14, -3409.01953, 2180.61523, 32.20464);
    Infernus[2] = CreatePickup(1239,14, -3200.35742, 2424.35059, 33.83939);
    NRG[2] = CreatePickup(1239,14, -3398.18457, 2257.15283, 33.92382);
    Infernus[3] = CreatePickup(1239,14,-3420.92554, 2238.97681, 76.72187);
    Hunter = CreatePickup(1239,14, -3945.85425, 3330.33398, 314.90033);

  • tjoa habs grade als kleines fs getestet und klappt wunderbar-.-
    #include <a_samp>
    new Infernus[1];
    public OnFilterScriptInit()
    {
    Infernus[0] = CreatePickup(1239,14,-2049.9871,134.8025,27.6200,-1);
    return 1;
    }
    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    if(pickupid == Infernus[0])
    {
    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicle) == 522)
    {
    DestroyVehicle(vehicle);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new veh = CreateVehicle(411, x, y, z, 0.0000, -1, -1, 100);
    PutPlayerInVehicle(playerid,veh,0);
    }
    }
    return 1;
    }