Fabioxps Posted April 4, 2013 Share Posted April 4, 2013 can someone help me with this? Server addCommandHandler ( "a", function() local ped = createPed(0, 138.70454406738, 2491.1267089844, 16.484375) local pVeh = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270) local pedssss = createPed(0,-73.699996948242, 2500.3999023438, 16.299999237061) local cAmssss = createVehicle(411, -73.699996948242, 2500.3999023438, 16.299999237061,0,0,270) local pedsss = createPed(0,-73.699996948242, 2510.3999023438, 16.299999237061) local cAmsss = createVehicle(411, -73.699996948242, 2510.3999023438, 16.299999237061,0,0,270) warpPedIntoVehicle ( ped,pVeh ,0 ) warpPedIntoVehicle ( pedssss,cAmssss, 0 ) warpPedIntoVehicle ( pedsss,cAmsss ,0 ) triggerClientEvent("onCameraStart",root, ped,pVeh) triggerClientEvent("onCameraStarts",root, pedsss,cAmsss) triggerClientEvent("onCameraStartsss",root, pedssss,cAmssss) triggerClientEvent("stunts",getRootElement(),stunts) outputChatBox("test") end) Client local peds = { } local pedss = { } local pedsss = { } stunt = nil stunt2 = nil stunt3 = nil function stunts(tag) stunt = tag stunt2 = tag stunt3 = tag end addEvent("stunts",true) addEventHandler("stunts",getRootElement(),stunts) function camera ( ) for ped,veh in pairs(peds)do local x, y, z = getElementPosition(veh) setCameraMatrix(x+12, y+11, z+4, x, y, z) end end function cameraStarts(ped) setPedControlState(ped,"accelerate",true) setTimer(function() setPedControlState(ped,"accelerate",false) end,800,1) pVeh = getPedOccupiedVehicle(ped) if not peds[ped] then peds[ped] = pVeh end addEventHandler("onClientRender",root,camera) addEventHandler("onClientRender",getRootElement(),stunt) end addEvent( "onCameraStart", true ) addEventHandler( "onCameraStart",root, cameraStarts ) function cameraStartsss(pedsss) setPedControlState(pedsss,"accelerate",true) setTimer(function() setPedControlState(pedsss,"accelerate",false) end,600,1) cAmsss = getPedOccupiedVehicle(pedsss) if not pedss[pedsss] then pedss[pedsss] = cAmsss end addEventHandler("onClientRender",getRootElement(),stunt2) end addEvent( "onCameraStarts", true ) addEventHandler( "onCameraStarts",root, cameraStartsss ) function cameraStartssss(pedssss) setPedControlState(pedssss,"accelerate",true) setTimer(function() setPedControlState(pedssss,"accelerate",false) end,600,1) cAmssss = getPedOccupiedVehicle(pedssss) if not pedsss[pedssss] then pedsss[pedssss] = cAmssss end addEventHandler("onClientRender",getRootElement(),stunt3) end addEvent( "onCameraStartsss", true ) addEventHandler( "onCameraStartsss",root, cameraStartssss ) function stunt ( ) local x, y = guiGetScreenSize ( ) for _, veh in pairs ( peds ) do if ( veh ) then local x, y, z = getElementPosition ( veh ) local px, py, pz = x + 5, y + 10, z + 2 local distance = getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) local rank = getElementData(localPlayer,"race rank") if ( distance <= 150 ) then local sx, sy = getScreenFromWorldPosition ( x, y, z + 0.55, 0.06 ) if ( sx ) then if stunt ~= nil then if ( rank == 1 ) then local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawImage ( sx - 100, sy - 105, 200, 70,"tooltip.png",0,0,0,tocolor(255,255,255,255)) dxDrawText ( "#ffffff1º ".. getPlayerName ( source ) .." Winner!", sx, sy - 70, sx, sy - 60, tocolor ( 255, 255, 255, 255 ), math.min ( 0.4 * ( 20 / distance ) * 1.4, 4 ), "default-bold", "center", "bottom", false, false, false, true ) end end end end end end end function stunt2 ( ) local x, y = guiGetScreenSize ( ) for _, veh in pairs ( pedss ) do if ( veh ) then local x, y, z = getElementPosition ( veh ) local px, py, pz = x + 5, y + 10, z + 2 local distance = getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) if ( distance <= 150 ) then local sx, sy = getScreenFromWorldPosition ( x, y, z + 0.55, 0.06 ) local rank = getElementData(localPlayer,"race rank") if ( sx ) then if stunt2 ~= nil then if ( rank == 2 ) then local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawImage ( sx - 100, sy - 105, 200, 70,"tooltip.png",0,0,0,tocolor(255,255,255,255)) dxDrawText ( "#ffffff1º ".. getPlayerName ( source ) .." Winner!", sx, sy - 70, sx, sy - 60, tocolor ( 255, 255, 255, 255 ), math.min ( 0.4 * ( 20 / distance ) * 1.4, 4 ), "default-bold", "center", "bottom", false, false, false, true ) end end end end end end end function stunt3 ( ) local x, y = guiGetScreenSize ( ) for _, veh in pairs ( pedsss ) do if ( veh ) then local x, y, z = getElementPosition ( veh ) local px, py, pz = x + 5, y + 10, z + 2 local distance = getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) if ( distance <= 150 ) then local sx, sy = getScreenFromWorldPosition ( x, y, z + 0.55, 0.06 ) local rank = getElementData(localPlayer,"race rank") if ( sx ) then if stunt3 ~= nil then if ( rank == 3 ) then local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawImage ( sx - 100, sy - 105, 200, 70,"tooltip.png",0,0,0,tocolor(255,255,255,255)) dxDrawText ( "#ffffff1º ".. getPlayerName ( source ) .." Third!", sx, sy - 70, sx, sy - 60, tocolor ( 255, 255, 255, 255 ), math.min ( 0.4 * ( 20 / distance ) * 1.4, 4 ), "default-bold", "center", "bottom", false, false, false, true ) end end end end end end end Link to comment
Guest Guest4401 Posted April 5, 2013 Share Posted April 5, 2013 can someone help me with this? What should we do? /debugscript 3? Is there a bug in it or what? viewtopic.php?f=91&t=47897 Link to comment
TAPL Posted April 5, 2013 Share Posted April 5, 2013 in server side, stunts is not defined. Link to comment
Fabioxps Posted April 5, 2013 Author Share Posted April 5, 2013 can someone help me with this? What should we do? /debugscript 3? Is there a bug in it or what? viewtopic.php?f=91&t=47897 has no errors but does not appear the names of players Link to comment
TAPL Posted April 5, 2013 Share Posted April 5, 2013 You should use localPlayer instead of source. Link to comment
TAPL Posted April 5, 2013 Share Posted April 5, 2013 names not yet appear in server side, stunts is not defined. Also local x, y = guiGetScreenSize ( ) Will be overwrite by this: local x, y, z = getElementPosition ( veh ) Link to comment
Fabioxps Posted April 5, 2013 Author Share Posted April 5, 2013 names not yet appear in server side, stunts is not defined. Also local x, y = guiGetScreenSize ( ) Will be overwrite by this: local x, y, z = getElementPosition ( veh ) the problem in this "rank" but do not know fix 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