whiskeyzulu Posted April 21, 2016 Share Posted April 21, 2016 Hi, I'm struggling to debug my busted cut scene event. I want to be able to type "bust" into the server console and force the client into busted state. I think I'm confusing source/root/etc in my event handlers. server: function buster() --print("SERVER BUST") triggerClientEvent("onBusted",source) end addCommandHandler("bust",buster) client: bustedText = dxCreateTexture("busted.png") function busted() outputChatBox("Busted") print("Busted") if getPlayerName(localPlayer) == "bandit" then --get bandit position local bx,by,bz = getElementPosition(localPlayer) --get table of all vehicles local vehicles = getElementsByType("vehicle") for i, vehicle in ipairs (vehicles) do --find out if other players are nearby local px,py,pz = getElementPosition(vehicle) local distance = getDistanceBetweenPoints3D(bx,by,bz,px,py,pz) if distance < 5 and getElementModel(vehicle) == 596 then createExplosion(bx,by,bz,10) --10 means tank grenade style print ("BOOM") outputChatBox("BOOM!") local screenWidth,screenHeight = guiGetScreenSize() local angle = 0 for i=1,10 do for j=1,360 do angle = math.sin(j) * 80 dxDrawImage(screenWidth / 2 - 50, 0, 100, 240, bustedText, angle, 0, 0) end end for i=1,100 do dxDrawImage(screenWidth / 2 - 50, 0, 100, 240, bustedText, angle, 0, 0) end triggerServerEvent("onWarp",getRootElement()) end end end end addEvent("onBusted",true) addEventHandler("onBusted",root,busted) addEventHandler("onClientVehicleCollision",getRootElement(),busted) Link to comment
Anubhav Posted April 22, 2016 Share Posted April 22, 2016 function buster(p) --print("SERVER BUST") triggerClientEvent("onBusted",p) end addCommandHandler("bust",buster) CommandHandler is not a EventHandler. Link to comment
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