Scripting Posted April 16, 2012 Posted April 16, 2012 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 )
Sparrow Posted April 16, 2012 Posted April 16, 2012 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 )
drk Posted April 16, 2012 Posted April 16, 2012 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
Castillo Posted April 16, 2012 Posted April 16, 2012 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. Education is the most powerful weapon which you can use to change the world.
Scripting Posted April 17, 2012 Author Posted April 17, 2012 Yea Solidsnake14 thx verry much for help!
Castillo Posted April 17, 2012 Posted April 17, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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