Jump to content

Problem with account data


iFoReX

Recommended Posts

@tittle I have a problem with accounts data please say me what is bad in debugging I dont have errors :/

cl-side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.3242,0.6933,0.3477,0.2316,"GUI Skins",true) 
GUIEditor_Label[1] = guiCreateLabel(101,28,214,18,"Aqui Pones la ID del skin que quieras",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Edit[1] = guiCreateEdit(21,25,75,30,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(21,66,111,32,"Comprar Skin",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(196,66,111,32,"Cancelar",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(17,111,323,16,"El Costo de este Skin es el siguiente : 15000 ",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,255,0) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Window[2] = guiCreateWindow(0.3594,0.295,0.291,0.2167,"GUI Confirmacion de Cambio de Skin",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
GUIEditor_Label[3] = guiCreateLabel(39,26,207,14,"Seguro que quieres cambiar tu skin ?",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,255,0) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Button[3] = guiCreateButton(9,82,63,29,"Si",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(206,82,63,29,"No",false,GUIEditor_Window[2]) 
  
guiSetVisible( GUIEditor_Window[1], false) 
showCursor(false) 
------------------------------------ 
---TheMarker------------------------ 
marker = createMarker( 1654.16162, -1661.63123, 21.9, "cylinder", 2, 100, 0, 255, 100 ) 
createBlipAttachedTo( marker, 45 ) 
function warp() 
setElementPosition( localPlayer, 1651, -1661.63123, 21.9 ) 
end 
addCommandHandler("setpos", warp) 
------------------------------------ 
---TheFunctions--------------------- 
  
function markerHit ( hitPlayer ) 
    if ( hitPlayer == localPlayer and source == marker ) then 
        guiSetVisible ( GUIEditor_Window[1], true ) 
        showCursor ( true ) 
        triggerServerEvent ( "cm", getLocalPlayer() ) 
        setElementDimension( localPlayer, 2 ) 
        ped = createPed ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) or 0, 1654.16162, -1661.63123, 21.9 ) -- If no skin was given, it'll create it with CJ skin. 
        setPedSkin(ped, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) 
        if ( ped ) then 
            setElementFrozen ( ped, true ) 
            setElementDimension( ped, 2 ) 
            setElementAlpha( localPlayer, 0 ) 
        end 
    end 
end 
addEventHandler ( "onClientMarkerHit", root, markerHit ) 
  
local originalPosition = { } 
  
function botton() 
    if source == GUIEditor_Button[2] then 
originalPosition = { getElementPosition ( localPlayer ) } 
guiSetVisible( GUIEditor_Window[1], false) 
guiSetVisible( GUIEditor_Window[2], false) 
showCursor(false) 
setCameraTarget( localPlayer ) 
setElementDimension( localPlayer, 0 ) 
setElementFrozen ( localPlayer, false ) 
setElementPosition ( localPlayer, unpack ( originalPosition ) ) 
setElementAlpha ( localPlayer, 255 ) 
elseif source == GUIEditor_Button[1] then 
guiSetVisible( GUIEditor_Window[1], false) 
guiSetVisible( GUIEditor_Window[2], true) 
showCursor(true) 
elseif source == GUIEditor_Button[4] then 
guiSetVisible( GUIEditor_Window[1], true ) 
guiSetVisible( GUIEditor_Window[2], false ) 
showCursor(true) 
elseif source == GUIEditor_Button[3] then 
setCameraTarget( localPlayer ) 
guiSetVisible( GUIEditor_Window[1], false ) 
guiSetVisible( GUIEditor_Window[2], false ) 
showCursor(false) 
setElementDimension( localPlayer, 0 ) 
setElementAlpha( localPlayer, 255 ) 
local money = getPlayerMoney( localPlayer ) 
     if ( money >= 15000 ) then 
     triggerServerEvent("qtm", getLocalPlayer() ) 
     setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) 
     else 
     outputChatBox( " Para Comprarte este skin necesitas $15000 y tu dinero es "..money.." " ) 
    end 
end 
end 
addEventHandler ( "onClientGUIClick", root, botton ) 
  
function destruir ( matchingDimension ) 
if ( localPlayer and source == marker ) then 
     if isElement(ped) then destroyElement(ped) 
end 
end 
end 
addEventHandler("onClientMarkerLeave", root, destruir) 
  
guiSetVisible( GUIEditor_Window[2], false) 

sv-side

function a() 
  
camara = setCameraMatrix( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) 
setElementDimension( camara, 2 ) 
end 
  
addEvent("cm", true) 
addEventHandler("cm", root, a) 
  
function e( ) 
local money = getPlayerMoney ( source ) 
if (money >= 15000) then 
takePlayerMoney( source, 15000 ) 
else 
outputChatBox( " tu Dinero es "..money.." y necesitas $15000 para comprarte un skin " ) 
end 
end 
addEvent("qtm", true) 
addEventHandler("qtm", getRootElement(), e) 
  
function onPlayerQuit ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in 
            local skin = getElementModel( source ) 
            setAccountData ( playeraccount, "skins", skin )  
      end 
end 
  
function onPlayerLogin (_, playeraccount ) 
      -- when a player logins, retrieve his money amount from his account data and set it 
      if ( playeraccount ) then 
            local skins = getAccountData ( playeraccount, "skins" ) 
            -- make sure there was actually a value saved under this key (check if playermoney is not false). 
            -- this will for example not be the case when a player plays the gametype for the first time 
            if ( skins ) then 
                  setElementModel ( source ) 
            end 
      end 
end 
  
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) 
  
  
function spawn() 
if spawnPlayer then 
getAccountData ( playeraccount, "skins" ) 
setElementModel ( source ) 
end 
end 
addEventHandler("onClientPlayerWasted", getRootElement ( ), spawn) 

please help me :P

Link to comment
function spawn() 
if spawnPlayer then 
getAccountData ( playeraccount, "skins" ) 
setElementModel ( source ) 
end 
end 
addEventHandler("onClientPlayerWasted", getRootElement ( ), spawn) 

What do you want to do with it? It saves your skin when you quit and gives you the skin when you login. Your script doesn't work, because the skin isn't set when you spawn and therefore the mistake is in the last function.

There's no 'onClientPlayerWasted' event serverside (all CLIENT events have CLIENT in the eventname), you should use 'onPlayerWasted'. When the player dies, you respawn him at first, then request the 'skins'-accountdata (if he has an account and if it's not a guestaccount) and if he has accountdata on 'skins', you set his skin (model) to that skin.

Link to comment
function a() 
  
camara = setCameraMatrix( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) 
setElementDimension( camara, 2 ) 
end 
  
addEvent("cm", true) 
addEventHandler("cm", root, a) 
  
function e( ) 
local money = getPlayerMoney ( source ) 
if (money >= 15000) then 
takePlayerMoney( source, 15000 ) 
else 
outputChatBox( " tu Dinero es "..money.." y necesitas $15000 para comprarte un skin " ) 
end 
end 
addEvent("qtm", true) 
addEventHandler("qtm", getRootElement(), e) 
  
function playerQuits () 
      local playeraccount = getPlayerAccount ( source ) -- get the player's account 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in 
            local skin = getElementModel( source ) -- get skin accountdata 
            setAccountData ( playeraccount, "skins", skin ) -- save current skin to account 
      end 
end 
addEventHandler ( "onPlayerQuit", getRootElement ( ), playerQuits ) 
  
function playerLogin ( _, playeraccount ) -- player logs in 
      if playeraccount then -- if account that he logged into, exists 
            local skins = getAccountData ( playeraccount, "skins" ) -- get skin accountdata 
            if skins then -- if he has skin accountdata 
                  setElementModel ( source, skins ) -- give him the skin 
            end 
      end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), playerLogin ) 
  
function playerSpawns () -- called when a player spawns 
    local account = getPlayerAccount ( source ) -- get the player's account 
    if account and not isGuestAccount ( account ) then -- if he's logged in on an account 
        local skin = getAccountData ( playeraccount, "skins" ) -- get skin accountdata 
        if skin then -- if he has skin accountdata 
            setElementModel ( source, skin ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), playerSpawns ) -- when player spawns, call playerSpawns function 

This should do it. Saves skin when you quit, gives you the skin when you login or spawn.

Link to comment
function a ( ) 
    camara = setCameraMatrix ( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) 
    setElementDimension( source, 2 ) 
end 
addEvent ( "cm", true ) 
addEventHandler ( "cm", root, a ) 
  
function e ( ) 
    local money = getPlayerMoney ( source ) 
    if ( money >= 15000 ) then 
        takePlayerMoney ( source, 15000 ) 
    else 
        outputChatBox ( " tu Dinero es ".. money .." y necesitas $15000 para comprarte un skin." ) 
    end 
end 
addEvent ( "qtm", true ) 
addEventHandler ( "qtm", root, e ) 
  
function playerQuits ( ) 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if the player is logged in 
        local skin = getElementModel ( source ) -- get the player skin. 
        setAccountData ( playeraccount, "skin", skin ) -- save current skin to account 
    end 
end 
addEventHandler ( "onPlayerQuit", root, playerQuits ) 
  
function playerLogin ( _, playeraccount ) -- player logs in 
      if ( playeraccount ) then -- if account that he logged into, exists 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setElementModel ( source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerLogin", root, playerLogin ) 
  
function playerSpawns ( ) -- called when a player spawns 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if he's logged in on an account 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setElementModel ( source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerSpawn", root, playerSpawns ) -- when player spawns, call playerSpawns function 

Link to comment

No, you didn't get me right, I mean set a timer at setElementModel.

function a ( ) 
    camara = setCameraMatrix ( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) 
    setElementDimension( source, 2 ) 
end 
addEvent ( "cm", true ) 
addEventHandler ( "cm", root, a ) 
  
function e ( ) 
    local money = getPlayerMoney ( source ) 
    if ( money >= 15000 ) then 
        takePlayerMoney ( source, 15000 ) 
    else 
        outputChatBox ( " tu Dinero es ".. money .." y necesitas $15000 para comprarte un skin." ) 
    end 
end 
addEvent ( "qtm", true ) 
addEventHandler ( "qtm", root, e ) 
  
function playerQuits ( ) 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if the player is logged in 
        local skin = getElementModel ( source ) -- get the player skin. 
        setAccountData ( playeraccount, "skin", skin ) -- save current skin to account 
    end 
end 
addEventHandler ( "onPlayerQuit", root, playerQuits ) 
  
function playerLogin ( _, playeraccount ) -- player logs in 
      if ( playeraccount ) then -- if account that he logged into, exists 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setElementModel ( source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerLogin", root, playerLogin ) 
  
function playerSpawns ( ) -- called when a player spawns 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if he's logged in on an account 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setTimer ( setElementModel, 2000, 1, source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerSpawn", root, playerSpawns ) -- when player spawns, call playerSpawns function 

Link to comment

again doesnt work :/ , I buy the script , but when I spawn I have the other skin

here the code :/ please help me :P

sv-side

function a ( ) 
    camara = setCameraMatrix ( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) 
    setElementDimension( source, 2 ) 
end 
addEvent ( "cm", true ) 
addEventHandler ( "cm", root, a ) 
  
function e ( ) 
    local money = getPlayerMoney ( source ) 
    if ( money >= 15000 ) then 
        takePlayerMoney ( source, 15000 ) 
    else 
        outputChatBox ( " tu Dinero es ".. money .." y necesitas $15000 para comprarte un skin." ) 
    end 
end 
addEvent ( "qtm", true ) 
addEventHandler ( "qtm", root, e ) 
  
function playerQuits ( ) 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if the player is logged in 
        local skin = getElementModel ( source ) -- get the player skin. 
        setAccountData ( playeraccount, "skin", skin ) -- save current skin to account 
    end 
end 
addEventHandler ( "onPlayerQuit", root, playerQuits ) 
  
function playerLogin ( _, playeraccount ) -- player logs in 
      if ( playeraccount ) then -- if account that he logged into, exists 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setElementModel ( source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerLogin", root, playerLogin ) 
  
function playerSpawns ( ) -- called when a player spawns 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if he's logged in on an account 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setTimer ( setElementModel, 2000, 1, source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerSpawn", root, playerSpawns ) -- when player spawns, call playerSpawns function 

cl-side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
originalPosition = { } 
rotation = 0 
  
GUIEditor_Window[1] = guiCreateWindow(0.3242,0.6933,0.3477,0.2316,"GUI Skins",true) 
GUIEditor_Label[1] = guiCreateLabel(101,28,214,18,"Aqui Pones la ID del skin que quieras",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Edit[1] = guiCreateEdit(21,25,75,30,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(21,66,111,32,"Comprar Skin",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(196,66,111,32,"Cancelar",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(17,111,323,16,"El Costo de este Skin es el siguiente : 15000 ",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,255,0) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Window[2] = guiCreateWindow(0.3594,0.295,0.291,0.2167,"GUI Confirmacion de Cambio de Skin",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
guiSetVisible( GUIEditor_Window[2], false) 
GUIEditor_Label[3] = guiCreateLabel(39,26,207,14,"Seguro que quieres cambiar tu skin ?",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,255,0) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Button[3] = guiCreateButton(9,82,63,29,"Si",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(206,82,63,29,"No",false,GUIEditor_Window[2]) 
  
guiSetVisible( GUIEditor_Window[1], false) 
showCursor(false) 
guiSetInputMode("no_binds_when_editing") 
------------------------------------ 
---TheMarker------------------------ 
marker = createMarker ( 1654.16162, -1661.63123, 21.6, "cylinder", 2, 100, 0, 255, 100 ) 
createBlipAttachedTo ( marker, 45 ) 
  
function warp ( ) 
    setElementPosition ( localPlayer, 1651, -1661.63123, 21.9 ) 
end 
addCommandHandler ( "setpos", warp ) 
------------------------------------ 
---TheFunctions--------------------- 
  
function markerHit ( hitPlayer ) 
    if ( hitPlayer == localPlayer and source == marker ) then 
        guiSetVisible ( GUIEditor_Window[1], true ) 
        showCursor ( true ) 
        removeEventHandler ( "onClientRender", root, rotateTempPed ) 
        triggerServerEvent ( "cm", getLocalPlayer() ) 
        setElementDimension( localPlayer, 2 ) 
        ped = createPed ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) or 0, 1654.16162, -1661.63123, 21.9 ) -- If no skin was given, it'll create it with CJ skin. 
        if ( ped ) then 
            addEventHandler ( "onClientRender", root, rotateTempPed ) 
            setElementFrozen ( ped, true ) 
            setElementDimension( ped, 2 ) 
            setElementAlpha( localPlayer, 0 ) 
        end 
    end 
end 
addEventHandler ( "onClientMarkerHit", root, markerHit ) 
  
function botton ( ) 
    if source == GUIEditor_Button[2] then 
        originalPosition = { getElementPosition ( localPlayer ) } 
        guiSetVisible( GUIEditor_Window[1], false) 
        guiSetVisible( GUIEditor_Window[2], false) 
        showCursor(false) 
        setCameraTarget( localPlayer ) 
        setElementDimension( localPlayer, 0 ) 
        setElementFrozen ( localPlayer, false ) 
        setElementPosition ( localPlayer, unpack ( originalPosition ) ) 
        setElementAlpha ( localPlayer, 255 ) 
    elseif source == GUIEditor_Button[1] then 
        guiSetVisible( GUIEditor_Window[1], false) 
        guiSetVisible( GUIEditor_Window[2], true) 
        showCursor(true) 
    elseif source == GUIEditor_Button[4] then 
        guiSetVisible( GUIEditor_Window[1], true ) 
        guiSetVisible( GUIEditor_Window[2], false ) 
        showCursor(true) 
    elseif source == GUIEditor_Button[3] then 
        setCameraTarget( localPlayer ) 
        guiSetVisible( GUIEditor_Window[1], false ) 
        guiSetVisible( GUIEditor_Window[2], false ) 
        showCursor(false) 
        setElementDimension( localPlayer, 0 ) 
        setElementAlpha( localPlayer, 255 ) 
        local money = getPlayerMoney( localPlayer ) 
        if ( money >= 15000 ) then 
            triggerServerEvent("qtm", getLocalPlayer() ) 
            setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) 
        else 
            outputChatBox( " Para Comprarte este skin necesitas $15000 y tu dinero es ".. money .." " ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIClick", root, botton ) 
  
addEventHandler ( "onClientGUIChanged", GUIEditor_Edit[1], 
    function ( ) 
        local skin = guiGetText ( source ) 
        if ( isElement ( ped ) ) then 
            setElementModel ( ped, tonumber ( skin ) or 0 ) 
        end 
    end 
) 
  
function destruir ( matchingDimension ) 
    if ( localPlayer and source == marker ) then 
        if isElement ( ped ) then 
            destroyElement ( ped ) 
            removeEventHandler ( "onClientRender", root, rotateTempPed ) 
        end 
    end 
end 
addEventHandler ( "onClientMarkerLeave", root, destruir ) 
  
function rotateTempPed ( ) 
    if isElement ( ped ) then -- If the ped exists 
        rotation = rotation + 1 -- Increase the variable "rotation" by 1. 
        if ( rotation > 359 ) then -- If the rotation is higher to 359 
            rotation = 0 -- Set the rotation back to 0. 
        end 
  
        setPedRotation ( ped, rotation ) -- Set the ped rotation to variable "rotation". 
    end 
end 

Link to comment

Now I have It Problem :/ When I Put in GUIEditor_Edit[1] I have it problem in debugging and console

here the lua

function a ( ) 
    camara = setCameraMatrix ( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) 
    setElementDimension( source, 2 ) 
end 
addEvent ( "cm", true ) 
addEventHandler ( "cm", root, a ) 
  
function e ( ) 
    local money = getPlayerMoney ( source ) 
    if ( money >= 15000 ) then 
        takePlayerMoney ( source, 15000 ) 
        local Skins = xmlCreateFile("skins.xml","Propietarios") 
        local propietarios = xmlCreateChild(Skins, "owners") 
        local success = xmlNodeSetValue ( propietarios, "..trosting ( guiGetText ( GUIEditor_Edit[1] ) ).. " ) 
xmlSaveFile( Skins ) 
SkinsXML = xmlLoadFile("skins.xml") 
    local child = xmlFindChild(SkinsXML, "Skin", 0) 
xmlNodeSetAttribute(child, "ID",  ( trosting ( guiGetText ( GUIEditor_Edit[1] ) ) ) ) 
    else 
        outputChatBox ( " tu Dinero es ".. money .." y necesitas $15000 para comprarte un skin." ) 
    end 
end 
addEvent ( "qtm", true ) 
addEventHandler ( "qtm", root, e ) 
  
function playerQuits ( ) 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if the player is logged in 
        local skin = getElementModel ( source ) -- get the player skin. 
        setAccountData ( playeraccount, "skin", skin ) -- save current skin to account 
    end 
end 
addEventHandler ( "onPlayerQuit", root, playerQuits ) 
  
function playerLogin ( _, playeraccount ) -- player logs in 
      if ( playeraccount ) then -- if account that he logged into, exists 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setElementModel ( source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerLogin", root, playerLogin ) 
  
function playerSpawns ( ) -- called when a player spawns 
    local playeraccount = getPlayerAccount ( source ) -- get the player's account 
    if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if he's logged in on an account 
        local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata 
        if ( skin ) then -- if he has skin accountdata 
            setTimer ( setElementModel, 2000, 1, source, tonumber ( skin ) ) -- give him the skin 
        end 
    end 
end 
addEventHandler ( "onPlayerSpawn", root, playerSpawns ) -- when player spawns, call playerSpawns function 
  

Here the console and debugging error

[2012-04-22 09:23:23] ERROR: GUI4\xDD_sv.lua:18: attempt to index global 'GUIEditor_Edit' (a nil value) 

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