zen13 Posted July 23, 2013 Share Posted July 23, 2013 i need Sample exp = 100 can use m4 exp = 200 can use sniper function expChange(expr,gained) ttlgnd = ttlgnd+gained guiSetText(expLabel,"") local level,levelnum = "#0 - Newbie",0 if expr >= 10 then level = "#1 - Novice" levelnum = 1 end if expr >= 20 then level = "#2 - Average" levelnum = 2 end if expr >= 100 then level = "#3 - Good" levelnum = 3 end if expr >= 200 then level = "#4 - Killer" levelnum = 4 end if expr >= 500 then level = "#5 - Skilled" levelnum = 5 end if expr >= 1000 then level = "#6 - Elite" levelnum = 6 end if expr >= 2000 then level = "#7 - Senior" levelnum = 7 end if expr >= 3000 then level = "#8 - Amazing" levelnum = 8 end if expr >= 5000 then level = "#9 - Pro" levelnum = 9 end if expr >= 10000 then level = "#10 - Godlike" levelnum = 10 end if expr >= 20000 then level = "#11 - God" levelnum = 11 end guiSetText(expLabel,"EXP gained: "..ttlgnd.." (+"..gained..")\nTotal EXP: "..expr.."\nLevel: "..level) setElementData(getLocalPlayer(),"Level",level) setElementData(getLocalPlayer(),"levelnum",levelnum) end addEvent( "expOnChange", true ) addEventHandler( "expOnChange", getRootElement(), expChange ) addEventHandler("onClientResourceStart", getRootElement(), clientsetupstarter Link to comment
Martyz Posted July 23, 2013 Share Posted July 23, 2013 add this to client script file: function onClFire() if(getElementModel(source) == 31) then -- M4 if(getElementData(getLocalPlayer(),"levelnum" < 3)) then cancelEvent() outputChatBox('You cant use M4') end -- if level is lower than 3 (100exp), cancel shooting and send message elseif(getElementModel(source) == 34) then -- Sniper if(getElementData(getLocalPlayer(),"levelnum" < 4)) then cancelEvent() outputChatBox('You cant use Sniper') end -- if level is lower than 4 (200exp), cancel shooting and send message end end addEventHandler('onClientWeaponFire', getRootElement, onClFire) Link to comment
Jaysds1 Posted July 23, 2013 Share Posted July 23, 2013 try this: addEventHandler('onClientWeaponFire', root, function() local levelnum = getElementData(getLocalPlayer(),"levelnum") if(getElementModel(source) == 31) then -- M4 if(levelnum < 3) then cancelEvent() outputChatBox('You cant use M4') end -- if level is lower than 3 (100exp), cancel shooting and send message elseif(getElementModel(source) == 34) then -- Sniper if(levelnum < 4) then cancelEvent() outputChatBox('You cant use Sniper') end -- if level is lower than 4 (200exp), cancel shooting and send message end end) Link to comment
TAPL Posted July 23, 2013 Share Posted July 23, 2013 Did anyone realized that the event onClientWeaponFire is only for custom weapons? whatever. Link to comment
Josmis Posted July 23, 2013 Share Posted July 23, 2013 onClientPlayerWeaponSwitch cancelEvent() Maybe... Link to comment
zen13 Posted July 24, 2013 Author Share Posted July 24, 2013 i'am not work i can use weapon all Level or Level 4 can use skin 187 Link to comment
Martyz Posted July 26, 2013 Share Posted July 26, 2013 Did anyone realized that the event onClientWeaponFire is only for custom weapons?whatever. What do you mean? Link to comment
TAPL Posted July 26, 2013 Share Posted July 26, 2013 Did anyone realized that the event onClientWeaponFire is only for custom weapons?whatever. What do you mean? Custom weapons is the weapon that was created with the function createWeapon. Link to comment
Castillo Posted July 26, 2013 Share Posted July 26, 2013 addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer, function ( old, current ) local weapon = getPedWeapon ( localPlayer, current ) local level = getElementData ( localPlayer, "levelnum" ) if ( weapon == 31 ) then if ( level < 3 ) then setPedWeaponSlot ( localPlayer, old ) end elseif ( weapon == 34 ) then if ( level < 4 ) then setPedWeaponSlot ( localPlayer, old ) end end end ) Try it. Link to comment
zen13 Posted July 27, 2013 Author Share Posted July 27, 2013 addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer, function ( old, current ) local weapon = getPedWeapon ( localPlayer, current ) local level = getElementData ( localPlayer, "levelnum" ) if ( weapon == 31 ) then if ( level < 3 ) then setPedWeaponSlot ( localPlayer, old ) end elseif ( weapon == 34 ) then if ( level < 4 ) then setPedWeaponSlot ( localPlayer, old ) end end end ) Try it. thk i't work how to set weapon = skin ? Link to comment
iMr.3a[Z]eF Posted July 27, 2013 Share Posted July 27, 2013 giveWeapon setPedSkin or setPlayerSkin Link to comment
zen13 Posted July 27, 2013 Author Share Posted July 27, 2013 giveWeapon setPedSkin or setPlayerSkin i not understan Link to comment
iMr.3a[Z]eF Posted July 27, 2013 Share Posted July 27, 2013 giveWeapon -- to give a weapon setPedSkin or setPlayerSkin -- to set the ped or the player skin by ID Link to comment
zen13 Posted July 27, 2013 Author Share Posted July 27, 2013 giveWeapon -- to give a weapon setPedSkin or setPlayerSkin -- to set the ped or the player skin by ID addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer, function ( old, current ) local weapon = getPedWeapon ( localPlayer, current ) local level = getElementData ( localPlayer, "levelnum" ) if ( setPedSkin == 2 ) then if ( level < 3 ) then setPedWeaponSlot ( localPlayer, old ) end elseif ( setPedSkin == 187 ) then if ( level < 4 ) then setPedWeaponSlot ( localPlayer, old ) end end end ) ? Link to comment
Castillo Posted July 27, 2013 Share Posted July 27, 2013 That doesn't make any sense. What are you trying to do? Link to comment
zen13 Posted July 27, 2013 Author Share Posted July 27, 2013 i want lv 4 can buy skin = 2 lv5 can buy skin =3 Link to comment
Castillo Posted July 27, 2013 Share Posted July 27, 2013 You must edit your skin shop then. Link to comment
zen13 Posted July 27, 2013 Author Share Posted July 27, 2013 (edited) You must edit your skin shop then. server file addEvent( "th1", true ) function setth1 () setPedSkin ( source, 46 ) outputChatBox ( "skin 46", source, 255, 0, 0 ) end addEventHandler ( "th1", getRootElement(), setth1 ) how to fix ? Edited July 27, 2013 by Guest Link to comment
iMr.3a[Z]eF Posted July 27, 2013 Share Posted July 27, 2013 Use LUA syntax box please. Link to comment
zen13 Posted July 27, 2013 Author Share Posted July 27, 2013 Server ---------------------------------------- -------------- addEvent( "gg", true ) function setgg () if getPlayerMoney(source) < 0 then outputChatBox("เงินไม่พอ!", source, 255,0,0) else setPedSkin ( source, 2 ) takePlayerMoney(source, 0) playeraccount = getPlayerAccount(source) setAccountData(playeraccount, "standardskin", id) outputChatBox("เปลี่ยนสกินสำเสร็จ", source, 0,255,0) end end addEventHandler ( "gg", getRootElement(), setgg ) ---- addEvent( "th1", true ) function setth1 () setPedSkin ( source, 46 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "th1", getRootElement(), setth1 ) ---- a addEvent( "th2", true ) function setth2 () setPedSkin ( source, 124 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "th2", getRootElement(), setth2 ) --------------------------------------------- addEvent( "s1", true ) function sets1 () setPedSkin ( source, 9 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "s1", getRootElement(), sets1 ) --------------------------------------------- addEvent( "s2", true ) function sets2 () setPedSkin ( source, 285 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "s2", getRootElement(), sets2 ) --------------------------------------------- addEvent( "sp", true ) function setsp () setPedSkin ( source, 66 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "sp", getRootElement(), setsp ) --------------------------------------------- addEvent( "b", true ) function setb () setPedSkin ( source, 132 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "b", getRootElement(), setb ) --------------------------------------------- addEvent( "s", true ) function sets () setPedSkin ( source, 267 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "s", getRootElement(), sets ) --------------------------------------------- addEvent( "l", true ) function setl () setPedSkin ( source, 268 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "l", getRootElement(), setl ) --------------------------------------------- addEvent( "i", true ) function seti () setPedSkin ( source, 291 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "i", getRootElement(), seti ) --------------------------------------------- addEvent( "cj", true ) function setcj () setPedSkin ( source, 266 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "cj", getRootElement(), setcj ) --------------------------------------------- addEvent( "r", true ) function setr () setPedSkin ( source, 265 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "r", getRootElement(), setr ) --------------------------------------------- addEvent( "h", true ) function seth () setPedSkin ( source, 123 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "h", getRootElement(), seth ) --------------------------------------------- addEvent( "y", true ) function sety () setPedSkin ( source, 177 ) outputChatBox ( "เปลียนสกินสำเสร็จ", source, 255, 0, 0 ) end addEventHandler ( "y", getRootElement(), sety ) --------------------------------------------- client GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} outputChatBox("#ffff00======เปลี่ยนสกินกดF6======",0,255,0,true) GUIEditor_Window[1] = guiCreateWindow(88,66,700,400,"Skin",false) guiSetAlpha(GUIEditor_Window[1],1) gg = guiCreateStaticImage(19,23,154,96,"gg.png",false,GUIEditor_Window[1]) gg = guiCreateButton(18,122,156,76,"free",false,GUIEditor_Window[1]) guiSetProperty(gg,"NormalTextColour", "FF00FF00") th1 = guiCreateStaticImage(197,28,162,89,"th1.png",false,GUIEditor_Window[1]) th1 = guiCreateButton(199,123,158,74,"free",false,GUIEditor_Window[1]) guiSetProperty(th1,"NormalTextColour", "FF00FF00") th2 = guiCreateStaticImage(373,30,151,88,"th2.png",false,GUIEditor_Window[1]) th2 = guiCreateButton(373,126,151,73,"free",false,GUIEditor_Window[1]) guiSetProperty(th2,"NormalTextColour", "FF00FF00") s2 = guiCreateStaticImage(548,35,165,84,"s2.png",false,GUIEditor_Window[1]) s2 = guiCreateButton(546,129,164,70,"free",false,GUIEditor_Window[1]) guiSetProperty(s2,"NormalTextColour", "FF00FF00") b = guiCreateStaticImage(199,220,163,92,"b.png",false,GUIEditor_Window[1]) s = guiCreateStaticImage(385,221,150,91,"s.png",false,GUIEditor_Window[1]) s = guiCreateButton(385,320,151,72,"free",false,GUIEditor_Window[1]) guiSetProperty(s,"NormalTextColour", "FF00FF00") l = guiCreateStaticImage(555,224,158,90,"l.png",false,GUIEditor_Window[1]) l = guiCreateButton(555,323,157,70,"free ",false,GUIEditor_Window[1]) guiSetProperty(l,"NormalTextColour", "FF00FF00") sp = guiCreateStaticImage(18,216,171,95,"sp.png",false,GUIEditor_Window[1]) sp = guiCreateButton(20,319,173,72,"free",false,GUIEditor_Window[1]) guiSetProperty(sp,"NormalTextColour", "FF00FF00") b = guiCreateButton(205,320,161,72,"free",false,GUIEditor_Window[1]) guiSetProperty(b,"NormalTextColour", "FF00FF00") GUIEditor_Label[1] = guiCreateLabel(24,623,225,41,"free",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) GUIEditor_Label[2] = guiCreateLabel(315,624,354,34,"your skin:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,255,0) guiSetText ( GUIEditor_Label[2], getPedSkin(localPlayer)) function refreshStats() if guiGetVisible(GUIEditor_Window[1],true) then else guiSetText(GUIEditor_Label[2],"your skin :"..getPedSkin(getLocalPlayer())) end end addEventHandler("onClientRender", getRootElement(), refreshStats) guiSetVisible (GUIEditor_Window[1], false) function OpenWin() if guiGetVisible ( GUIEditor_Window[1] ) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) guiSetInputEnabled(false) else guiSetVisible ( GUIEditor_Window[1], true ) showCursor(true) guiSetInputEnabled(true) playSound("1.wav") end end bindKey("F6", "down", OpenWin) function onGuiClick (button, state, absoluteX, absoluteY) if (source == gg) then triggerServerEvent ("gg", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) --------------------------------------------- function onGuiClick (button, state, absoluteX, absoluteY) if (source == th1) then triggerServerEvent ("th1", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) --------------------------------------------- function onGuiClick (button, state, absoluteX, absoluteY) if (source == th2) then triggerServerEvent ("th2", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == s1) then triggerServerEvent ("s1", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == s2) then triggerServerEvent ("s2", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == sp) then triggerServerEvent ("sp", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == b) then triggerServerEvent ("b", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == s) then triggerServerEvent ("s", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == l) then triggerServerEvent ("l", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == i) then triggerServerEvent ("i", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == cj) then triggerServerEvent ("cj", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == r) then triggerServerEvent ("r", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == h) then triggerServerEvent ("h", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == y) then triggerServerEvent ("y", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) -------------------------------------------- txd = engineLoadTXD("2.txd") engineImportTXD(txd, 2) dff = engineLoadDFF("2.dff", 2) engineReplaceModel(dff, 2) -- ------------------------------------------- txd = engineLoadTXD("46.txd") engineImportTXD(txd, 46) dff = engineLoadDFF("46.dff", 46) engineReplaceModel(dff, 46) -------------------------------------------- txd = engineLoadTXD("124.txd") engineImportTXD(txd, 124) dff = engineLoadDFF("124.dff", 124) engineReplaceModel(dff, 124) ------------------------------------- txd = engineLoadTXD("9.txd") engineImportTXD(txd, 9) dff = engineLoadDFF("9.dff", 9) engineReplaceModel(dff, 9) ------------------------------------- txd = engineLoadTXD("285.txd") engineImportTXD(txd, 285) dff = engineLoadDFF("285.dff", 285) engineReplaceModel(dff, 285) ------------------------------------- Link to comment
iMr.3a[Z]eF Posted July 27, 2013 Share Posted July 27, 2013 If you use lua instead code, that we read it carefully. 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