Jump to content

Why it doesnt work ?


iFoReX

Recommended Posts

why the proyectile doesnt shot ?

cl-side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0,0.135,0.2575,0.6017,"Elige un Misil",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,23,188,243,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
col = guiGridListAddColumn(GUIEditor_Grid[1],"Misiles",0.-- s8) -->
GUIEditor_Button[1] = guiCreateButton(9,271,188,38,"Elegir",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(9,312,188,38,"Cancelar",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(0,0.135,0.1912,0.5217,"Opciones",true) 
GUIEditor_Button[6] = guiCreateButton(9,158,43,41,"<",false,GUIEditor_Window[2]) 
GUIEditor_Button[7] = guiCreateButton(49,121,43,41,"^",false,GUIEditor_Window[2]) 
GUIEditor_Button[8] = guiCreateButton(89,157,43,41,">",false,GUIEditor_Window[2]) 
GUIEditor_Button[9] = guiCreateButton(50,196,43,41,"v",false,GUIEditor_Window[2]) 
GUIEditor_Button[10] = guiCreateButton(9,264,133,34,"Cancelar",false,GUIEditor_Window[2]) 
  
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
  
local marker = createMarker(213.9440612793, 1818.9245605469, 5.9,"cylinder",1,0,120,0,140) 
  
addEventHandler("onClientMarkerHit",root,function(hitPlayer, matchingDimension) 
if hitPlayer == getLocalPlayer() then 
if source == marker then 
guiSetVisible(GUIEditor_Window[1],true) 
showCursor(true) 
end 
end 
end 
) 
  
addEventHandler("onClientResourceStart",resourceRoot,function() 
local row = guiGridListAddRow(GUIEditor_Grid[1]) 
guiGridListSetItemText(GUIEditor_Grid[1],row,col,"LanzaMisil 1",false,false) 
end 
) 
  
  
addEventHandler("onClientGUIClick",root,function() 
if source == GUIEditor_Button[3] then 
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
elseif source == GUIEditor_Button[1] then 
local xr,xc = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
local item = guiGridListGetItemText(GUIEditor_Grid[1],xr,xc) 
if item == 'LanzaMisil 1' then 
triggerServerEvent("CameraM1",getLocalPlayer()) 
guiSetVisible(GUIEditor_Window[2],true) 
guiSetVisible(GUIEditor_Window[1],false) 
addEventHandler("onClientClick",root,tirar) 
end 
elseif source == GUIEditor_Button[10] then 
setCameraTarget(getLocalPlayer()) 
guiSetVisible(GUIEditor_Window[1],true) 
guiSetVisible(GUIEditor_Window[2],false) 
elseif source == GUIEditor_Button[6] then 
triggerServerEvent("moveLeft",getLocalPlayer()) 
elseif source == GUIEditor_Button[7] then 
triggerServerEvent("moveUp",getLocalPlayer()) 
elseif source == GUIEditor_Button[8] then 
triggerServerEvent("moveRight",getLocalPlayer()) 
elseif source == GUIEditor_Button[9] then 
triggerServerEvent("moveDown",getLocalPlayer()) 
end 
end 
) 
  
function tirar(worldX,worldY,worldZ) 
local cursorX,cursorY,cursorZ,worldX,worldY,worldZ = getCursorPosition() 
if not createProjectile(getLocalPlayer(),19,worldX,worldY,worldZ) then 
outputChatBox("el misil no se pudo crear",getLocalPlayer()) 
end 
end 

sv-side

addEvent("CameraM1",true) 
addEventHandler("CameraM1",root,function() 
local camera = setCameraMatrix(source,189.95697021484, 2081.3354492188, 26,226.38482666016, 2045.6298828125, 32.410900115967) 
end 
) 
  
addEvent("moveLeft",true) 
addEventHandler("moveLeft",root,function() 
local x,y,z,lx,ly,lz = getCameraMatrix(source) 
setCameraMatrix(source,x,y,z,lx,ly+5,lz) 
end 
) 
  
addEvent("moveUp",true) 
addEventHandler("moveUp",root,function() 
local x,y,z,lx,ly,lz = getCameraMatrix(source) 
setCameraMatrix(source,x,y,z,lx,ly,lz+5) 
end 
) 
  
addEvent("moveRight",true) 
addEventHandler("moveRight",root,function() 
local x,y,z,lx,ly,lz = getCameraMatrix(source) 
setCameraMatrix(source,x,y,z,lx,ly-5,lz) 
end 
) 
  
addEvent("moveDown",true) 
addEventHandler("moveDown",root,function() 
local x,y,z,lx,ly,lz = getCameraMatrix(source) 
setCameraMatrix(source,x,y,z,lx,ly,lz-5) 
end 
) 

Link to comment
function tirar() 
local cursorX,cursorY,worldX,worldY,worldZ = getCursorPosition() 
if not createProjectile(getLocalPlayer(),19,worldX,worldY,worldZ) then 
outputChatBox("el misil no se pudo crear") 
end 
end 

Link to comment

try

function tirar(_,_,_,_,worldX,worldY,worldZ) 
     if not createProjectile(getLocalPlayer(),19,worldX,worldY,worldZ) then 
          outputChatBox("el misil no se pudo crear") 
     end 
end 

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