Jump to content

problem with triggerServerEvent


John Smith

Recommended Posts

Posted

hi im having some impossible problem which makes zero sense.

  
-- client 
triggerServerEvent("onSpawnRequest",localPlayer,spawnvehicle,posX,posY,posZ,rotX,rotY,rotZ,interior,alpha); 
  
-- server 
function asd(spawnvehicle,x,y,z,rotx,roty,rotz,interior,alpha) 
    outputChatBox(tostring(spawnvehicle)); 
end; 
  

On client side spawnvehicle is 411 (infernus vehicle id) and somehow on server side spawnvehicle argument is using x argument's value, so it's a coordinate instead of 411

why is that happening???????

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

dude if i didn't add custom event on server side, it wouldn't output anything on chat omg

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

nvm i fixed it by making workaround(this is mta bug i suppose), there was some issue with metamethods+this

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

I sometimes come across this. My solution is just to add a dummy parameter at the beginning. Always seems to work for me.

  
-- client 
triggerServerEvent("onSpawnRequest",localPlayer,spawnvehicle,posX,posY,posZ,rotX,rotY,rotZ,interior,alpha); 
  
-- server 
function asd(_, spawnvehicle,x,y,z,rotx,roty,rotz,interior,alpha) 
    outputChatBox(tostring(spawnvehicle)); 
end; 

Posted

Yea.. um my problem was caused because i've been using metamethods.

so the function was something like

function table:asd(arg1,arg2,arg3)

end;

and in that metamethod function, self variable became the vehicle model, so spawnvehicle isn't required in function arguments.

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

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