Panzer mit X Schuss....

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
  • Das stimmt natürlich


    Ich meinte eigentlich das mit dem return 0; das mit der Munition hätte ich selbst gemacht ^^

    Das ganze geht dazu hat jemand auch mal eine Include geschrieben


    Leider nichts gefunden danke schaue sie mir mal an


    Edit:


    Kaliber: kannst du dir die Include mal anschauen, ist womöglich falsch gehookt
    Bekomme immer den ErrorC:\Users\Christian\Desktop\Server\gamemodes\em.pwn(422) : error 025: function heading differs from prototype


    Danke dir

  • Das liegt am hook der Parameter reason gab es damals noch nicht einfach diesen in der include hinzufügen



    /*
    © Gamer931215
    This script allows to detect deathmatching vehicles and disable them when needed
    */


    //includes/defines
    #include <a_samp>
    #define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
    forward OnPlayerVehicleFire(playerid,vehicleid,allowed);

    /*
    These natives are commented to "fake" the natives for providing autocomplete when included
    native ToggleVehicleWeaponsForAll()
    native ToggleVehicleWeaponsForPlayer(playerid)
    */



    //local variables
    new filter[] = {
    447, //seasparrow
    476, //rustler
    425, //hunter
    520, //hydra
    430, //predator
    432 //rhino
    };
    new DisableForAll = 1;


    //public functions
    stock ToggleVehicleWeaponsForAll(toggle)
    {
    if(toggle == 1)
    {
    DisableForAll = 0;
    } else DisableForAll = 1;
    }


    stock ToggleVehicleWeaponsForPlayer(playerid,toggle)
    {
    SetPVarInt(playerid,"__allowed",toggle);
    }


    stock CanPlayerShootInVehicle(playerid)
    {
    if(DisableForAll == 0)
    {
    return true;
    } else {
    if(GetPVarInt(playerid,"__allowed") == 1)
    {
    return true;
    }
    }
    return false;
    }


    // SA-MP Default functions:


    public OnPlayerUpdate(playerid)
    {
    new keys,updown,leftright;
    GetPlayerKeys(playerid,keys,updown,leftright);
    if(IsPlayerInArmedVehicle(playerid))
    {
    switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
    {
    case 447,476,520: //vehicles with only one weapon
    {
    if(keys & KEY_ACTION)
    {
    if(GetPVarInt(playerid,"__shot") == 0)
    {
    SetPVarInt(playerid,"__shot",1);
    CallLocalFunction("OnPlayerVehicleFire","iii",playerid,GetPlayerVehicleID(playerid),CanPlayerShootInVehicle(playerid));
    return 0;
    }
    }
    }
    default: //all the other vehicles in filter (use KEY_ACTION and KEY_FIRE)
    {
    if(keys & KEY_ACTION || keys & KEY_FIRE) //respond to primary and secondary fire key (like hunter)
    {
    if(GetPVarInt(playerid,"__shot") == 0)
    {
    SetPVarInt(playerid,"__shot",1);
    CallLocalFunction("OnPlayerVehicleFire","iii",playerid,GetPlayerVehicleID(playerid),CanPlayerShootInVehicle(playerid));
    return 0;
    }
    }
    }
    }
    }
    return CallLocalFunction("nodmforu_OnPlayerUpdate","i",playerid);
    }
    #if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
    #else
    #define _ALS_OnPlayerUpdate
    #endif
    #define OnPlayerUpdate nodmforu_OnPlayerUpdate
    forward nodmforu_OnPlayerUpdate(playerid);


    public OnPlayerConnect(playerid)
    {
    SetPVarInt(playerid,"__shot",0);
    if(DisableForAll == 1)
    {
    SetPVarInt(playerid,"__allowed",0);
    } else SetPVarInt(playerid,"__allowed",1);
    return CallLocalFunction("nodmforu_OnPlayerConnect","i",playerid);
    }
    #if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
    #else
    #define _ALS_OnPlayerConnect
    #endif
    #define OnPlayerConnect nodmforu_OnPlayerConnect
    forward nodmforu_OnPlayerConnect(playerid);


    public OnPlayerDisconnect(playerid,reason)
    {
    DeletePVar(playerid,"__shot");
    DeletePVar(playerid,"__allowed");
    return CallLocalFunction("nodmforu_OnPlayerDisconnect","ii",playerid,reason);
    }
    #if defined _ALS_OnPlayerDisconnect
    #undef OnPlayerDisconnect
    #else
    #define _ALS_OnPlayerDisconnect
    #endif
    #define OnPlayerDisconnect nodmforu_OnPlayerDisconnect
    forward nodmforu_OnPlayerDisconnect(playerid,reason);


    public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
    {
    if (!(newkeys & KEY_FIRE) && (oldkeys & KEY_FIRE)) //player released fire key
    {
    SetPVarInt(playerid,"__shot",0);
    }
    if (!(newkeys & KEY_ACTION) && (oldkeys & KEY_ACTION)) //player released fire key
    {
    SetPVarInt(playerid,"__shot",0);
    }
    return CallLocalFunction("nodmforu_OnPlayerKeyStateChange","iii",playerid,newkeys,oldkeys);
    }
    #if defined _ALS_OnPlayerKeyStateChange
    #undef OnPlayerKeyStateChange
    #else
    #define _ALS_OnPlayerKeyStateChange
    #endif
    #define OnPlayerKeyStateChange nodmforu_OnPlayerKeyStateChange
    forward nodmforu_OnPlayerKeyStateChange(playerid,newkeys,oldkeys);


    stock IsPlayerInArmedVehicle(playerid)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    for(new i = 0;i<strlen(filter);i++)
    {
    if(filter[i] == GetVehicleModel(GetPlayerVehicleID(playerid)))
    {
    return true;
    }
    }
    }
    return false;
    }