Jump to content

Rob-System Help! URGENT


flowz

Recommended Posts

Well i made most of my rob system but when i enter the marker for robbing it says,

WARNING: rob-system\server.lua:13 Bad argument @ 'triggerClientEvent' [Expected element at argument 2, got boolean] 

Server Side -- Error Part

function robEnterTwo() 
if source then 
setTimer ( function() 
         triggerClientEvent("robbedShop") 
      end, 1000, 1 ) 
   end   
end 
addEventHandler("onMarkerHit", robMarker, robEnterTwo) 

Client Side -- The Event "robbedShop"

function robbedShop() 
givePlayerMoney( 1500 ) 
end 
addEvent("robbedShop",true) 
addEventHandler("robbedShop",root,robbedShop) 

Help me please! :( Urgent.

Link to comment
triggerClientEvent( source, "robbedShop")

Is it this ?

No

I think you were going for this:

function robEnterTwo( p ) 
    if ( isElement ( p ) ) then 
        setTimer ( function( p ) 
            triggerClientEvent ( p, "robbedShop", p ) 
        end, 1000, 1, p ) 
   end   
end 
addEventHandler("onMarkerHit", robMarker, robEnterTwo) 

Link to comment

You're welcome.

(Also, I'm not sure why you're triggering a client event to give the player money, but it's not a good idea. The client side and server side money isn't synced by default, so the server is going to be returning a different value then the client side when you use getPlayerMoney. This also applies to takePlayerMoney)

Link to comment

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