Probleme mit Blitzer System

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
  • Hilfe ich kann so schnell fahren wie ich will ich werde net geblitzt hir der Code:


    Spoiler anzeigen
    #include <a_samp>
    #include <ocmd>

    Spoiler anzeigen
    //FORWARDS
    forward Blitzer_Timer();

    Spoiler anzeigen
    //NEWS
    new stringzu[258];

    Spoiler anzeigen
    //DEFINES
    #define MAX_BLITZER 15 // Maximale Anzahl von Blitzern
    #define BLITZER_TIMER_INTERVALL 500 // Intervall für das Blitzen (in Milliesekunden)
    #define BLITZER_PAUSE 2 // Anzahl der Minuten, in denen der Spieler nicht mehr geblitzt werden kann
    #define formatEx(%0,%1,%2,%3) format(stringzu,128,%2,%3) && SendClientMessage(%0, %1, stringzu)//format(...) und SendClientMessage(...) zusammen

    Spoiler anzeigen
    //ENUMS
    enum eBlitzer {
    ID, Float:BlitzerX, Float:BlitzerY,
    Float:BlitzerZ, Radius, Geschwindigkeit,
    Erstellt,BlitzerName[128]
    };
    new Blitzer[MAX_BLITZER][eBlitzer];

    Spoiler anzeigen
    main()
    {
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
    }

    Spoiler anzeigen
    public OnGameModeInit()
    {
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
    }

    Spoiler anzeigen
    public OnGameModeExit()
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerRequestClass(playerid, classid)
    {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerConnect(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerDisconnect(playerid, reason)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerSpawn(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerDeath(playerid, killerid, reason)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnVehicleSpawn(vehicleid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnVehicleDeath(vehicleid, killerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerText(playerid, text[])
    {
    return 1;
    }

    Spoiler anzeigen
    ocmd:blitzer(playerid, params[])
    {
    new speed,radius,name[128];
    if (sscanf(params, "iis", speed, radius,name))return SendClientMessage(playerid, 0xffffffff, "[Benutzung]: /blitzer [Geschwindigkeit] [Radius] [Name Des Blitzers(Standort)]");
    AddBlitzer(playerid,speed,radius,name);
    return 1;
    }

    Spoiler anzeigen
    ocmd:veh(playerid, params[])
    {
    new Float:pX,Float:pY,Float:pZ,Float:pA;
    GetPlayerPos(playerid, pX,pY,pZ);
    GetPlayerFacingAngle(playerid,pA);
    CreateVehicle(411,pX,pY,pZ,pA,6,6,-1);
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerLeaveCheckpoint(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerEnterRaceCheckpoint(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerLeaveRaceCheckpoint(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnRconCommand(cmd[])
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerRequestSpawn(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnObjectMoved(objectid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerObjectMoved(playerid, objectid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnVehicleMod(playerid, vehicleid, componentid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnVehicleRespray(playerid, vehicleid, color1, color2)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerSelectedMenuRow(playerid, row)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerExitedMenu(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnRconLoginAttempt(ip[], password[], success)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerUpdate(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerStreamIn(playerid, forplayerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerClickPlayer(playerid, clickedplayerid, source)
    {
    return 1;
    }

    Spoiler anzeigen
    public Blitzer_Timer()
    {
    new save, strafe, speed;
    for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    save = GetPVarInt(playerid, "BlitzPause");
    if(save > 0)
    {
    save--;
    SetPVarInt(playerid, "BlitzPause", save);
    continue;
    }
    if(!IsPlayerInAnyVehicle(playerid) || IsPlayerNPC(playerid)) continue;
    for(new i = 0; i < sizeof(Blitzer); i++)
    {
    if(Blitzer[i][Erstellt] == 1)
    {
    if(IsPlayerInRangeOfPoint(playerid, Blitzer[i][Radius], Blitzer[i][BlitzerX], Blitzer[i][BlitzerY], Blitzer[i][BlitzerZ]))
    {
    speed = ErmittleGeschwindigkeit(playerid,true);
    if(speed > Blitzer[i][Geschwindigkeit])
    {
    SetPVarInt(playerid, "BlitzPause", (BLITZER_TIMER_INTERVALL * BLITZER_PAUSE * 60) / 1000);
    strafe = (speed*2) - Blitzer[i][Geschwindigkeit];
    PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
    GivePlayerMoney(playerid, -strafe);
    formatEx(playerid, 0xFF6347AA, "[BLITZER]: Du bist %d km/h gefahren, erlaubt waren %d KM/H, du musst $%d Bußgeld bezahlen.", speed ,Blitzer[i][Geschwindigkeit], strafe);
    }
    }
    }
    }
    }
    return 1;
    }

    Spoiler anzeigen
    /*STOCKS*/
    stock AddBlitzer(playerid,speed,radius,name[128])
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    for(new i = 0; i < sizeof(Blitzer); i++)
    {
    if(Blitzer[i][Erstellt] == 0)
    {
    Blitzer[i][BlitzerX] = x + 1.0;
    Blitzer[i][BlitzerY] = y + 1.0;
    Blitzer[i][BlitzerZ] = z;
    Blitzer[i][Geschwindigkeit] = speed;
    Blitzer[i][BlitzerName] = name;
    Blitzer[i][Radius] = radius;
    Blitzer[i][Erstellt] = 1;
    if(!IsPlayerInAnyVehicle(playerid))
    {
    Blitzer[i][ID] = CreateObject(18880, x , y + 1.0, z, 0.0, 0.0, 10);
    }
    return 1;
    }
    }
    return 0;
    }
    stock RemoveBlitzer(playerid)
    {
    for(new i = 0; i < sizeof(Blitzer); i++)
    {
    if(Blitzer[i][Erstellt] == 1)
    {
    if(IsPlayerInRangeOfPoint(playerid, Blitzer[i][eRadius], Blitzer[i][BlitzerX], Blitzer[i][BlitzerY], Blitzer[i][BlitzerZ]))
    {
    Blitzer[i][Erstellt] = 0;
    Blitzer[i][BlitzerX] = 0.0;
    Blitzer[i][BlitzerY] = 0.0;
    Blitzer[i][BlitzerZ] = 0.0;
    DestroyObject(Blitzer[i][ID]);
    return 1;
    }
    }
    }
    return 0;
    }
    stock RemoveAllBlitzer()
    {
    for(new i = 0; i < sizeof(Blitzer); i++)
    {
    if(Blitzer[i][Erstellt] == 1)
    {
    Blitzer[i][Erstellt] = 0;
    Blitzer[i][BlitzerX] = 0.0;
    Blitzer[i][BlitzerY] = 0.0;
    Blitzer[i][BlitzerZ] = 0.0;
    DestroyObject(Blitzer[i][ID]);
    }
    }
    return 0;
    }
    stock CountBlitzer()
    {
    new anzahl = 0;
    for(new i = 0; i < sizeof(Blitzer); i++)
    {
    if(Blitzer[i][Erstellt] == 1) anzahl++;
    }
    return anzahl;
    }
    stock ErmittleGeschwindigkeit(playerid,bool:kmh)
    {
    new Float:x,Float:y,Float:z,Float:rtn;
    if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z); else GetPlayerVelocity(playerid,x,y,z);
    rtn = floatsqroot(x*x+y*y+z*z);
    return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
    }

    Spoiler anzeigen
    //SSCANF
    stock sscanf(sstring[], format[], {Float,_}:...)
    {
    #if defined isnull
    if (isnull(sstring))
    #else
    if (sstring[0] == 0 || (sstring[0] == 1 && sstring[1] == 0))
    #endif
    {
    return format[0];
    }
    #pragma tabsize 4
    new
    formatPos = 0,
    sstringPos = 0,
    paramPos = 2,
    paramCount = numargs(),
    delim = ' ';
    while (sstring[sstringPos] && sstring[sstringPos] <= ' ')
    {
    sstringPos++;
    }
    while (paramPos < paramCount && sstring[sstringPos])
    {
    switch (format[formatPos++])
    {
    case '\0':
    {
    return 0;
    }
    case 'i', 'd':
    {
    new
    neg = 1,
    num = 0,
    ch = sstring[sstringPos];
    if (ch == '-')
    {
    neg = -1;
    ch = sstring[++sstringPos];
    }
    do
    {
    sstringPos++;
    if ('0' <= ch <= '9')
    {
    num = (num * 10) + (ch - '0');
    }
    else
    {
    return -1;
    }
    }
    while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num * neg);
    }
    case 'h', 'x':
    {
    new
    num = 0,
    ch = sstring[sstringPos];
    do
    {
    sstringPos++;
    switch (ch)
    {
    case 'x', 'X':
    {
    num = 0;
    continue;
    }
    case '0' .. '9':
    {
    num = (num << 4) | (ch - '0');
    }
    case 'a' .. 'f':
    {
    num = (num << 4) | (ch - ('a' - 10));
    }
    case 'A' .. 'F':
    {
    num = (num << 4) | (ch - ('A' - 10));
    }
    default:
    {
    return -1;
    }
    }
    }
    while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num);
    }
    case 'c':
    {
    setarg(paramPos, 0, sstring[sstringPos++]);
    }
    case 'f':
    {

    Spoiler anzeigen
    new changestr[16], changepos = 0, strpos = sstringPos;
    while(changepos < 16 && sstring[strpos] && sstring[strpos] != delim)
    {
    changestr[changepos++] = sstring[strpos++];
    }
    changestr[changepos] = '\0';
    setarg(paramPos,0,_:floatstr(changestr));
    }
    case 'p':
    {
    delim = format[formatPos++];
    continue;
    }
    case '\'':
    {
    new
    end = formatPos - 1,
    ch;
    while ((ch = format[++end]) && ch != '\'') {}
    if (!ch)
    {
    return -1;
    }
    format[end] = '\0';
    if ((ch = strfind(sstring, format[formatPos], false, sstringPos)) == -1)
    {
    if (format[end + 1])
    {
    return -1;
    }
    return 0;
    }
    format[end] = '\'';
    sstringPos = ch + (end - formatPos);
    formatPos = end + 1;
    }
    case 'u':
    {
    new
    end = sstringPos - 1,
    id = 0,
    bool:num = true,
    ch;
    while ((ch = sstring[++end]) && ch != delim)
    {
    if (num)
    {
    if ('0' <= ch <= '9')
    {
    id = (id * 10) + (ch - '0');
    }
    else
    {
    num = false;
    }
    }
    }
    if (num && IsPlayerConnected(id))
    {
    setarg(paramPos, 0, id);
    }
    else
    {
    #if !defined foreach
    #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
    #define __SSCANF_FOREACH__
    #endif
    sstring[end] = '\0';
    num = false;
    new
    name[MAX_PLAYER_NAME];
    id = end - sstringPos;
    foreach (Player, playerid)
    {
    GetPlayerName(playerid, name, sizeof (name));
    if (!strcmp(name, sstring[sstringPos], true, id))
    {
    setarg(paramPos, 0, playerid);
    num = true;
    break;
    }
    }
    if (!num)
    {
    setarg(paramPos, 0, INVALID_PLAYER_ID);
    }
    sstring[end] = ch;
    #if defined __SSCANF_FOREACH__
    #undef foreach
    #undef __SSCANF_FOREACH__
    #endif
    }
    sstringPos = end;
    }
    case 's', 'z':
    {
    new
    i = 0,
    ch;
    if (format[formatPos])
    {
    while ((ch = sstring[sstringPos++]) && ch != delim)
    {
    setarg(paramPos, i++, ch);
    }
    if (!i)
    {
    return -1;
    }
    }
    else
    {
    while ((ch = sstring[sstringPos++]))
    {
    setarg(paramPos, i++, ch);
    }
    }
    sstringPos--;
    setarg(paramPos, i, '\0');
    }
    default:
    {
    continue;
    }
    }
    while (sstring[sstringPos] && sstring[sstringPos] != delim && sstring[sstringPos] > ' ')
    {
    sstringPos++;
    }
    while (sstring[sstringPos] && (sstring[sstringPos] == delim || sstring[sstringPos] <= ' '))
    {
    sstringPos++;
    }
    paramPos++;
    }
    do
    {
    if ((delim = format[formatPos++]) > ' ')
    {
    if (delim == '\'')
    {
    while ((delim = format[formatPos++]) && delim != '\'') {}
    }
    else if (delim != 'z')
    {
    return delim;
    }
    }
    }
    while (delim > ' ');
    return 0;
    }


    Danke im vorraus.


    mfg. Fabi.StaR

    Mit freundlichen Grüßen,


    Fabi.StaR :love::saint: