tnt Posted October 13, 2013 Posted October 13, 2013 *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)
Jaysds1 Posted October 13, 2013 Posted October 13, 2013 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 )
TAPL Posted October 13, 2013 Posted October 13, 2013 Your server may be running on old computer and/or your database has a lot of accounts that makes it lag.
tnt Posted October 13, 2013 Author Posted October 13, 2013 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..
myonlake Posted October 13, 2013 Posted October 13, 2013 What MySQL is; http://dev.mysql.com/doc/refman/5.7/en/ ... mysql.html For database editor I suggest; http://en.wikipedia.org/wiki/PhpMyAdmin Which you need XAMPP or other web server with (XAMPP already has phpMyAdmin so, just see this: http://www.apachefriends.org/en/xampp.html).
Jaysds1 Posted October 13, 2013 Posted October 13, 2013 Which you need XAMPP or other web server with (XAMPP already has phpMyAdmin so, just see this: http://www.apachefriends.org/en/xampp.html). You could also use this too: www.usbwebserver.net
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now