Jump to content

triggetClientEvent [HELP]


Sande

Recommended Posts

Posted

Hey, i try to start godmode with these script. This works on mtasa 1.3.2 but not 1.3.3. I didnt see any triggerClientEvent changes on wiki so whats wrong.

Server:

  
function godmode() 
    local team = getPlayerTeam ( source ) 
    if getTeamName (team) == "Freeroam" then 
    triggerClientEvent(source, "goFreeroam", source) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), godmode ) 
  

Client:

  
addEvent("goFreeroam", true) 
addEventHandler("goFreeroam", root, 
function() 
 executeCommandHandler("godmode") 
end ) 

560x95_FFFFFF_FF9900_000000_000000.png
Posted

It could be that the client side is not yet loaded.

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

why you don´t do this -->

  
function godmode() 
    local team = getPlayerTeam ( source ) 
    if getTeamName (team) == "Freeroam" then 
        extecuteCommandHandler ("godmode", source);  
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), godmode ) 
  

there are two kinds of people: those who know C++ and those who don´t. .)

Posted

That should also work, as far as I know.

P.S: You got a typo there: "extecuteCommandHandler " instead of "executeCommandHandler".

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

I think is better cause you don´t have to add a clientside-script

(avoid client-side when you think you can do it server-side)

there are two kinds of people: those who know C++ and those who don´t. .)

Posted
function godmode ( ) 
    local team = getPlayerTeam ( source ) 
    if ( team and getTeamName ( team ) == "Freeroam" ) then 
        executeCommandHandler ( "godmode", source ) 
    end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), godmode ) 

That code doesn't work?

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

Yes it working on my mtasa 1.3.2) testserver. But not in main server (1.3.3) and not second test server (1.3.3) so idk what wrong.

560x95_FFFFFF_FF9900_000000_000000.png

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