Best-Killer Posted December 12, 2015 Share Posted December 12, 2015 Client : addEventHandler('onClientGUIClick',root, function ( ) if ( source == aGuiBuy ) then if ( guiGridListGetSelectedItem ( aGuiList ) ~= -1 ) then local id,price = guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),1),guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),2) triggerServerEvent('onBuyWeapon',localPlayer,id,price) end end end ) server : addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price ) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( client ) >= tonumber ( price ) ) then giveWeapon (client,getWeaponIDFromName(id),30) takePlayerMoney ( client , tonumber ( price ) ) setPedStat (client,30,1000) end end end ) setPedStat not work 0 errors 0 warining Link to comment
1LoL1 Posted December 12, 2015 Share Posted December 12, 2015 wtf ninth topic on the one hand, it can not be serious? 2-3'd still understood but 9? You still want only help .. so what is a little learning? Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 wtf ninth topic on the one hand, it can not be serious? 2-3'd still understood but 9? You still want only help .. so what is a little learning? so how i can learn -.- ???? i did the script and there is problem -.- i said need help -.- Link to comment
1LoL1 Posted December 12, 2015 Share Posted December 12, 2015 wtf ninth topic on the one hand, it can not be serious? 2-3'd still understood but 9? You still want only help .. so what is a little learning? so how i can learn Normally, here have functions --> HERE Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 wtf ninth topic on the one hand, it can not be serious? 2-3'd still understood but 9? You still want only help .. so what is a little learning? so how i can learn Normally, here have functions --> i tried with that Client : addEventHandler('onClientGUIClick',root, function ( ) if ( source == aGuiBuy ) then if ( guiGridListGetSelectedItem ( aGuiList ) ~= -1 ) then local id,price = guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),1),guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),2) triggerServerEvent('onBuyWeapon',localPlayer,id,price) end end if u want help thanks if u won't thanks too end )[/lua] server : addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price ) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( client ) >= tonumber ( price ) ) then giveWeapon (client,getWeaponIDFromName(id),30) takePlayerMoney ( client , tonumber ( price ) ) setPedStat (client,30,1000) end end end ) setPedStat not work 0 errors 0 warining Link to comment
1LoL1 Posted December 12, 2015 Share Posted December 12, 2015 So learn more and more and more. Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 So learn more and more and more. Sure Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price ) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( client ) >= tonumber ( price ) ) then takePlayerMoney ( client , tonumber ( price ) ) setPedStat(thePlayer, 23, 999) end end end ) bad argument setpestat expected element at agument 1 got nill Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 You can try this : addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price ) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( source ) >= tonumber ( price ) ) then takePlayerMoney ( source , tonumber ( price ) ) setPedStat ( source, 23, 999 ) end end end ) Link to comment
S3Nn4oXx Posted December 12, 2015 Share Posted December 12, 2015 (edited) addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price, thePlayer) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( client ) >= tonumber ( price ) ) then takePlayerMoney ( client , tonumber ( price ) ) setPedStat(thePlayer, 23, 999) end end end ) Edited December 12, 2015 by Guest Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 You can try this : addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price ) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( source ) >= tonumber ( price ) ) then takePlayerMoney ( source , tonumber ( price ) ) setPedStat ( source, 23, 999 ) end end end ) not work 0 warinings 0 errors Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 You can try this : addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price ) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( source ) >= tonumber ( price ) ) then takePlayerMoney ( source , tonumber ( price ) ) setPedStat ( source, 23, 999 ) end end end ) not work 0 warinings 0 errors Can you please show me the client side . Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 [/lua]aGuiForm = nil _gui = nil _root = getRootElement() data={}; addEvent("openGView",true) function aViewGui ( player ) if ( aGuiForm == nil ) then local x, y = guiGetScreenSize() for i=0,9 do data = {}; end data[0].weapon="Sniper" data[1].weapon="Taser" data[2].weapon="Pistol" data[3].weapon="MP5" data[4].weapon="Deagle" data[5].weapon="Ak-47" data[6].weapon="M4" data[7].weapon="Uzi/TEC-9" data[8].weapon="Sawn-Off" data[9].weapon="ShotGun" data[0].price=6000 data[1].price=2500 data[2].price=3000 data[3].price=3500 data[4].price=4500 data[5].price=4500 data[6].price=5000 data[7].price=5000 data[8].price=5500 data[9].price=5500 aGuiForm = guiCreateWindow ( x / 2 - 250, y / 2 - 125, 620, 250, "Skill Shop", false ) aGuiList = guiCreateGridList ( 0.02, 0.09, 0.82, 0.86, true, aGuiForm ) guiGridListAddColumn( aGuiList, "Weapon", 0.50 ) guiGridListAddColumn( aGuiList, "Ammount", 0.80 ) aGuiBuy = guiCreateButton ( 0.86, 0.65, 0.12, 0.09, "Buy", true, aGuiForm ) aGuiClose = guiCreateButton ( 0.86, 0.85, 0.12, 0.09, "Close", true, aGuiForm ) addEventHandler ( "onClientGUIClick", aGuiForm, aClientGuiClick ) aMakeList() end guiSetVisible ( aGuiForm, true ) guiBringToFront ( aGuiForm ) showCursor(true) end addEventHandler ("openGView", _root, aViewGui) function aViewGuiClose ( destroy ) if ( ( destroy ) ) then if ( aGuiForm ) then removeEventHandler ( "onClientGUIClick", aGuiForm, aClientGuiClick ) destroyElement ( aGuiForm ) aGuiForm = nil end else guiSetVisible ( aGuiForm, false ) end end function aClientGuiClick ( button ) if ( button == "left" ) then if ( source == aGuiClose ) then aViewGuiClose ( false ) showCursor(false) elseif ( source == aGuiBuy ) then aViewGuiClose ( false ) showCursor(false) end end end function aMakeList () guiGridListClear(aGuiList) for i,v in pairs(data) do local row = guiGridListAddRow ( aGuiList ) guiGridListSetItemText ( aGuiList, row, 1 , tostring(data.weapon) , false, false ) guiGridListSetItemText ( aGuiList, row, 2 , tostring(data.price) , false, false ) end end addEventHandler('onClientGUIClick',root, function ( ) if ( source == aGuiBuy ) then if ( guiGridListGetSelectedItem ( aGuiList ) ~= -1 ) then local id,price = guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),1),guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),2) triggerServerEvent('onBuyWeapon',localPlayer,id,price) end end end )[/lua ] Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 aGuiForm = nil _gui = nil _root = getRootElement() data={}; addEvent("openGView",true) function aViewGui ( player ) if ( aGuiForm == nil ) then local x, y = guiGetScreenSize() for i=0,9 do data[i] = {}; end data[0].weapon="Sniper" data[1].weapon="Taser" data[2].weapon="Pistol" data[3].weapon="MP5" data[4].weapon="Deagle" data[5].weapon="Ak-47" data[6].weapon="M4" data[7].weapon="Uzi/TEC-9" data[8].weapon="Sawn-Off" data[9].weapon="ShotGun" data[0].price=6000 data[1].price=2500 data[2].price=3000 data[3].price=3500 data[4].price=4500 data[5].price=4500 data[6].price=5000 data[7].price=5000 data[8].price=5500 data[9].price=5500 aGuiForm = guiCreateWindow ( x / 2 - 250, y / 2 - 125, 620, 250, "Skill Shop", false ) aGuiList = guiCreateGridList ( 0.02, 0.09, 0.82, 0.86, true, aGuiForm ) guiGridListAddColumn( aGuiList, "Weapon", 0.50 ) guiGridListAddColumn( aGuiList, "Ammount", 0.80 ) aGuiBuy = guiCreateButton ( 0.86, 0.65, 0.12, 0.09, "Buy", true, aGuiForm ) aGuiClose = guiCreateButton ( 0.86, 0.85, 0.12, 0.09, "Close", true, aGuiForm ) addEventHandler ( "onClientGUIClick", aGuiForm, aClientGuiClick ) aMakeList() end guiSetVisible ( aGuiForm, true ) guiBringToFront ( aGuiForm ) showCursor(true) end addEventHandler ("openGView", _root, aViewGui) function aViewGuiClose ( destroy ) if ( ( destroy ) ) then if ( aGuiForm ) then removeEventHandler ( "onClientGUIClick", aGuiForm, aClientGuiClick ) destroyElement ( aGuiForm ) aGuiForm = nil end else guiSetVisible ( aGuiForm, false ) end end function aClientGuiClick ( button ) if ( button == "left" ) then if ( source == aGuiClose ) then aViewGuiClose ( false ) showCursor(false) elseif ( source == aGuiBuy ) then aViewGuiClose ( false ) showCursor(false) end end end function aMakeList () guiGridListClear(aGuiList) for i,v in pairs(data) do local row = guiGridListAddRow ( aGuiList ) guiGridListSetItemText ( aGuiList, row, 1 , tostring(data[i].weapon) , false, false ) guiGridListSetItemText ( aGuiList, row, 2 , tostring(data[i].price) , false, false ) end end addEventHandler('onClientGUIClick',root, function ( ) if ( source == aGuiBuy ) then if ( guiGridListGetSelectedItem ( aGuiList ) ~= -1 ) then local id,price = guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),1),guiGridListGetItemText(aGuiList,guiGridListGetSelectedItem(aGuiList),2) triggerServerEvent('onBuyWeapon',localPlayer,id,price) end end end ) Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 Seams to be ok so there's no errors and nothing in the debugscript3? are you sure you used my code up there check it again please. Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 ye i used ur code i checked it again Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 addEvent('onBuyWeapon',true) addEventHandler('onBuyWeapon',root, function ( id , price ) if ( tonumber ( price ) and getWeaponIDFromName ( id ) ) then if ( getPlayerMoney ( source ) >= tonumber ( price ) ) then takePlayerMoney ( source , tonumber ( price ) ) setPedStat ( source, 23, 999 ) outputChatBox ( 'OK!',source,255,0,0,true ) end end end ) See if it show's the code is ok or not . Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 showing the code ok Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 so i am guessing the script is ok and fine try to add another function or change the PedStat ID . Link to comment
Best-Killer Posted December 12, 2015 Author Share Posted December 12, 2015 so i am guessing the script is ok and fine try to add another function or change the PedStat ID . ok thanks 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