Jump to content

[Help] Bloody Object ID


squaredb

Recommended Posts

Try this:

-- Server

function fxAddForAllClientsBlood(x, y, z, dx, dy, dz, c, b) 
     if type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" or type(dx) ~= "number" or type(dy) ~= "number" or type(dz) ~= "number" then outputDebugString("Invalid arguments in fxAddForAllClientsBlood", 1) return end 
     if not c then c = 1 end 
     if not b then b = 1 end 
     triggerClientEvent(root, "onServerRequest_fxAddBlood", root, x, y, z, dx, dy, dz, c, b) 
end 

-- Client

addEvent("onServerRequest_fxAddBlood", true) 
addEventHandler("onServerRequest_fxAddBlood", root,  
function(x, y, z, dx, dy, dz, c, b) 
     fxAddBlood(x, y, z, dx, dy, dz, c, b) 
end ) 

Link to comment
Try this:

-- Server

function fxAddForAllClientsBlood(x, y, z, dx, dy, dz, c, b) 
     if type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" or type(dx) ~= "number" or type(dy) ~= "number" or type(dz) ~= "number" then outputDebugString("Invalid arguments in fxAddForAllClientsBlood", 1) return end 
     if not c then c = 1 end 
     if not b then b = 1 end 
     triggerClientEvent(root, "onServerRequest_fxAddBlood", root, x, y, z, dx, dy, dz, c, b) 
end 

-- Client

addEvent("onServerRequest_fxAddBlood", true) 
addEventHandler("onServerRequest_fxAddBlood", root,  
function(x, y, z, dx, dy, dz, c, b) 
     fxAddBlood(x, y, z, dx, dy, dz, c, b) 
end ) 

A very great example in how it should be done.

Link to comment

triggerClientEvent has got some undefined number of arguments.

First argument is/are the element/s that will take part on the event. Since blood will be added for everybody we set ROOT.

Then, second argument, ofc the event.

Third argument is the SOURCE of the event. Since it's not important here we just set ROOT. After that, you can pass arguments (x, y, z, etc)

F/E if you wanted to trigger a Client Event for only ONE person, you can use as first argument getPlayerFromName(), just as an example.

With my code, if you want to create a blood that will be seen for everybody, do serverside:

fxAddForAllClientsBlood(x, y, z, dx, dy, dz, c, b) 

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