Jump to content

What s Problem


Scripting

Recommended Posts

Posted

Pls fix that Code don t work!!

client-side:

name1 = guiCreateLabel(50,10,410,20,"",false,tab) 
function join () 
  function join () 
             triggerServerEvent ( 'load', source) 
  end 
  addEventHandler("onClientPlayerJoin", getRootElement(), join) 

server-side:

addEvent("load",true) 
     addEventHandler( "load",root, 
     function() 
     loadxml = xmlLoadFile("score.xml") 
     if loadxml then 
     score1 = xmlFindChild(file,"flos1",0) 
     find1 = xmlNodeGetValue(score1) 
     triggerClientEvent ( 'loadClient', source,find1 ) 
     end 
     end      
    ) 

client-side:

addEvent("loadClient",true)  
  addEventHandler("loadClient",root, 
  function(find1) 
   place = tonumber(find1) 
          guiSetText(name1,place) 
  end 
  ) 

Posted

client

name1 = guiCreateLabel(50,10,410,20,"",false,tab) 
function join () 
triggerServerEvent ( source, 'load', source) 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), join) 

server

addEvent("load",true) 
addEventHandler( "load",root, 
function() 
loadxml = xmlLoadFile("score.xml") 
if loadxml then 
score1 = xmlFindChild(loadxml ,"flos1",0) 
find1 = xmlNodeGetValue(score1) 
triggerClientEvent ( source, 'loadClient', find1 ) 
end 
end      
) 

Posted

You should tabulate the code.

Client-side:

addEvent ( 'loadAtClient', true ); 
  
local name = guiCreateLabel ( 50, 10, 410, 20, '', false, tab ); 
  
addEventHandler ( 'onClientPlayerJoin', root, 
    function ( ) 
        triggerServerEvent ( source, 'loadData', source ); 
    end 
) 
  
addEventHandler ( 'loadAtClient', root, 
    function ( nData ) 
        if ( not nData ) then 
            return; 
        end 
         
        guiSetText ( name, tonumber ( nData ) ); 
    end 
) 

Server-side:

addEvent ( 'loadData', true ); 
  
addEventHandler ( 'loadData', root, 
    function ( ) 
        local fData = xmlLoadFile ( 'score.xml' ); 
        if ( fData ) then 
            local fNode = xmlFindChild ( fData, 'flos1', 0 ); 
            local fValue = xmlNodeGetValue ( fNode ); 
            triggerClientEvent ( source, 'loadAtClient', source, fValue ); 
        end 
    end 
) 

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

This script should load data when the player joins and send it to the client side? if so, then you must use onClientResourceStart because onClientPlayerJoin is triggered for everyone but the player who joined.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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