BennyBunny Posted August 25, 2011 Share Posted August 25, 2011 I wanna get some data from the server back to the client but on the client side i get nothing Server side: function drivtsavetop ( savetimerfortopdrift ) -- get the time from client that is savetimerfortopdrift addrealnumberdrift = tonumber(savetimerfortopdrift) local playernamedrift = getPlayerName ( source ) ... senddatatoclienttest = test triggerClientEvent ( "serverdatadrift", getRootElement(), senddatatoclienttest ) ... addEvent( "driftsendtoclient", true ) addEventHandler( "driftsendtoclient", getRootElement(), drivtsavetop ) -- add the sever side function in the client one client side: function getdatafromserverdrift ( senddatatoclienttest ) datafromserverdrifttimeone = senddatatoclienttest end addEvent( "serverdatadrift", true ) addEventHandler( "serverdatadrift", getRootElement(), getdatafromserverdrift ) function drivestart ( thePlayer ) ... if markercontrolldrift == 16 ... -- Test for save top 3 timer outputChatBox ( "timer:"..savetimerfortopdrift, 0, 255, 0, thePlayer ) triggerServerEvent ( "driftsendtoclient", getLocalPlayer(), savetimerfortopdrift ) -- send the end timer to the server for check and save outputChatBox ( "test for data from server:"..datafromserverdrifttimeone, 0, 255, 0, thePlayer ) -- -------------------------------------- -- end end addEventHandler ( "onClientMarkerHit", checkpointdriftone, drivestart ) Link to comment
BennyBunny Posted August 25, 2011 Author Share Posted August 25, 2011 can somone help me plz i that is the last part of my script then i have finish my race script. I need that for get the top 3 winner in window when the player finish the race. For that i need the data from the db to the client for the top 3 winner but i try and try nothing Link to comment
SDK Posted August 26, 2011 Share Posted August 26, 2011 That's a bit of a mess, with all the ...'s. I think you need to move the "test for data from server" output to the getdatafromserverdrift function. Server/client events don't work immediately. Link to comment
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