Beiträge von zeNTrix

    function datasave ( quitReason, reason )

    if tonumber ( vioGetElementData ( source, "loggedin" ) ) == 1 then
    fraktionMembers[vioGetElementData(source,"fraktion")][source] = nil
    adminsIngame[source] = nil
    local pname = MySQL_Save ( getPlayerName ( source ) )
    if getElementData ( source, "isInHighNoon" ) or vioGetElementData ( source, "shootingRanchGun" ) then
    elseif quitReason and reason ~= "Ausgeloggt." then
    if vioGetElementData ( source, "wanteds" ) >= 1 and ( quitReason == "Quit" or quitReason == "Unknown" ) then
    local x, y, z = getElementPosition ( source )
    local copShape = createColSphere ( x, y, z, 20 )
    local elementsInCopSphere = getElementsWithinColShape ( copShape, "player" )
    destroyElement ( copShape )
    for key, cPlayer in ipairs ( elementsInCopSphere ) do
    if isOnDuty ( cPlayer ) or isArmy ( cPlayer ) then
    local wanteds = vioGetElementData ( source, "wanteds" )
    vioSetElementData ( source, "wanteds", 0 )
    vioSetElementData ( source, "jailtime", wanteds * 12 + vioGetElementData ( source, "jailtime" ) )
    wantedCost = 100*wanteds*(wanteds*.5)
    vioSetElementData ( source, "money", vioGetElementData ( source, "money" ) - wantedCost )
    if vioGetElementData ( source, "money" ) < 0 then
    vioSetElementData ( source, "money", 0 )
    end
    outputChatBox ( "Der Gesuchte "..getPlayerName ( source ).." ist offline gegangen - er wird beim naechsten Einloggen im Knast sein.", cPlayer, 0, 125, 0 )
    offlinemsg ( "Du bist fuer "..(wanteds*12).." mins im Gefaengnis (Offlineflucht?)", "Server", getPlayerName(source) )
    break
    end
    end
    end
    if quitReason == "Kicked" or quitReason == "Bad Connection" or quitReason == "Timed out" then
    local curWeaponsForSave = "|"
    for i = 1, 12 do
    if i ~= 10 and i ~= 12 then
    local weapon = vioGetElementData ( source, "weaponInSlot"..i )
    local ammo = vioGetElementData ( source, "weaponInSlot"..i.."Ammo" )
    if weapon > 0 and ammo > 0 then
    if #curWeaponsForSave <= 40 then
    curWeaponsForSave = curWeaponsForSave..weapon..","..ammo.."|"
    end
    end
    end
    end
    if #curWeaponsForSave > 1 then
    mysql_vio_query( "INSERT INTO logout (Position, Waffen, Name) VALUES ('false', '"..curWeaponsForSave.."', '"..pname.."')")
    end
    end
    end
    if vioGetElementData ( source, "callswith" ) then
    if vioGetElementData ( source, "callswith" ) ~= "none" then
    local caller = getPlayerFromName ( vioGetElementData ( source, "callswith" ) )
    if caller then
    vioSetElementData ( caller, "callswith", "none" )
    vioSetElementData ( caller, "call", false )
    vioSetElementData ( caller, "calls", "none" )
    vioSetElementData ( caller, "callswith", "none" )
    vioSetElementData ( caller, "calledby", "none" )
    outputChatBox ( "*Knack* - Die Leitung ist tod!", caller, 125, 0, 0 )
    end
    vioSetElementData ( source, "callswith", "none" )
    vioSetElementData ( source, "call", false )
    vioSetElementData ( source, "calls", "none" )
    vioSetElementData ( source, "callswith", "none" )
    vioSetElementData ( source, "calledby", "none" )
    end
    end
    MySQL_DelRow("loggedin", "Name LIKE '"..pname.."'")
    cancelDrivingSchoolServer ( pname )
    datasave_remote ( source )
    if vioGetElementData ( source, "isInArea51Mission" ) then
    removeArea51Bots ( pname )
    end
    local veh = getPedOccupiedVehicle ( source )
    if veh then
    if getElementModel(veh) == 502 then
    destroyElement ( veh )
    end
    end
    killTimer ( _G[pname.."paydaytime"] )
    clearInv ( source )
    clearUserdata ( source )
    clearBonus ( source )
    clearAchiev ( source )
    clearPackage ( source )
    clearDataSettings ( source )
    end
    end
    addEventHandler ("onPlayerQuit", getRootElement(), datasave