function datasave ( quitReason, reason )
if clanMembers[source] then
clanMembers[source] = nil
end
if ticketPermitted[source] then
ticketPermitted[source] = nil
end
local pname = getPlayerName ( source )
removePlayerFromLoggedIn ( pname )
if vioGetElementData ( source, "loggedin" ) == 1 then
triggerEvent ( "onLoggedInPlayerQuit", source )
pname = MySQL_Save ( getPlayerName ( source ) )
fraktionMembers[vioGetElementData(source,"fraktion")][source] = nil
adminsIngame[source] = nil
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" )]] and vioGetElementData ( source, "jailtime" ) == 0 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 ) ) and cPlayer ~= source 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*15).." 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 = getPedWeapon ( source, i )
local ammo = getPedTotalAmmo ( source, i )
if weapon and ammo then
if weapon > 0 and ammo > 0 then
if #curWeaponsForSave <= 40 then
curWeaponsForSave = curWeaponsForSave..weapon..","..ammo.."|"
end
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
datasave_remote ( source )
if vioGetElementData ( source, "isInArea51Mission" ) then
removeArea51Bots ( pname )
end
local veh = getPedOccupiedVehicle ( source )
if veh then
if isElement ( veh ) then
if getElementModel(veh) == 502 then
destroyElement ( veh )
end
end
end
killTimer ( _G[pname.."paydaytime"] )
clearInv ( source )
clearUserdata ( source )
clearBonus ( source )
clearAchiev ( source )
clearPackage ( source )
clearDataSettings ( source )
end
end
addEventHandler ("onPlayerQuit", getRootElement(), datasave )
Alles anzeigen
function logoutPlayer_func ( x, y, z, int, dim )
if vioGetElementData ( client, "shootingRanchGun" ) then
else
local pname = MySQL_Save ( getPlayerName ( client ) )
local int = tonumber ( MySQL_Save ( int ) )
local dim = tonumber ( MySQL_Save ( dim ) )
local curWeaponsForSave = "|"
for i = 1, 11 do
if i ~= 10 then
local weapon = getPedWeapon ( client, i )
local ammo = getPedTotalAmmo ( client, i )
if weapon and ammo then
if weapon > 0 and ammo > 0 then
if #curWeaponsForSave <= 40 then
curWeaponsForSave = curWeaponsForSave..weapon..","..ammo.."|"
end
end
end
end
end
curWeaponsForSave = MySQL_Save ( curWeaponsForSave )
pos = "|"..(math.floor(x*100)/100).."|"..(math.floor(y*100)/100).."|"..(math.floor(z*100)/100).."|"..int.."|"..dim.."|"
if #curWeaponsForSave < 5 then
curWeaponsForSave = ""
end
local result = mysql_vio_query( "INSERT INTO logout (Position, Waffen, Name) VALUES ('"..pos.."', '"..curWeaponsForSave.."', '"..pname.."')")
kickPlayer ( client, "Ausgeloggt." )
end
end
addEvent ( "logoutPlayer", true )
Alles anzeigen