[SAMMELTHREAD] Kleine Scripting Fragen

Dein Problem konnte durch einen User gelöst werden? Bedank dich bei ihm indem du seinen Beitrag als Hilfreich markierst sowie einen Daumen oben dalässt
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
  • frecke:
    #define MAX_FRAGEN 15
    #define MAX_EST 2


    enum EST_FRAGEN_ENUM{
    frage[256],
    richtige_antwort[256],
    user_antwort[256],
    bool:richtig
    }


    new EST_Fragen[MAX_EST][MAX_FRAGEN][EST_FRAGEN_ENUM] =
    {
    {
    {"***Frage1***", "richtigeAntwort15", "--", false},
    {"***Frage2***", "richtigeAntwort15", "--", false},
    {"***Frage3***", "richtigeAntwort15", "--", false},
    {"***Frage4***", "richtigeAntwort15", "--", false},
    {"***Frage5***", "richtigeAntwort15", "--", false},
    {"***Frage6***", "richtigeAntwort15", "--", false},
    {"***Frage7***", "richtigeAntwort15", "--", false},
    {"***Frage8***", "richtigeAntwort15", "--", false},
    {"***Frage9***", "richtigeAntwort15", "--", false},
    {"***Frage10***", "richtigeAntwort15", "--", false},
    {"***Frage11***", "richtigeAntwort15", "--", false},
    {"***Frage12***", "richtigeAntwort15", "--", false},
    {"***Frage13***", "richtigeAntwort15", "--", false},
    {"***Frage14***", "richtigeAntwort15", "--", false},
    {"***Frage15***", "richtigeAntwort15", "--", false}
    },
    {
    {"***Frage1***", "richtigeAntwort15", "--", false},
    {"***Frage2***", "richtigeAntwort15", "--", false},
    {"***Frage3***", "richtigeAntwort15", "--", false},
    {"***Frage4***", "richtigeAntwort15", "--", false},
    {"***Frage5***", "richtigeAntwort15", "--", false},
    {"***Frage6***", "richtigeAntwort15", "--", false},
    {"***Frage7***", "richtigeAntwort15", "--", false},
    {"***Frage8***", "richtigeAntwort15", "--", false},
    {"***Frage9***", "richtigeAntwort15", "--", false},
    {"***Frage10***", "richtigeAntwort15", "--", false},
    {"***Frage11***", "richtigeAntwort15", "--", false},
    {"***Frage12***", "richtigeAntwort15", "--", false},
    {"***Frage13***", "richtigeAntwort15", "--", false},
    {"***Frage14***", "richtigeAntwort15", "--", false},
    {"***Frage15***", "richtigeAntwort15", "--", false}
    }
    };

  • Ich wollte 0.3.7 Sirenen bei normalen Cars einfügen und bekomme dabei warnings...


    warning 202: number of arguments does not match definition | hier z.B.
    PolizeiVehs[19] = AddStaticVehicleEx(560,1534.6359,-1643.9915,5.5958,180.0313,-1,-1,-1,1); // LSPD 2 sultan


    was mach ich den bitte falsch? xD
    Sind eigentlich die neusten Includes und Dateien von 0.3.7.


    hab wirklich alles mit dem 0.3.7 Server Ordner gemacht und bekomme trotzdem diese Warnings... andere Features von 0.3.7 kann ich auch ohne Probleme benutzen.
    Wenn ich das trotz Warning teste passiert ingame einfach nichts, die Sirene geht nicht an.
    Nur in den normalen Copcars, da erscheint auch Siren on/off


    public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
    {
    if(newstate) GameTextForPlayer(playerid, "~W~Siren ~G~on", 1000, 3);
    GameTextForPlayer(playerid, "~W~Siren ~r~off", 1000, 3);
    return 1;
    }
    Wenn ich im gleichen Server Ordner das grandlarc Script öffne und
    AddStaticVehicleEx(560,1534.6359,-1643.9915,5.5958,180.0313,-1,-1,-1,1);
    einfüge kommen keine Warnings?!! fühle mich leicht verarscht :D

  • Wo liegt denn der Fehler?Habe so oft gesucht..


    Spoiler anzeigen

    #include <a_samp>
    #include <streamer>

    Spoiler anzeigen
    new carvid_0; //NRG
    new carvid_1; //Burrito
    new carvid_2; //Sultan
    new carvid_3 //Sultan

    Spoiler anzeigen
    public OnFilterScriptInit()
    {

    Spoiler anzeigen
    new tmpobjid;

    Spoiler anzeigen
    carvid_0 = CreateVehicle(522,984.726,-1544.247,13.174,357.938,0,0,-1); //NRG
    carvid_1 = CreateVehicle(482,979.305,-1523.298,13.669,175.674,0,0,-1); //Burrito
    carvid_2 = CreateVehicle(560,992.784,-1533.000,13.280,90.366,0,0,-1); //Sultan
    carvid_3 = CreateVehicle(560,992.784,-1533.000,13.280,90.366,0,0,-1); //Sultan

    //Tuning Sultan
    AddVehicleComponent(carvid_2, 1033);
    AddVehicleComponent(carvid_2, 1026);
    AddVehicleComponent(carvid_2, 1010);
    AddVehicleComponent(carvid_2, 1029);
    AddVehicleComponent(carvid_2, 1082);
    AddVehicleComponent(carvid_2, 1170);
    AddVehicleComponent(carvid_2, 1141);

    //Tuning Sultan
    AddVehicleComponent(carvid_3, 1033);
    AddVehicleComponent(carvid_3, 1026);
    AddVehicleComponent(carvid_3, 1010);
    AddVehicleComponent(carvid_3, 1029);
    AddVehicleComponent(carvid_3, 1082);
    AddVehicleComponent(carvid_3, 1170);
    AddVehicleComponent(carvid_3, 1141);

    Spoiler anzeigen
    //NRG-500
    tmpobjid = CreateDynamicObject(1654,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    AttachDynamicObjectToVehicle(tmpobjid, carvid_0, -0.340, 0.180, 0.080, 0.000, 360.000, 270.000);

    Spoiler anzeigen
    //Burrito
    tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterialText(tmpobjid, 0, "La cosa Nostra", 130, "Ariel", 80, 1, -1, 0, 1);
    AttachDynamicObjectToVehicle(tmpobjid, carvid_1, 0.942, -0.950, 0.471, 0.000, -6.799, 0.000);

    Spoiler anzeigen
    //Sultan1
    tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterialText(tmpobjid, 0, "LCN", 130, "Ariel", 70, 1, -1, 0, 1);
    AttachDynamicObjectToVehicle(tmpobjid, carvid_2, 0.000, -0.110, 0.799, 180.000, 90.000, 270.000);

    //Sultan2
    tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterialText(tmpobjid, 0, "LCN", 130, "Ariel", 70, 1, -1, 0, 1);
    AttachDynamicObjectToVehicle(tmpobjid, carvid_3, 0.000, -0.110, 0.799, 180.000, 90.000, 270.000);

    Spoiler anzeigen
    public OnFilterScriptExit()
    {
    DestroyVehicle(carvid_0);
    DestroyVehicle(carvid_1);
    DestroyVehicle(carvid_2);
    DestroyVehicle(carvid_3);
    }

    Spoiler anzeigen
    public OnVehicleSpawn(vehicleid)
    {
    if(vehicleid == carvid_0)
    {
    }
    else if(vehicleid == carvid_1)
    {
    }
    else if(vehicleid == carvid_2)
    {
    AddVehicleComponent(carvid_2, 1033);
    AddVehicleComponent(carvid_2, 1033);
    AddVehicleComponent(carvid_2, 1033);
    AddVehicleComponent(carvid_2, 1033);
    AddVehicleComponent(carvid_2, 1033);
    AddVehicleComponent(carvid_2, 1033);
    AddVehicleComponent(carvid_2, 1033);
    }

    else if(vehicleid == carvid_3)
    {
    AddVehicleComponent(carvid_3, 1033);
    AddVehicleComponent(carvid_3, 1033);
    AddVehicleComponent(carvid_3, 1033);
    AddVehicleComponent(carvid_3, 1033);
    AddVehicleComponent(carvid_3, 1033);
    AddVehicleComponent(carvid_3, 1033);
    AddVehicleComponent(carvid_3, 1033);
    }
    }



    C:\Users\Dave\Desktop\Lacananana.pwn(9) : error 001: expected token: ";", but found "public"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    1 Error.


    Mit freundlichen Grüßen
    JustMe.77 8)

  • Folgendes Beispiel:


    Ich habe meine Kamera an einen anderen Punkt verfrachtet. Nun möchte ich mit den Pfeiltasten die Kamera bewegen. An sich funktioniert das schon.


    Die Kamera ist aus der Luft auf einen Punkt auf dem Boden gerichtet.
    Nun möchte ich mit den Pfeiltasten nach oben und unten die Cam auch in Blickrichtung nach vorne / zurück verschieben und mit den Pfeiltasten links und rechts nach links und rechts.


    An sich kam mir natürlich die Idee, einfach die Y Koordinate zu erhöhen / verringern, um nach vorne und zurück zu wandern, aber je nachdem wie die Kamera ausgerichtet ist, klappt das ja natürlich nicht.


    Kleine Skizze (Sicht aus Kameraperspektive):



    Ich hoffe, ihr habt mein Problem verstanden. ^^


    Danke im Voraus.

  • Hi, ich habe folgende Fragen:


    Ich habe ein Befehl erstellt womit ich ein Auto erstelle (mit Attachten Objekten). Doch ich möchte das Auto da erstellen wo sich der Spieler befindet. Ich weiß das ich GetPlayerPos brauche, aber weiß nicht wie ich das anwenden soll.



    ocmd:jmbullet(playerid, params[])
    {
    new tmpobjid;
    new carvid;
    CreateVehicle(541,-199.906,1221.879,19.324,177.737,0,0,-1);
    AddVehicleComponent(carvid, 1010);
    AddVehicleComponent(carvid, 1074);
    AddVehicleComponent(carvid, 1087);
    ChangeVehiclePaintjob(carvid, 1);


    tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterialText(tmpobjid, 0, "JustMe.77", 90, "Ariel", 20, 1, -16711936, 0, 1);
    AttachDynamicObjectToVehicle(tmpobjid, carvid, 0.000, 1.200, 0.292, 0.000, 270.000, 90.000);
    tmpobjid = CreateDynamicObject(1547,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 7419, "vegasbuild", "vgnwoodenwall_256", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvid, -0.020, -2.211, 0.100, 90.000, 90.000, 270.000);
    tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterialText(tmpobjid, 0, "LnD 77", 120, "Ariel", 20, 1, -65536, 0, 1);
    AttachDynamicObjectToVehicle(tmpobjid, carvid, -0.010, -2.220, 0.073, 0.000, 0.000, 270.000);


    return 1;
    }



    Außerdem werden Ingame die attachten Objekte nicht angezeigt, weiß jemand woran das liegt?



    EDIT: Habe es selber hinbekommen, doch das Problem mit den Attachten Objekten besteht immer noch, jemand eine Idee woran es liegt?


    Mit freundlichen Grüßen
    JustMe.77 8)

    Einmal editiert, zuletzt von JustMe.77 ()


  • ocmd:jmbullet(playerid, params[])
    {
    new tmpobjid;
    new Float:Xx,Float:Yy,Float:Zz,Float:Aa; // Definierung der Floats für die Position und Rotation.
    GetPlayerPos(playerid,Xx,Yy,Zz); // Abfrage der Position vom Aktuellen Spieler
    GetPlayerFacingAngle(playerid,Aa); // Aktuelle Richtung in die der Spieler steht.
    new carvid = CreateVehicle(541,Xx,Yy,Zz,Aa,0,0,-1); // Fahrzeug wird an der Position die zuvor abgefragt wurde gespawnt und die ID wird in carvid gespeichert.
    AddVehicleComponent(carvid, 1010);
    AddVehicleComponent(carvid, 1074);
    AddVehicleComponent(carvid, 1087);
    ChangeVehiclePaintjob(carvid, 1);


    tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterialText(tmpobjid, 0, "JustMe.77", 90, "Ariel", 20, 1, -16711936, 0, 1);
    AttachDynamicObjectToVehicle(tmpobjid, carvid, 0.000, 1.200, 0.292, 0.000, 270.000, 90.000);
    tmpobjid = CreateDynamicObject(1547,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 7419, "vegasbuild", "vgnwoodenwall_256", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvid, -0.020, -2.211, 0.100, 90.000, 90.000, 270.000);
    tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterialText(tmpobjid, 0, "LnD 77", 120, "Ariel", 20, 1, -65536, 0, 1);
    AttachDynamicObjectToVehicle(tmpobjid, carvid, -0.010, -2.220, 0.073, 0.000, 0.000, 270.000);
    return 1;
    }


    Du musst "new carvid = CreateVehicle(541,... " machen dann wird dem Fahrzeug die Objekte hinzugefügt da du mit "carvid = XXX" die ID in dem Fall vom Fahrzeug in carvid schreibst/speicherst.
    Aktuell ist bei dir carvid immer = 0 da du der Variable keinen Wert aktuell zuschreibst.

    „Auge um Auge - und die ganze Welt wird blind sein.“
    - Mahatma Gandhi

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Woher kommt das?
    [21:21:23] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:21:23] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:21:23] [ERROR] CMySQLQuery::Execute[OnQueryFinish(siii)] - (error #1146) Table 'sql45.pRP_races' doesn't exist
    [21:21:23] [ERROR] CMySQLQuery::Execute[OnQueryFinish(siii)] - (error #1146) Table 'sql45.pRP_gutscheine' doesn't exist
    [21:21:23] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'wHackPrice' in 'field list'
    [21:21:23] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'Friedhof'
    [21:21:23] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:21:23] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:21:23] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'pMarried'
    [21:23:09] [ERROR] CMySQLQuery::Execute[LoadAccountBlacklists(i)] - (error #1146) Table 'sql45.pRP_account_blacklist' doesn't exist
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1146) Table 'sql45.pRP_account_blacklist' doesn't exist
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'Autologin' in 'field list'
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'Slot10' in 'field list'
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'Friedhof'
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'Friedhof'
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'pMarried'
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'pMarried'
    [21:23:11] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'Slot10' in 'field list'
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'Autologin' in 'field list'
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1146) Table 'sql45.pRP_account_blacklist' doesn't exist
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'Friedhof'
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'pMarried'
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'Friedhof'
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'pMarried'
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:23:15] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1146) Table 'sql45.pRP_account_blacklist' doesn't exist
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'Slot10' in 'field list'
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'Autologin' in 'field list'
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'pMarried'
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'Friedhof'
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'Friedhof'
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1060) Duplicate column name 'pMarried'
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    [21:23:49] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blacklistreason0,blacklist1,blacklistreason1,blacklist2,blacklistreason2,blackli' at line 1
    [21:24:40] [ERROR] CMySQLQuery::Execute[()] - (error #1146) Table 'sql45.onlines' doesn't exist
    [21:51:43] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'FrakMembers' in 'field list'

  • new str[10] = "abcdefgh";
    new buchstabe = str[random(strlen(str))];
    new buchst_str[2], bool:failed;
    format(buchst_str, 2, "%c", buchstabe);
    if(strfind(string, buchst_str) != -1)
    {
    failed = true;
    for(new i=0; i<strlen(str); i++)
    {
    format(buchst_str, 2, "%c", str[i]);
    if(strfind(string, buchst_str) == -1)
    {
    buchstabe = str[i];
    failed = false;
    format(string, sizeof(string), "%s%c", string, buchstabe);
    break;
    }
    }
    }
    else
    {
    format(string, sizeof(string), "%s%c", string, buchstabe);
    }
    if(failed) return SendClientMessage(playerid, 0xFF0000FF, "Error: Alle Buchstaben belegt.");
    //In "buchstabe" steht dann der gefundene Buchstabe, falls nicht alle belegt sind.