Timer funkt 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
  • Also..ich will, dass die Waffe nach 3 Minuten verschwindet und habe dafür auch einen Timer gemacht..jedoch klappt es nicht..wisst ihr vllt wieso ?
    Es ist ein Filterscript..


    #define FILTERSCRIPT
    #include <a_samp>


    // Configs:
    #define MAX_OBJ 50 // Limit
    #define SAVING // Uncomment this line if you want to save dropped guns to restore them after FS restarts
    forward Destroy_Weapon();
    // -----------------------------------------------------------------------------
    enum dGunEnum
    {
    Float:ObjPos[3],
    ObjID,
    ObjData[2]
    };
    new dGunData[MAX_OBJ][dGunEnum];
    // -----------------------------------------------------------------------------
    new GunNames[48][] = {
    "Nichts", "Schlagring", "Golfschläger", "Schlagstock", "Messer", "Baseballschläger",
    "Schaufel", "Billiardstock", "Katana", "Motorsäge", "Lila Dildo", "Kleiner weißer Dildo",
    "Langer weißer Dildo", "Vibrator", "Blumen", "Rohrstock", "Granate", "Tränengas", "Molotov",
    "Fahrzeugrakete", "Hydra Fackel", "Jetpack", "Glock", "SD Pistole", "Deagle",
    "Schrotflinte", "Abgesägte Schrotflinte", "SPAS 12", "Micro UZI", "MP5", "AK47", "M4", "Tec9",
    "Gewehr", "Scharfschützengewehr", "Raketenwerfer", "HS Raketenwerfer", "Flamenwerfer", "Minigun",
    "Rucksackbombe", "Zünder", "Spraydose", "Feuerlöscher", "Kamera", "Nachtsicht",
    "Infrarot Nachtsicht", "Fallschirm", "Gefälschte Pistole"
    };
    // -----------------------------------------------------------------------------
    new GunObjects[47] = {
    0,331,333,334,335,336,337,338,339,341,321,322,323,324,325,326,342,343,344,
    0,0,0,346,347,348,349,350,351,352,353,355,356,372,357,358,359,360,361,362,
    363,364,365,366,367,368,368,371
    };


    // -----------------------------------------------------------------------------
    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(cmdtext, "/wablegen", true) == 0)
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new GunID = GetPlayerWeapon(playerid);
    new GunAmmo = GetPlayerAmmo(playerid);
    if(GunID > 0 && GunAmmo != 0)
    {
    new f = MAX_OBJ+1;
    for(new a = 0; a < MAX_OBJ; a++)
    {
    if(dGunData[a][ObjPos][0] == 0.0)
    {
    f = a;
    break;
    }
    }
    if(f > MAX_OBJ) return SendClientMessage(playerid, 0x00A4FFFF, "In diesem Moment kannst du keine Waffe ablegen!");
    RemovePlayerWeapon(playerid, GunID);
    dGunData[f][ObjData][0] = GunID;
    dGunData[f][ObjData][1] = GunAmmo;
    GetPlayerPos(playerid, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]);
    dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, 120.0);
    new buffer[50];
    format(buffer, sizeof(buffer), "%s wurde von dir abgelegt.", GunNames[dGunData[f][ObjData][0]]);
    SendClientMessage(playerid, 0x00A4FFFF, buffer);
    SetTimerEx("Destroy_Weapon", 180000, false,"i",dGunData[f][ObjID]);
    }
    return 1;
    }
    if(strcmp(cmdtext, "/wnehmen", true) == 0)
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new f = MAX_OBJ+1;
    for(new a = 0; a < MAX_OBJ; a++)
    {
    if(IsPlayerInRangeOfPoint(playerid, 5.0, dGunData[a][ObjPos][0], dGunData[a][ObjPos][1], dGunData[a][ObjPos][2]))
    {
    f = a;
    break;
    }
    }
    if(f > MAX_OBJ) return SendClientMessage(playerid, 0x00A4FFFF, "Du bist nicht in der Nähe einer Waffe!");
    DestroyObject(dGunData[f][ObjID]);
    GivePlayerWeapon(playerid, dGunData[f][ObjData][0], dGunData[f][ObjData][1]);
    dGunData[f][ObjPos][0] = 0.0;
    dGunData[f][ObjPos][1] = 0.0;
    dGunData[f][ObjPos][2] = 0.0;
    dGunData[f][ObjID] = -1;
    //dGunData[f][ObjData][0] = 0;
    dGunData[f][ObjData][1] = 0;
    new buffer[50];
    format(buffer, sizeof(buffer), "%s wurde von dir aufgehoben.", GunNames[dGunData[f][ObjData][0]]);
    SendClientMessage(playerid, 0x00A4FFFF, buffer);
    return 1;
    }
    return 0;
    }
    // -----------------------------------------------------------------------------
    public OnPlayerDeath(playerid, killerid, reason)
    {
    new Float:pPosX, Float:pPosY, Float:pPosZ;
    GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
    for(new i_slot = 0, gun, ammo; i_slot != 12; i_slot++)
    {
    GetPlayerWeaponData(playerid, i_slot, gun, ammo);
    if(gun != 0 && ammo != 0) CreateDroppedGun(gun, ammo, pPosX+random(2)-random(2), pPosY+random(2)-random(2), pPosZ);
    }
    return 1;
    }


    stock CreateDroppedGun(GunID, GunAmmo, Float:gPosX, Float:gPosY, Float:gPosZ)
    {
    new f = MAX_OBJ+1;
    for(new a = 0; a < MAX_OBJ; a++)
    {
    if(dGunData[a][ObjPos][0] == 0.0)
    {
    f = a;
    break;
    }
    }
    if(f > MAX_OBJ) return;
    dGunData[f][ObjData][0] = GunID;
    dGunData[f][ObjData][1] = GunAmmo;
    dGunData[f][ObjPos][0] = gPosX;
    dGunData[f][ObjPos][1] = gPosY;
    dGunData[f][ObjPos][2] = gPosZ;
    dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, random(360));
    SetTimerEx("Destroy_Weapon", 180000, false,"i",dGunData[f][ObjID]);
    return;
    }
    // -----------------------------------------------------------------------------
    stock RemovePlayerWeapon(playerid, weaponid)
    {
    new plyWeapons[12] = 0;
    new plyAmmo[12] = 0;
    for(new sslot = 0; sslot != 12; sslot++)
    {
    new wep, ammo;
    GetPlayerWeaponData(playerid, sslot, wep, ammo);
    if(wep != weaponid && ammo != 0) GetPlayerWeaponData(playerid, sslot, plyWeapons[sslot], plyAmmo[sslot]);
    }
    ResetPlayerWeapons(playerid);
    for(new sslot = 0; sslot != 12; sslot++) if(plyAmmo[sslot] != 0) GivePlayerWeapon(playerid, plyWeapons[sslot], plyAmmo[sslot]);
    return 1;
    }
    stock split(const strsrc[], strdest[][], delimiter)
    {
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc))
    {
    if(strsrc[i]==delimiter || i==strlen(strsrc))
    {
    len = strmid(strdest[aNum], strsrc, li, i, 128);
    strdest[aNum][len] = 0;
    li = i+1;
    aNum++;
    }
    i++;
    }
    return 1;
    }


    public Destroy_Weapon()
    {
    new f = MAX_OBJ+1;
    DestroyObject(dGunData[f][ObjID]);
    return 0;
    }

  • wenn du schon ein parameter bei SetTimerEx angibst dann gibt dies doch weiter an die funktion




    forward Destroy_Weapon(id);
    public Destroy_Weapon(id)
    {
    DestroyObject(id);
    return 1;
    }


    weil nun wird die objectid weiter gegeben an die funktion welche aufgerufen wird nach 3 Minuten

  • 2 Errors:


    D:\Dokumente und Einstellungen\***\Desktop\Server\filterscripts\Dropgun.pwn(162) : error 025: function heading differs from prototype
    D:\Dokumente und Einstellungen\***\Desktop\Server\filterscripts\Dropgun.pwn(163) : error 025: function heading differs from prototype
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


    2 Errors.


    #define FILTERSCRIPT
    #include <a_samp>


    // Configs:
    #define MAX_OBJ 50 // Limit
    #define SAVING // Uncomment this line if you want to save dropped guns to restore them after FS restarts
    forward Destroy_Weapon();
    // -----------------------------------------------------------------------------
    enum dGunEnum
    {
    Float:ObjPos[3],
    ObjID,
    ObjData[2]
    };
    new dGunData[MAX_OBJ][dGunEnum];
    // -----------------------------------------------------------------------------
    new GunNames[48][] = {
    "Nichts", "Schlagring", "Golfschläger", "Schlagstock", "Messer", "Baseballschläger",
    "Schaufel", "Billiardstock", "Katana", "Motorsäge", "Lila Dildo", "Kleiner weißer Dildo",
    "Langer weißer Dildo", "Vibrator", "Blumen", "Rohrstock", "Granate", "Tränengas", "Molotov",
    "Fahrzeugrakete", "Hydra Fackel", "Jetpack", "Glock", "SD Pistole", "Deagle",
    "Schrotflinte", "Abgesägte Schrotflinte", "SPAS 12", "Micro UZI", "MP5", "AK47", "M4", "Tec9",
    "Gewehr", "Scharfschützengewehr", "Raketenwerfer", "HS Raketenwerfer", "Flamenwerfer", "Minigun",
    "Rucksackbombe", "Zünder", "Spraydose", "Feuerlöscher", "Kamera", "Nachtsicht",
    "Infrarot Nachtsicht", "Fallschirm", "Gefälschte Pistole"
    };
    // -----------------------------------------------------------------------------
    new GunObjects[47] = {
    0,331,333,334,335,336,337,338,339,341,321,322,323,324,325,326,342,343,344,
    0,0,0,346,347,348,349,350,351,352,353,355,356,372,357,358,359,360,361,362,
    363,364,365,366,367,368,368,371
    };


    // -----------------------------------------------------------------------------
    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(cmdtext, "/wablegen", true) == 0)
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new GunID = GetPlayerWeapon(playerid);
    new GunAmmo = GetPlayerAmmo(playerid);
    if(GunID > 0 && GunAmmo != 0)
    {
    new f = MAX_OBJ+1;
    for(new a = 0; a < MAX_OBJ; a++)
    {
    if(dGunData[a][ObjPos][0] == 0.0)
    {
    f = a;
    break;
    }
    }
    if(f > MAX_OBJ) return SendClientMessage(playerid, 0x00A4FFFF, "In diesem Moment kannst du keine Waffe ablegen!");
    RemovePlayerWeapon(playerid, GunID);
    dGunData[f][ObjData][0] = GunID;
    dGunData[f][ObjData][1] = GunAmmo;
    GetPlayerPos(playerid, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]);
    dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, 120.0);
    new buffer[50];
    format(buffer, sizeof(buffer), "%s wurde von dir abgelegt.", GunNames[dGunData[f][ObjData][0]]);
    SendClientMessage(playerid, 0x00A4FFFF, buffer);
    SetTimerEx("Destroy_Weapon", 180000, false,"i",dGunData[f][ObjID]);
    }
    return 1;
    }
    if(strcmp(cmdtext, "/wnehmen", true) == 0)
    {
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new f = MAX_OBJ+1;
    for(new a = 0; a < MAX_OBJ; a++)
    {
    if(IsPlayerInRangeOfPoint(playerid, 5.0, dGunData[a][ObjPos][0], dGunData[a][ObjPos][1], dGunData[a][ObjPos][2]))
    {
    f = a;
    break;
    }
    }
    if(f > MAX_OBJ) return SendClientMessage(playerid, 0x00A4FFFF, "Du bist nicht in der Nähe einer Waffe!");
    DestroyObject(dGunData[f][ObjID]);
    GivePlayerWeapon(playerid, dGunData[f][ObjData][0], dGunData[f][ObjData][1]);
    dGunData[f][ObjPos][0] = 0.0;
    dGunData[f][ObjPos][1] = 0.0;
    dGunData[f][ObjPos][2] = 0.0;
    dGunData[f][ObjID] = -1;
    //dGunData[f][ObjData][0] = 0;
    dGunData[f][ObjData][1] = 0;
    new buffer[50];
    format(buffer, sizeof(buffer), "%s wurde von dir aufgehoben.", GunNames[dGunData[f][ObjData][0]]);
    SendClientMessage(playerid, 0x00A4FFFF, buffer);
    return 1;
    }
    return 0;
    }
    // -----------------------------------------------------------------------------
    public OnPlayerDeath(playerid, killerid, reason)
    {
    new Float:pPosX, Float:pPosY, Float:pPosZ;
    GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
    for(new i_slot = 0, gun, ammo; i_slot != 12; i_slot++)
    {
    GetPlayerWeaponData(playerid, i_slot, gun, ammo);
    if(gun != 0 && ammo != 0) CreateDroppedGun(gun, ammo, pPosX+random(2)-random(2), pPosY+random(2)-random(2), pPosZ);
    }
    return 1;
    }


    stock CreateDroppedGun(GunID, GunAmmo, Float:gPosX, Float:gPosY, Float:gPosZ)
    {
    new f = MAX_OBJ+1;
    for(new a = 0; a < MAX_OBJ; a++)
    {
    if(dGunData[a][ObjPos][0] == 0.0)
    {
    f = a;
    break;
    }
    }
    if(f > MAX_OBJ) return;
    dGunData[f][ObjData][0] = GunID;
    dGunData[f][ObjData][1] = GunAmmo;
    dGunData[f][ObjPos][0] = gPosX;
    dGunData[f][ObjPos][1] = gPosY;
    dGunData[f][ObjPos][2] = gPosZ;
    dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, random(360));
    SetTimerEx("Destroy_Weapon", 180000, false,"i",dGunData[f][ObjID]);
    return;
    }
    // -----------------------------------------------------------------------------
    stock RemovePlayerWeapon(playerid, weaponid)
    {
    new plyWeapons[12] = 0;
    new plyAmmo[12] = 0;
    for(new sslot = 0; sslot != 12; sslot++)
    {
    new wep, ammo;
    GetPlayerWeaponData(playerid, sslot, wep, ammo);
    if(wep != weaponid && ammo != 0) GetPlayerWeaponData(playerid, sslot, plyWeapons[sslot], plyAmmo[sslot]);
    }
    ResetPlayerWeapons(playerid);
    for(new sslot = 0; sslot != 12; sslot++) if(plyAmmo[sslot] != 0) GivePlayerWeapon(playerid, plyWeapons[sslot], plyAmmo[sslot]);
    return 1;
    }
    stock split(const strsrc[], strdest[][], delimiter)
    {
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc))
    {
    if(strsrc[i]==delimiter || i==strlen(strsrc))
    {
    len = strmid(strdest[aNum], strsrc, li, i, 128);
    strdest[aNum][len] = 0;
    li = i+1;
    aNum++;
    }
    i++;
    }
    return 1;
    }


    forward Destroy_Weapon(id);
    public Destroy_Weapon(id)
    {
    DestroyObject(id);
    return 1;
    }