Plate Posted July 11, 2013 Share Posted July 11, 2013 Por que esto no funciona nisiquiera da error function playerSpawned() local account = getPlayerAccount(soruce) if ( account ) then if getAccountData(account, "playerSpawn") then local x = getAccountData(account, "SpawnX") local y = getAccountData(account, "SpawnY") local z = getAccountData(account, "SpawnZ") spawnPlayer(source, x, y, z, 0, 287) setCameraTarget(source, source) end end end addEventHandler("onPlayerLogin", root, playerSpawned) Link to comment
BorderLine Posted July 11, 2013 Share Posted July 11, 2013 function playerSpawned() local account = getPlayerAccount(soruce) local x = getAccountData(account, "SpawnX") local y = getAccountData(account, "SpawnY") local z = getAccountData(account, "SpawnZ") if x and y and z then setTimer(spawnPlayer,500,1,source, x, y, z, 0, 287) setTimer(setCameraTarget,500,1source, source) end end addEventHandler("onPlayerLogin", root, playerSpawned) intenta asi Link to comment
Plate Posted July 11, 2013 Author Share Posted July 11, 2013 El error me lo daba en getPlayerAccount pero ya lo solucione gracias igual por tu ayuda yakuza Link to comment
BorderLine Posted July 11, 2013 Share Posted July 11, 2013 jajajajaja y yo cambiando las weas, y no me di cuenta de eso Link to comment
Plate Posted July 11, 2013 Author Share Posted July 11, 2013 Intente modificar el savesystem(mysql) de la comunidad pero no funciona PD:Esta vez me fije bien y no abia ningun error en el debugscript function saveAccounts () -- Save in the database local account = getPlayerAccount(source) if ( account ) then local accName = getAccountName(account) local i = getElementInterior( source ) local d = getElementDimension( source ) local skin = getPedSkin ( source ) local money = getPlayerMoney ( source ) local health = getElementHealth ( source ) local armor = getPedArmor ( source ) local q = mysql_query(database,"SELECT * FROM `accounts` WHERE `Account` = '".. accName .."'") if(mysql_num_rows(q) == 0) then mysql_query( database, "INSERT INTO accounts ( `Account`, intterior, demension, skin, money, health, armor) VALUES ( '" .. accName .. "'," .. i .. ", " .. d .. "," .. skin .. "," .. money .. ", ".. health ..", ".. armor .." )" ) else res = mysql_query ( database, "UPDATE `accounts` SET intterior = ".. i ..", demension = ".. d ..", skin = ".. skin ..", money = ".. money ..", health = ".. health ..", armor = ".. armor .." WHERE `Account` = '"..accName.."'") end end end addEventHandler ( "onPlayerQuit", root, saveAccounts ) function loadAccounts () -- Loading from the database local account = getPlayerAccount ( source ) if ( account ) then local accName = getAccountName(account) local result = mysql_query ( database ,"SELECT * FROM `accounts` WHERE `Account` = '"..accName.."'") if result then while true do local row = mysql_fetch_assoc(result) if not row then break end setElementInterior ( source, row.intterior ) setElementDimension ( source, row.demension ) setPedSkin ( source, row.skin ) setPlayerMoney ( source, row.money ) setElementHealth ( source, row.health) setPedArmor ( source, row.armor ) break end end end end addEventHandler ( "onPlayerLogin", root, loadAccounts ) el archivo .sql CREATE TABLE IF NOT EXISTS `accounts` ( `Account` text NOT NULL, `intterior` int(5) NOT NULL, `demension` int(5) NOT NULL, `skin` int(3) NOT NULL, `money` int(9) NOT NULL, `health` float NOT NULL, `armor` float NOT NULL, `Info` mediumtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Link to comment
Recommended Posts