Jump to content

Triggering clientside events won't work.


Dzakub

Recommended Posts

Posted

Hi,

I want to trigger a event from server by triggerClientEvent, but it doesn't work.

Here's the code:

  
Server: 
 function startTrip() 
    triggerClientEvent(source,"startTrip", source) 
end 
  
addEventHandler("onPlayerPickupHit", getRootElement(), startTrip) 
  
Client: 
addEvent("startTrip",true) 
addEventHandler("startTrip", getRootElement(), getTrip) 
  

Posted

read more wiki.

source of onPlayerPickupHit event is PICKUP. and you are trying to trigger client event on PICKUP.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

No, you are wrong.

The source of this event is the player that hit the pickup.

And it is not the problem, my server shows an error that the event startTrip is not added clientside, However if i copy this same code to runcode (by run and crun) it works :shock:

Posted

first: you should always tell us EXACT error.

second: you are right, i was wrong, just didnt read carefully - and this is caused because you wont tell its triggering any error :P

third: ill try it now

edit:

http://upload.dzek.metal.info/pliki/test.rar

its working

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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