Plate Posted February 16, 2013 Posted February 16, 2013 Hola tengo un problema con este script el problema es que cuando toco el boton "equipar" me pone el arma default ( el puño) function setweapon(weaponID) local ID = getSlotFromWeapon(weaponID) setPedWeaponSlot(localPlayer, ID) end addEventHandler("onClientGUIClick", equipar, setweapon, false) EDIT: Tambien probe asi function setweapon(weaponName) local ID = getSlotFromWeapon(weaponName) setPedWeaponSlot(localPlayer, ID) end addEventHandler("onClientGUIClick", equipar, setweapon, false)
Castillo Posted February 16, 2013 Posted February 16, 2013 onClientGUIClick no tiene ningun argumento de armas.
Plate Posted February 16, 2013 Author Posted February 16, 2013 Es para equiparse el arma cuando toques el boton ( hay una gridlist de armas que te dice tus armas y vos tocas equipar y se te tiene que poner el arma selecionada)
Castillo Posted February 16, 2013 Posted February 16, 2013 Tenes que obtener el item seleccionado, usa: guiGridListGetSelectedItem guiGridListGetItemText
Plate Posted February 16, 2013 Author Posted February 16, 2013 function setweapon(weaponName) local row, col = guiGridListGetSelectedItem ( lista ) if ( row and col and row ~= -1 and col ~= -1 ) then local team = guiGridListGetItemText ( lista, row, 1 ) setPedWeaponSlot(localPlayer, getSlotFromWeapon(weaponName)) end addEventHandler("onClientGUIClick", equipar, setweapon, false)
Castillo Posted February 16, 2013 Posted February 16, 2013 Por lo menos presta atencion si vas a copiar de otro tema. "weaponName" no esta definido, ademas de que es un string seguramente. Te falta un "end".
Plate Posted February 16, 2013 Author Posted February 16, 2013 weponName es un argument no copie de otro tema sino de otro de mis scripts en los que vos me ayudastes function setweapon() local row, col = guiGridListGetSelectedItem ( lista ) if ( row and col and row ~= -1 and col ~= -1 ) then local weaponName = guiGridListGetItemText ( lista, row, 1 ) setPedWeaponSlot(localPlayer, getSlotFromWeapon(weaponName)) end end addEventHandler("onClientGUIClick", equipar, setweapon, false)
Plate Posted February 16, 2013 Author Posted February 16, 2013 function setweapon(weaponName) local row, col = guiGridListGetSelectedItem ( lista ) if ( row and col and row ~= -1 and col ~= -1 ) then local weaponName = guiGridListGetItemText ( lista, row, 1 ) local theWeapon = getWeaponIDFromName(weaponName) setPedWeaponSlot(localPlayer, getSlotFromWeapon(theWeapon)) end end addEventHandler("onClientGUIClick", equipar, setweapon, false)
Recommended Posts