Jump to content

Ayuda account


Plate

Recommended Posts

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
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

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
  • Recently Browsing   0 members

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