[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
  • Hey,
    du setzt eine SpielerVariable beim Einloggen auf eins.
    Ist er nicht eingeloggt ist sie auf 0
    Dann fragst du bei jedem Befehl ab ob er eingeloggt ist.


    if(SpielerVariable == 0)return SendClientMessage...


    Ok, Danke.


    Hab die Variable sowieso schon gesetzt.


    Muss ich dann nurnoch abfragen. :thumbup:





    Das bedeutet dass du wahrscheinlich das falsche Passwort im Script eingetragen hast. Darum wird dir der Zugriff verwehrt.

  • Beitrag von Dachdecker ()

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.
  • Jeffry:


    Ich möchte Slice's Damage System benutzen, habe alles gemacht so wie beschrieben.
    Ein Schritt davon ist die beiden Callbacks OnPlayerGiveDamage und OnPlayerTakeDamage zu ersetzen undzwar mit dem hier public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)


    Das habe ich gemacht und ich erhalte diese Errors:


    C:\Users\Dave\Desktop\Hoe's Wonderland\pawno\include\YSI\y_hooks/impl.inc(2340) : error 021: symbol already defined: "OnPlayerTakeDamage"
    C:\Users\Dave\Desktop\Hoe's Wonderland\pawno\include\YSI\y_hooks/impl.inc(2387) : error 021: symbol already defined: "OnPlayerGiveDamage"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    2 Errors.


    Ich habe die beiden ganz sicher gelöscht, und so viele Zeilen habe ich nicht. Und Slice kann ich gerade auch nicht fragen da er nicht online ist :c


    Mit freundlichen Grüßen
    JustMe.77 8)

  • Benutzt du dieses YSI Zeug überhaupt? Darin befindet sich nämlich der Fehler.
    Wenn du diese impl.inc öffnest und dort die beiden Callbacks raus löschst, dann sollte es klappen.



    Kanns dort nicht finden:


    Spoiler anzeigen
    //task DoPulse1

    Spoiler anzeigen
    static stock
    YSI_g_sTimer[32] = "y_zonepulse_";

    Spoiler anzeigen
    forward __GangZonePulse(playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1);

    Spoiler anzeigen
    public __GangZonePulse(playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)
    {
    if (!IsPlayerConnected(playerid))
    {
    return;
    }
    valstr(YSI_g_sTimer[12], zone);
    //format(YSI_g_sTimer, sizeof (YSI_g_sTimer), "y_zonepulse_%d", zone);
    stage = (stage + 1) % (time + time2);
    if (stage == time)
    {
    GangZoneShowForPlayer(playerid, zone, to);
    SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx("__GangZonePulse", delay, 0, "iiiiiiiiiiiiiiiii", playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1));
    return;
    }
    else if (stage == 0)
    {
    GangZoneShowForPlayer(playerid, zone, from);
    SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx("__GangZonePulse", delay2, 0, "iiiiiiiiiiiiiiiii", playerid, zone, from, to, time, 0, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1));
    return;
    }
    if (stage > time)
    {
    // Fade back
    new
    multiplier = 2 * time2 - stage;
    // r = r1 * multiplier / time2 + r0,
    // g = g1 * multiplier / time2 + g0,
    // b = b1 * multiplier / time2 + b0,
    // a = a1 * multiplier / time2 + a0;
    //P:7("__GangZonePulse: %d %d %x %x %x %x", playerid, zone, r & 0xFF, g & 0xFF, b & 0xFF, a & 0xFF);
    GangZoneShowForPlayer(playerid, zone, ((r1 * multiplier / time2 + r0) << 24) | (((g1 * multiplier / time2 + g0) & 0xFF) << 16) | (((b1 * multiplier / time2 + b0) & 0xFF) << 8) | ((a1 * multiplier / time2 + a0) & 0xFF));
    //GangZoneShowForPlayer(playerid, zone, (r << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | (a & 0xFF));
    SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx("__GangZonePulse", ZONE_PULSE_STAGE_TIME, 0, "iiiiiiiiiiiiiiiii", playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1));
    }
    else
    {
    // Fade there.
    //new
    // r = r1 * stage / time + r0,
    // g = g1 * stage / time + g0,
    // b = b1 * stage / time + b0,
    // a = a1 * stage / time + a0;
    //P:7("__GangZonePulse: %d %d %x %x %x %x", playerid, zone, r & 0xFF, g & 0xFF, b & 0xFF, a & 0xFF);
    GangZoneShowForPlayer(playerid, zone, ((r1 * stage / time + r0) << 24) | (((g1 * stage / time + g0) & 0xFF) << 16) | (((b1 * stage / time + b0) & 0xFF) << 8) | ((a1 * stage / time + a0) & 0xFF));
    SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx("__GangZonePulse", ZONE_PULSE_STAGE_TIME, 0, "iiiiiiiiiiiiiiiii", playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1));
    }
    return;
    }

    Spoiler anzeigen
    stock _GangZonePulse(@PlayerSet:ps, zone, from, to, time, delay = ZONE_PULSE_STAGE_TIME, time2 = -1, delay2 = -1)
    {
    //static
    // YSI_g_sTimer[32];
    //format(YSI_g_sTimer, sizeof (YSI_g_sTimer), "y_zonepulse_%d", zone);
    valstr(YSI_g_sTimer[12], zone);
    if (time2 == -1)
    {
    time2 = time;
    }
    if (delay2 == -1)
    {
    delay2 = delay;
    }
    time /= ZONE_PULSE_STAGE_TIME;
    time2 /= ZONE_PULSE_STAGE_TIME;
    // Do a load of maths in advance.
    new
    r0 = (from >>> 24),
    g0 = (from >>> 16 & 0xFF),
    b0 = (from >>> 8 & 0xFF),
    a0 = (from & 0xFF),
    r1 = ((to >>> 24) - r0),
    g1 = ((to >>> 16 & 0xFF) - g0),
    b1 = ((to >>> 8 & 0xFF) - b0),
    a1 = ((to & 0xFF) - a0);
    // This method would have simpler maths in the main timer, but with less
    // accurate results (possibly MUCH less accurate). For reference, this way
    // would result in:
    //
    // cur = from + fromAdd - fromSub;
    //
    /*new
    thereAdd,
    thereSub,
    backAdd,
    backSub;
    if (to >>> 24 > from >>> 24) thereAdd |= ((to >>> 24) - (from >>> 24)) / time << 24, backSub |= ((to >>> 24) - (from >>> 24)) / time2 << 24;
    else thereSub |= ((from >>> 24) - (to >>> 24)) / time << 24, backAdd |= ((from >>> 24) - (to >>> 24)) / time2 << 24;
    if (to >>> 16 & 0xFF > from >>> 16 & 0xFF) thereAdd |= ((to >>> 16 & 0xFF) - (from >>> 16 & 0xFF)) / time << 16, backSub |= ((to >>> 16 & 0xFF) - (from >>> 16 & 0xFF)) / time2 << 16;
    else thereSub |= ((from >>> 16 & 0xFF) - (to >>> 16 & 0xFF)) / time << 16, backAdd |= ((from >>> 16 & 0xFF) - (to >>> 16 & 0xFF)) / time2 << 16;
    if (to >>> 8 & 0xFF > from >>> 8 & 0xFF) thereAdd |= ((to >>> 8 & 0xFF) - (from >>> 8 & 0xFF)) / time << 8, backSub |= ((to >>> 8 & 0xFF) - (from >>> 8 & 0xFF)) / time2 << 8;
    else thereSub |= ((from >>> 8 & 0xFF) - (to >>> 8 & 0xFF)) / time << 8, backAdd |= ((from >>> 8 & 0xFF) - (to >>> 8 & 0xFF)) / time2 << 8;
    if (to & 0xFF > from & 0xFF) thereAdd |= ((to & 0xFF) - (from & 0xFF)) / time, backSub |= ((to & 0xFF) - (from & 0xFF)) / time2;
    else thereSub |= ((from & 0xFF) - (to & 0xFF)) / time, backAdd |= ((from & 0xFF) - (to & 0xFF)) / time2;*/
    foreach (new p : PS(ps))
    {
    KillTimer(GetPVarInt(p, YSI_g_sTimer));
    GangZoneShowForPlayer(p, zone, from);
    // Don't delay at the start (because that's just silly, it already is
    // that colour).
    SetPVarInt(p, YSI_g_sTimer, SetTimerEx("__GangZonePulse", ZONE_PULSE_STAGE_TIME, 0, "iiiiiiiiiiiiiiiii", p, zone, from, to, time, 0, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1));
    }
    }

    Spoiler anzeigen
    #define GangZonePulse(%0) PSF:_GangZonePulse(%0)
    #define GangZonePulseForPlayer(%0) PSF:_GangZonePulse(%0)
    #define GangZonePulseForAll(%0) PSF:_GangZonePulse(ALL_PLAYERS,%0)

    Spoiler anzeigen
    stock _GangZoneStopPulse(@PlayerSet:ps, zone)
    {
    //static
    // YSI_g_sTimer[32];
    //format(YSI_g_sTimer, sizeof (YSI_g_sTimer), "y_zonepulse_%d", zone);
    valstr(YSI_g_sTimer[12], zone);
    foreach (new p : PS(ps))
    {
    KillTimer(GetPVarInt(p, YSI_g_sTimer));
    }
    }

    Spoiler anzeigen
    #define GangZoneStopPulse(%0) PSF:_GangZoneStopPulse(%0)
    #define GangZoneStopPulseForPlayer(%0) PSF:_GangZoneStopPulse(%0)
    #define GangZoneStopPulseForAll(%0) PSF:_GangZoneStopPulse(ALL_PLAYERS,%0)


    Mit freundlichen Grüßen
    JustMe.77 8)

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Beitrag von Apokrate ()

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.
  • Hallo, ich habe mal eine Frage.
    Habe bis jetzt immer nur Integer aus der DB ausgelesen.


    Jetzt wollte ich für den Ausweis die Herkunft auslesen aus der DB.


    Funktioniert glaube ich auch.


    new meineherkunft[25];
    cache_get_field_content(0,"herkunft",meineherkunft,dbverbindung);
    strmid(sInfo[playerid][herkunft],meineherkunft,0,sizeof(meineherkunft),sizeof(meineherkunft));


    braucht man das strmid überhaupt? oder kann ich sInfo[playerid][herkunft] direkt bei cache_get_field_content für das meineherkunft ersetzen ?


    Und Kann mir jemand erklären was strmid macht? das Wiki ist gerade bei mir down.

  • Du kannst es auch so schreiben:
    cache_get_field_content(0,"herkunft",sInfo[playerid][herkunft],dbverbindung,25);
    Wichtig ist halt bei Variablen aus einem enum, dass du die Länge (25) angibst.


    Siehe hier, das ist das gleiche, nur eben von VBS, da kannst du es ausprobieren.
    http://www.w3schools.com/vbscript/func_mid.asp


    Das Wiki ist übrigens, ebenso wie das englische Forum, momentan down.

  • wollte gerade kurz das Datum einfügen, jedoch wird mir immer nur beim Jahr 201 angezeigt statt 2015
    new datum[10], year, month, day;
    getdate(year,month,day);
    format(datum,sizeof(datum),"%02d.%02d.%04d",day,month,year);
    TextDrawSetString(Textdraw[62],datum);
    TextDrawShowForPlayer(playerid,Textdraw[62]);
    uhrzeittimer[playerid] = SetTimerEx("UhrTimer",10000,true,"i",playerid);