Warum funktionier meine Schranke nicht? WTF

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
  • Aloha zusammen, ich hab mal ein Haus gemappt mit einer schranke... hab es ohne befehle versucht und alles so gemacht wie es im tutorial stand^^
    aber wenn ich davor stehe öffnet sie sich nicht X(


    hier das Filterscript


    #include <a_samp>


    #pragma tabsize 0
    #define FILTERSCRIPT
    #if defined FILTERSCRIPT
    new Hausschranke;



    forward checkparea(playerid);
    forward closehausschranke();
    forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);


    public OnFilterScriptInit()
    {
    CreateObject(17037, 1528.729248, -680.242126, 96.241470, 0.0000, 0.0000, 180.0000);
    CreateObject(17037, 1528.729004, -673.183777, 96.241470, 0.0000, 0.0000, 180.0000);
    CreateObject(17037, 1528.729004, -666.121277, 96.241470, 0.0000, 0.0000, 180.0000);
    CreateObject(1419, 1486.916138, -702.460999, 94.266388, 0.0000, 0.0000, 281.2500);
    CreateObject(1419, 1488.438232, -706.164673, 94.275581, 0.0000, 0.0000, 303.7500);
    CreateObject(1419, 1491.254150, -709.008972, 94.271706, 0.0000, 0.0000, 326.2500);
    CreateObject(1419, 1508.385376, -701.982300, 94.275581, 0.0000, 0.0000, 258.7500);
    CreateObject(1419, 1506.878906, -705.663147, 94.274872, 0.0000, 0.0000, 236.2501);
    CreateObject(1419, 1504.094604, -708.522278, 94.263260, 0.0000, 0.0000, 213.7500);
    CreateObject(626, 1500.328979, -688.945435, 95.798599, 0.0000, 0.0000, 0.0000);
    CreateObject(626, 1493.950195, -688.974854, 95.798599, 0.0000, 0.0000, 0.0000);
    CreateObject(870, 1504.558594, -710.349731, 93.718170, 0.0000, 0.0000, 0.0000);
    CreateObject(870, 1503.434326, -712.325745, 93.600220, 0.0000, 0.0000, 0.0000);
    CreateObject(870, 1504.976685, -712.881348, 93.348343, 0.0000, 0.0000, 0.0000);
    CreateObject(870, 1506.384888, -710.883728, 93.320503, 0.0000, 0.0000, 0.0000);
    CreateObject(870, 1504.110718, -714.294312, 93.428375, 0.0000, 0.0000, 0.0000);
    CreateObject(870, 1502.649414, -714.331421, 93.646973, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1490.364746, -711.009094, 93.982574, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1489.904785, -710.273193, 93.976021, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1491.296265, -712.323914, 93.996910, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1487.877075, -712.155823, 93.946770, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1486.404419, -709.152222, 93.948135, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1487.186279, -707.154602, 93.981407, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1488.167847, -709.148560, 93.966705, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1489.389160, -711.331665, 93.968719, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1487.353882, -710.659119, 93.938736, 0.0000, 0.0000, 0.0000);
    CreateObject(871, 1489.817017, -713.000122, 93.975395, 0.0000, 0.0000, 0.0000);
    CreateObject(3810, 1499.747192, -688.215332, 100.609428, 0.0000, 0.0000, 270.0000);
    CreateObject(3810, 1494.137695, -688.246094, 100.616173, 0.0000, 0.0000, 270.0000);
    CreateObject(3660, 1471.615234, -692.921753, 96.104279, 0.0000, 0.0000, 0.0000);
    CreateObject(3660, 1466.323975, -692.922241, 96.105057, 0.0000, 0.0000, 0.0000);
    CreateObject(966, 1494.152100, -710.186340, 93.745926, 0.0000, 0.0000, 180.0000);
    Hausschranke = CreateObject(968, 1494.024536, -710.179565, 94.644562, 0.0000, 91.1861, 0.0000);
    CreateObject(716, 1492.764526, -710.442322, 93.486000, 0.0000, 0.0000, 4.2187);
    CreateObject(716, 1502.151367, -710.589783, 93.486832, 0.0000, 0.0000, 4.2187);



    print("\n--------------------------------------");
    print(" Hausschranke by Hoscht xD");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    #else


    #endif


    public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
    {
    if(IsPlayerConnected(playerid))
    {
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
    return 1;
    }
    }
    return 0;
    }


    public OnPlayerSpawn(playerid)
    {
    SetTimer("checkparea", 1500, 1);
    return 1;
    }



    public checkparea(playerid)
    {
    if(PlayerToPoint(10.0, playerid, 1494.024536, -710.179565, 94.644562)) // 10.0 ist der Radius
    {
    MoveObject(Hausschranke,1494.023926, -710.179871, 94.646111,4); // 4 ist glaub ich die Geschwindigkeit
    SetTimer("closehausschranke", 5000, 0);
    }
    return 1;
    }


    public closehausschranke()
    {
    MoveObject(Hausschranke,1494.024536, -710.179565, 94.644562,4);
    return 1;
    }



    warum nicht?^^

  • //statt
    SetTimer("checkparea", 1500, 1);
    //das machen:
    SetTimer("checkparea",1500,1,"d",playerid);

  • Bitte was ? :x ... Also irgendwas mit Coordienaten habe ich verstanden, aber der rest??


    Zitat

    //edt: Das unterste mit der Hausschrankeclose oder so, muss vor den "befehl", weil so maacht er was das er nciht weis was er macht
    so hats damals bei mir geklapt


    www.Seven-Streams.de
    (momentan im neuaufbau)
    dein Professionelles Hosting in sachen:
    AutoDJ, Stream Server, Webspace, Domains & Teamspeak 3 Sponsoring
    + Grafik Service, Installations Service & Homepage Service

  • Warum so kompliziert?


    Das ist von mir ein Gatescript.
    Also da ist auch noch viel anderes drin^^


    #include <a_samp>


    #pragma tabsize 4
    #define COLOR_YELLOW 0xFFFF00AA
    new y_gate[2];







    public OnFilterScriptInit()
    {
    y_gate[0] = CreateObject(989, -2652.3493652344, -220.3148651123, 5.0052194595337, 0.000000, 0.000000, 107.189453125); //object (ac_apgate) (1)
    y_gate[1] = CreateObject(989, -2657.8356933594, -220.36798095703, 4.9960298538208, 0.000000, 0.000000, 107.189453125); //object (ac_apgate) (2)


    print("\n--------------------------------------");
    print(" Gates Filterscript by Rastla");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp(cmdtext, "/tropen", true) == 0)
    {


    MoveObject(y_gate[0],-2652.3493652344, -220.3148651123, 0.0000000000000,4);
    MoveObject(y_gate[1],-2657.8356933594, -220.36798095703, 0.0000000000000,4);
    SendClientMessage(playerid, COLOR_YELLOW,"Triaden-Tor, geöffnet!");


    }
    if (strcmp(cmdtext, "/trclose", true) == 0)
    {
    MoveObject(y_gate[0],-2652.3493652344, -220.3148651123, 5.0052194595337,4);
    MoveObject(y_gate[1],-2657.8356933594, -220.36798095703, 4.9960298538208,4);
    SendClientMessage(playerid, COLOR_YELLOW,"Triaden-Tor, geschlossen!");


    }
    //Triaden Base
    CreateObject(9482, -2655.2692871094, -220.52737426758, 9.8164644241333, 0.000000, 0.000000, 89.324493408203); //object (chinagate) (1)
    CreateObject(974, -2663.8679199219, -220.32955932617, 6.1189193725586, 0.000000, 0.000000, 0.000000); //object (tall_fence) (1)
    CreateObject(974, -2646.4118652344, -220.408203125, 6.1148948669434, 0.000000, 0.000000, 0.000000); //object (tall_fence) (2)
    CreateObject(974, -2669.1052246094, -220.25514221191, 6.1136779785156, 0.000000, 0.000000, 0.000000); //object (tall_fence) (3)
    CreateObject(974, -2673.419921875, -220.23937988281, 6.1136779785156, 0.000000, 0.000000, 0.000000); //object (tall_fence) (4)
    CreateObject(974, -2639.7258300781, -220.3683013916, 6.1125144958496, 0.000000, 0.000000, 0.000000); //object (tall_fence) (9)
    CreateObject(974, -2638.0595703125, -220.31436157227, 6.1136779785156, 0.000000, 0.000000, 0.000000); //object (tall_fence) (10)
    CreateObject(991, -2803.8825683594, -315.0325012207, 7.3953032493591, 0.000000, 0.000000, 85.3544921875); //object (bar_barriergate1) (1)
    CreateObject(991, -2804.4235839844, -321.68420410156, 7.3920860290527, 0.000000, 0.000000, 85.3544921875); //object (bar_barriergate1) (2)
    CreateObject(991, -2806.6252441406, -344.44293212891, 7.3973593711853, 0.000000, 0.000000, 85.3544921875); //object (bar_barriergate1) (3)
    CreateObject(991, -2806.1030273438, -337.80462646484, 7.3940634727478, 0.000000, 0.000000, 85.3544921875); //object (bar_barriergate1) (4)
    CreateObject(1552, -2805.408203125, -329.80545043945, 7.3278217315674, 0.000000, 0.000000, 83.369506835938); //object (vegasmashfnce) (1)
    CreateObject(1553, -2805.3703613281, -331.37451171875, 7.2251057624817, 0.000000, 0.000000, 85.3544921875); //object (vegasmashfnce_gate) (1)
    CreateObject(1553, -2805.1162109375, -328.3752746582, 7.232901096344, 0.000000, 0.000000, 85.3544921875); //object (vegasmashfnce_gate) (2)
    CreateObject(991, -2804.5798339844, -323.51028442383, 7.3949279785156, 0.000000, 0.000000, 85.3544921875); //object (bar_barriergate1) (5)
    CreateObject(991, -2805.9792480469, -336.18551635742, 7.3949279785156, 0.000000, 0.000000, 85.3544921875); //object (bar_barriergate1) (6)
    //Rifa Base
    CreateObject(2933, -2210.4733886719, 579.49816894531, 35.879676818848, 0.000000, 0.000000, 0.000000); //object (pol_comp_gate) (1) !!!OPENCLOSE
    CreateObject(2933, -2241.9877929688, 642.47528076172, 50.166194915771, 0.000000, 0.000000, 270.67565917969); //object (pol_comp_gate) (2) !!!OPENCLOSE
    CreateObject(2669, -2240.3757324219, 603.95654296875, 41.539840698242, 0.000000, 0.000000, 89.324493408203); //object (cj_chris_crate) (1)
    CreateObject(2669, -2240.3579101563, 606.89105224609, 41.525856018066, 0.000000, 0.000000, 89.324493408203); //object (cj_chris_crate) (2)
    CreateObject(7657, -2186.6086425781, 711.45861816406, 54.607467651367, 0.000000, 0.000000, 0.000000); //object (plasticsgate1) (1) !!!OPENCLOSE
    //LSPD
    CreateObject(7657, 1549.5622558594, -1627.5679931641, 14.099655151367, 0.000000, 0.000000, 270.67565917969); //object (plasticsgate1) (1) !!!OPENCLOSE
    CreateObject(980, 1588.359375, -1637.8903808594, 15.20213508606, 0.000000, 0.000000, 0.000000); //object (airportgate) (1) !!!OPENCLOSE
    CreateObject(3007, 1565.53125, -1633.7000732422, 13.277488708496, 0.000000, 0.000000, 0.000000); //object (chopcop_torso) (1)
    CreateObject(3008, 1565.5235595703, -1633.7131347656, 13.281542778015, 0.000000, 0.000000, 0.000000); //object (chopcop_armr) (1)
    CreateObject(3009, 1565.5172119141, -1633.7233886719, 13.285661697388, 0.000000, 0.000000, 0.000000); //object (chopcop_arml) (1)
    CreateObject(3010, 1565.3507080078, -1633.81640625, 13.297813415527, 0.000000, 0.000000, 0.000000); //object (chopcop_legr) (1)
    CreateObject(3011, 1565.7526855469, -1633.7703857422, 13.308539390564, 0.000000, 0.000000, 0.000000); //object (chopcop_legl) (1)
    CreateObject(3012, 1565.5523681641, -1633.6409912109, 13.21448802948, 0.000000, 0.000000, 0.000000); //object (chopcop_head) (1)
    CreateObject(3092, 1561.8975830078, -1637.1430664063, 15.298984527588, 0.000000, 0.000000, 0.000000); //object (dead_tied_cop) (1)
    CreateObject(3465, 1543.0031738281, -1602.9123535156, 13.698322296143, 0.000000, 0.000000, 89.324493408203); //object (vegspetrolpump) (1)
    CreateObject(3465, 1549.2629394531, -1603.0192871094, 13.698322296143, 0.000000, 0.000000, 91.309509277344); //object (vegspetrolpump) (2)




    return 0;
    }

  • Dann kannst du das Script schlecht auf nem 0.3 Server laufen lassen^^
    Bestimmte Funktionen funzen nicht mehr in SA-MP 0.3


    //edit: Das mit dem IsPlayerInRangeOfPoint bekomm ich auch nicht hin^^
    Da kommt immer invalid declaration oder so 8|

    Einmal editiert, zuletzt von Firefox ()

  • zwischen
    PlayerToPoint und IsPlayerInRangeOfPoint
    gibts auch ein unterschied
    bei PTP:
    PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
    erst Radius dann PlayerID


    bei ROP
    IsPlayerInRangeOfPoint(playerid,Float:radi, Float:x, Float:y, Float:z);
    erst PlayerID dann Radius

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen