Jump to content

HELP MEH !


tnt

Recommended Posts

*This script lags on disconnect, How can I fix that lag or avoid it, if you could fix it then please do.

Thank you.

server side

  
function playerQuit() 
    local playerAcc = getPlayerAccount(source) 
    if ( playerAcc  ) then  
        local playerCash = getPlayerMoney(source) 
        local playerClass = getElementData(source, "Class") 
        local playerTeam = getTeamName(getPlayerTeam(source)) 
        setAccountData(playerAcc, "cash", playerCash) 
        setAccountData(playerAcc, "SpawnClass", playerClass) 
        if (getPlayerTeam(source)) then 
        setAccountData(playerAcc, "SpawnTeam", playerTeam) 
        end 
        setPlayerMoney(source, 0) 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), playerQuit) 
  
function playerLogin() 
spawnPlayer(source, 2024.2568359375, 1342.96484375, 10.8203125) 
fadeCamera(source, true) 
setCameraTarget(source, source) 
showPlayerHudComponent ( source, "radar", true ) 
showPlayerHudComponent ( source, "area_name", true ) 
setElementDimension ( source, 0 ) 
showChat( source, true ) 
  
local plaAcc = getPlayerAccount(source) 
if plaAcc then 
local playerBank = getAccountData(plaAcc, "cash") 
local playerClass = getAccountData(plaAcc, "SpawnClass") 
local playerTeam = getAccountData(plaAcc, "SpawnTeam") 
   if (playerBank) then 
   setPlayerMoney(source, tonumber(playerBank)) 
   end 
   if (playerClass) and (playerTeam) then 
   if (playerClass) then 
   setElementData(source, "Class", tostring(playerClass)) 
   end 
   if (playerTeam) then 
   setPlayerTeam(source, tostring(getTeamFromName(playerTeam))) 
   end 
   else 
   setPlayerTeam(source, getTeamFromName("Civilian")) 
   setElementData(source, "Class", "Unoccupied") 
   end 
end 
end 
addEventHandler("onPlayerLogin", getRootElement(), playerLogin) 

Link to comment

try this:

addEventHandler("onPlayerQuit", root, 
    function() 
        local playerAcc = getPlayerAccount(source) 
        if not playerAcc then return end 
        local playerTeam = getPlayerTeam(source) 
        setAccountData(playerAcc, "cash", getPlayerMoney(source)) 
        setAccountData(playerAcc, "SpawnClass", getElementData(source, "Class")) 
        if playerTeam then 
            setAccountData(playerAcc, "SpawnTeam", getTeamName(playerTeam)) 
        end 
    end 
) 
  
addEventHandler("onPlayerLogin", root, 
    function(_,plaAcc) 
        spawnPlayer(source, 2024.2568359375, 1342.96484375, 10.8203125) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
        showPlayerHudComponent ( source, "radar", true ) 
        showPlayerHudComponent ( source, "area_name", true ) 
        setElementDimension ( source, 0 ) 
        showChat( source, true ) 
        if plaAcc then 
            setPlayerMoney(source, tonumber(getAccountData(plaAcc, "cash")) or 0) 
            setElementData(source, "Class", getAccountData(plaAcc, "SpawnClass") or "Unoccupied") 
            setPlayerTeam(source, getTeamFromName(getAccountData(plaAcc, "SpawnTeam") or "Civilian")) 
        else 
            setPlayerTeam(source, getTeamFromName("Civilian")) 
            setElementData(source, "Class", "Unoccupied") 
        end 
    end 
) 

Link to comment

Well this thing sux, could you show me how to make data base with mySQL, people say its the best data base to make, well I'm a scripter, but I don't know how to do MySQL i don't even know what it is, could you help me and show me how to save Data Base etc..

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...