Jump to content

Where problems tostring ?


-ffn-python

Recommended Posts

Posted

Are you using the default race game-mode? If so, there's an onPlayerFinish event.

triggerEvent('onPlayerFinish', source, rank, time) 

Posted

I Did, But I Don't Know

Client

addEvent("python-test", true) 
 addEventHandler("python-test",root, 
 function() 
 setElementData(localPlayer,"wins", (getElementData(localPlayer,"wins") or 0) + 1) 
 end 
 ) 

Server

function testing () 
     triggerClientEvent(client, "python-test", client, kazanma) 
end 
addEventHandler ( "onPlayerFinish", root, testing ) 

Posted

Use source not client, the triggerEvent line shows that the base element (source) is the player who finished the race. So, both client and kazanma is not defined.

Why are you triggering a client event just to set the element data? You can do just that on the server-side.

Posted

I didn't understand a word but this should do.

Server-side:

function testing () 
     setElementData(source, 'wins', (getElementData(source, 'wins') or 0) + 1) 
end 
addEventHandler ( "onPlayerFinish", root, testing ) 

  • Moderators
Posted

Firstly there is no problem to set an element data from the client-side.

Secondly, when you set an element data on one side (for example server side), then it's automatically available on the other side by default (for example client-side). So there is no need to send it again using a trigger.

Posted

Yes, there is no problem setting it client-side, but it's useless to trigger a client event just to set the element data, when you can just do it server-side.

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