John Smith Posted December 24, 2015 Posted December 24, 2015 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???????
AMARANT Posted December 24, 2015 Posted December 24, 2015 Did you add the event for your server-side function?
John Smith Posted December 24, 2015 Author Posted December 24, 2015 dude if i didn't add custom event on server side, it wouldn't output anything on chat omg
AMARANT Posted December 24, 2015 Posted December 24, 2015 Then you have to check your client-side code more thoroughly or provide the full code here. Because everything you posted now seems OK.
John Smith Posted December 24, 2015 Author Posted December 24, 2015 nvm i fixed it by making workaround(this is mta bug i suppose), there was some issue with metamethods+this
Noki Posted December 25, 2015 Posted December 25, 2015 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;
John Smith Posted December 25, 2015 Author Posted December 25, 2015 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now