Plate Posted April 20, 2013 Share Posted April 20, 2013 Hola alguien me podria decir por que este script no anda tampoco me da error function dejar() local row, col = guiGridListGetSelectedItem ( itemGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local item = guiGridListGetItemText ( itemGrid, row, 1 ) local ammo = guiGridListGetItemText ( itemGrid, row, 2 ) local x, y ,z = getElementPosition(localPlayer) local pickup = createPickup(x + 5, y, z, 2, item, 3000, ammo) end end addEventHandler("onClientGUIClick", tirar, dejar, false) Link to comment
Alexs Posted April 20, 2013 Share Posted April 20, 2013 'ammo' e 'item' son strings, pero los usas como ints. Link to comment
Plate Posted April 21, 2013 Author Share Posted April 21, 2013 function dejar() local row, col = guiGridListGetSelectedItem ( itemGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local item = guiGridListGetItemText ( itemGrid, row, 1 ) local ammo = guiGridListGetItemText ( itemGrid, row, 2 ) local itemName = getWeaponIDFromName(item) local x, y ,z = getElementPosition(localPlayer) local pickup = createPickup(x + 5, y, z, 2, itemName, 3000, tonumber(ammo)) triggerServerEvent("onPlayerPullItem", localPlayer, itemName, ammo) end end addEventHandler("onClientGUIClick", tirar, dejar, false) pero tengo que usar onPickupHit no para que le de el arma con la ammo Link to comment
Plate Posted April 21, 2013 Author Share Posted April 21, 2013 Por que cuando paso por el pickup no pasa nada supongo que tengo que usar onPickupHit Link to comment
Sasu Posted April 21, 2013 Share Posted April 21, 2013 function dejar() if source == tirar then local row, col = guiGridListGetSelectedItem ( itemGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local item = guiGridListGetItemText ( itemGrid, row, 1 ) local ammo = guiGridListGetItemText ( itemGrid, row, 2 ) local itemName = getWeaponIDFromName(item) local x, y ,z = getElementPosition(localPlayer) local pickup = createPickup(x + 5, y, z, 2, itemName, 3000, tonumber(ammo)) triggerServerEvent("onPlayerPullItem", localPlayer, itemName, ammo) end end end addEventHandler("onClientGUIClick", root, dejar) Link to comment
Plate Posted April 21, 2013 Author Share Posted April 21, 2013 ya le agregue el tonumber ammo pero igual no lo levanta Link to comment
Sasu Posted April 21, 2013 Share Posted April 21, 2013 Y si creas el evento en el server y lo triggeas. Porque hay funciones que desde client no funcionan para usarlo. Como el createVehicle que no te puedes subir si lo creas en client. Link to comment
Plate Posted April 21, 2013 Author Share Posted April 21, 2013 es verdad sasuke ahora pruebo men function destroyMyPickup() if (isElement(pickup)) then if (source == pickup) then destroyElement(pickup) end end end addEventHandler("onPickupHit", pickup, destroyMyPickup) Link to comment
Recommended Posts