Deep thinker Posted October 31, 2016 Share Posted October 31, 2016 i have scripting a illegal weapon factory marker but i want to show a loading progress while creating a weapon ,i have scripted it and i have checked the debugscript log and there isn't something wrong ,also i wanna hide the hud and the radar --client cwm = createMarker( 1983.65601, -2413.86963, 12.54688, "cylinder", 2, 150, 0, 75, 255 ) --this creates the marker GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.2726,0.3275,0.3186,0.4537,"(Weapon Factory)",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Memo[1] = guiCreateMemo(151,51,199,46,"On button click you will w\nait for 20 second to create M4",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(151,99,202,46,"On button click you will wait for 20 second to create AK-47",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Button[1] = guiCreateButton(16,59,130,41,"100M4 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(15,105,130,41,"100AK-47 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(17,152,130,41,"18 Gernades for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[3] = guiCreateMemo(150,148,202,46,"On button click you will wait for 20 second to create Gernade",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Memo[4] = guiCreateMemo(150,195,202,46,"On button click you will wait for 20 second to create Rifle",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[4],true) GUIEditor_Button[4] = guiCreateButton(17,197,130,41,"75 Rifle for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[5] = guiCreateMemo(150,243,202,46,"On button click you will wait for 20 second to create Sniper",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[5],true) GUIEditor_Button[5] = guiCreateButton(18,246,130,41,"75 Sniper for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[6] = guiCreateMemo(151,290,202,46,"On button click you will wait for 20 second to create UZI",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[6],true) GUIEditor_Button[6] = guiCreateButton(20,293,130,41,"200 UZI for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[7] = guiCreateMemo(150,337,202,46,"On button click you will wait for 20 second to create C.shotgun",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(18,340,130,41,"200 C.shotgun for 150$",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(24,30,324,20,"Regards,(T-RPG)ProMax",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],150,0,150) GUIEditor_Button[11] = guiCreateButton(298,20,55,26,"Close",false,GUIEditor_Window[1]) --creates the GUI function ToggleCWMMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == "onClientMarkerHit" then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) showChat ( false ) showHud ( false ) showRadar ( false ) elseif eventName == "onClientMarkerLeave" then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showHud ( true ) showRadar ( true ) -- shows the chat and i don't know what about the hud end end end addEventHandler("onClientMarkerHit",cwm,ToggleCWMMenu) addEventHandler("onClientMarkerLeave",cwm,ToggleCWMMenu) addEventHandler ('onClientGUIClick',GUIEditor_Button[11], -- that was the closing button function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showRadar ( true ) showHud ( true ) end,false ) --rest of buttons addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function () guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) triggerServerEvent ("GiveM4",localPlayer) end,false ) --then the second part function drawStaticBar() dxDrawRectangle((sx/2)-270, (sy/2)-22, 540.0, 44.0, tocolor(255,197,0,150), false) dxDrawRectangle((sx/2)-265, (sy/2)-16, 530.0, 33.0, tocolor(0,0,0,250), false) end function drawLoadingBar() if (tonumber(createPercent) >= 100) then removeEventHandler("onClientRender", root, drawStaticBar) removeEventHandler("onClientRender", root, drawLoadingBar) showCursor(false) guiSetInputEnabled(false) else dxDrawRectangle((sx/2)-261, (sy/2)-12, tonumber(createPercent)*5.22, 25.0, tocolor(0,0,235,255), true) end dxDrawBorderedText("Creating... "..tostring(createPercent).."%", (sx/2)-145, (sy/2)-15, (sy/2)-1, (sx/2)-5, tocolor(0,255,0,255),1.0,"bankgothic","left","top",false,false,true) end addEvent("creating",true) addEventHandler("creating",root, function (weaponName) name = tostring(weaponName) if isTimer(createTimer) then killTimer(createTimer) end trainPercent = 0 showCursor(true) guiSetInputEnabled(true) trainTimer = setTimer(function () createPercent = createPercent +1 end, 100, 100) addEventHandler("onClientRender",getRootElement(),drawLoadingBar) addEventHandler("onClientRender",getRootElement(),drawStaticBar) end) --Server -- starting with the Event that i tiggered in the Client side addEvent ('GiveM4',true) addEventHandler ('GiveM4',root, -- then i don;t know what to do:3 function () if not getPlayerTeam(source) or getPlayerTeam(source) ~= getTeamFromName("Criminal") then return outputChatBox( 'You are not a criminal to create weapons',source,255,0,0 ) end if getPlayerMoney(source) or getPlayerMoney(source) >= 150 then triggerClientEvent(player,"creating",player,weaponName) setTimer( function () giveWeapon(client,31,100) end,false ,1000,1,client ) takePlayerMoney(client,150) else outputChatBox('You do not have enough money to create this weapon', 255, 0, 0 ) end end ) please answer as soon as possible ,I am on fire :3. Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 (edited) showPlayerHudComponent( string component, bool show) Edited October 31, 2016 by Dimos7 1 Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 Just now, Dimos7 said: ShowPlayerHudComponent( string component, bool show) well thanks ,but i want the progress bar in the first place :3 Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 you mean not moving the progress bar? Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 well ,when i press the button the ( setTimer should work but it isn't ,i want to make it work while the progress bar is counting ,get it ? Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 (edited) So you want when proress bar is counting not has weapon hud and radar? you know exist gui progress bar? Edited October 31, 2016 by Dimos7 1 Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 i will explain deeper than this.when i press the button the progress bar start counting when it's done of counting i want it to give the player his weapon.(HUD and RADAR when he hits the marker and leave it only ) Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 --client cwm = createMarker( 1983.65601, -2413.86963, 12.54688, "cylinder", 2, 150, 0, 75, 255 ) --this creates the marker GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.2726,0.3275,0.3186,0.4537,"(Weapon Factory)",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Memo[1] = guiCreateMemo(151,51,199,46,"On button click you will w\nait for 20 second to create M4",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(151,99,202,46,"On button click you will wait for 20 second to create AK-47",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Button[1] = guiCreateButton(16,59,130,41,"100M4 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(15,105,130,41,"100AK-47 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(17,152,130,41,"18 Gernades for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[3] = guiCreateMemo(150,148,202,46,"On button click you will wait for 20 second to create Gernade",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Memo[4] = guiCreateMemo(150,195,202,46,"On button click you will wait for 20 second to create Rifle",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[4],true) GUIEditor_Button[4] = guiCreateButton(17,197,130,41,"75 Rifle for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[5] = guiCreateMemo(150,243,202,46,"On button click you will wait for 20 second to create Sniper",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[5],true) GUIEditor_Button[5] = guiCreateButton(18,246,130,41,"75 Sniper for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[6] = guiCreateMemo(151,290,202,46,"On button click you will wait for 20 second to create UZI",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[6],true) GUIEditor_Button[6] = guiCreateButton(20,293,130,41,"200 UZI for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[7] = guiCreateMemo(150,337,202,46,"On button click you will wait for 20 second to create C.shotgun",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(18,340,130,41,"200 C.shotgun for 150$",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(24,30,324,20,"Regards,(T-RPG)ProMax",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],150,0,150) GUIEditor_Button[11] = guiCreateButton(298,20,55,26,"Close",false,GUIEditor_Window[1]) --creates the GUI function ToggleCWMMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == "onClientMarkerHit" then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) showChat ( false ) showPlayerHudComponent("weapon", false) showPlayerHudComponent("radar", false) elseif eventName == "onClientMarkerLeave" then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showPlayerHudComponent("weapon", true) showPlayerHudComponent("radar", true) -- shows the chat and i don't know what about the hud end end end addEventHandler("onClientMarkerHit",cwm,ToggleCWMMenu) addEventHandler("onClientMarkerLeave",cwm,ToggleCWMMenu) addEventHandler ('onClientGUIClick',GUIEditor_Button[11], -- that was the closing button function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showPlayerHudComponent("weapon", true) showPlayerHudComponent("radar", true) end,false ) --rest of buttons addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function () guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) triggerServerEvent ("GiveM4",localPlayer) end,false ) --then the second part function drawStaticBar() dxDrawRectangle((sx/2)-270, (sy/2)-22, 540.0, 44.0, tocolor(255,197,0,150), false) dxDrawRectangle((sx/2)-265, (sy/2)-16, 530.0, 33.0, tocolor(0,0,0,250), false) end function drawLoadingBar() if (tonumber(createPercent) >= 100) then removeEventHandler("onClientRender", root, drawStaticBar) removeEventHandler("onClientRender", root, drawLoadingBar) showCursor(false) guiSetInputEnabled(false) else dxDrawRectangle((sx/2)-261, (sy/2)-12, tonumber(createPercent)*5.22, 25.0, tocolor(0,0,235,255), true) end dxDrawBorderedText("Creating... "..tostring(createPercent).."%", (sx/2)-145, (sy/2)-15, (sy/2)-1, (sx/2)-5, tocolor(0,255,0,255),1.0,"bankgothic","left","top",false,false,true) end addEvent("creating",true) addEventHandler("creating",root, function (weaponName) name = tostring(weaponName) if isTimer(createTimer) then killTimer(createTimer) end trainPercent = 0 showCursor(true) guiSetInputEnabled(true) trainTimer = setTimer(function () createPercent = createPercent +1 end, 100, 100) addEventHandler("onClientRender",getRootElement(),drawLoadingBar) addEventHandler("onClientRender",getRootElement(),drawStaticBar) end) 1 Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 actually the part of the hiding has worked instead of the progress bar if you have even edited it ? Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 i din't edit the think about progress bar 1 Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 you know how to fix it out ? Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 you mean when its still progress not apear the hud and radar i think so Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 this isn't about the hud and radar ,it's about the Button and the Progress bar. Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 (edited) --client cwm = createMarker( 1983.65601, -2413.86963, 12.54688, "cylinder", 2, 150, 0, 75, 255 ) --this creates the marker GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.2726,0.3275,0.3186,0.4537,"(Weapon Factory)",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Memo[1] = guiCreateMemo(151,51,199,46,"On button click you will w\nait for 20 second to create M4",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(151,99,202,46,"On button click you will wait for 20 second to create AK-47",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Button[1] = guiCreateButton(16,59,130,41,"100M4 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(15,105,130,41,"100AK-47 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(17,152,130,41,"18 Gernades for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[3] = guiCreateMemo(150,148,202,46,"On button click you will wait for 20 second to create Gernade",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Memo[4] = guiCreateMemo(150,195,202,46,"On button click you will wait for 20 second to create Rifle",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[4],true) GUIEditor_Button[4] = guiCreateButton(17,197,130,41,"75 Rifle for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[5] = guiCreateMemo(150,243,202,46,"On button click you will wait for 20 second to create Sniper",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[5],true) GUIEditor_Button[5] = guiCreateButton(18,246,130,41,"75 Sniper for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[6] = guiCreateMemo(151,290,202,46,"On button click you will wait for 20 second to create UZI",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[6],true) GUIEditor_Button[6] = guiCreateButton(20,293,130,41,"200 UZI for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[7] = guiCreateMemo(150,337,202,46,"On button click you will wait for 20 second to create C.shotgun",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(18,340,130,41,"200 C.shotgun for 150$",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(24,30,324,20,"Regards,(T-RPG)ProMax",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],150,0,150) GUIEditor_Button[11] = guiCreateButton(298,20,55,26,"Close",false,GUIEditor_Window[1]) --creates the GUI function ToggleCWMMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == "onClientMarkerHit" then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) showChat ( false ) showPlayerHudComponent("weapon", false) showPlayerHudComponent("radar", false) elseif eventName == "onClientMarkerLeave" then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showPlayerHudComponent("weapon", true) showPlayerHudComponent("radar", true) -- shows the chat and i don't know what about the hud end end end addEventHandler("onClientMarkerHit",cwm,ToggleCWMMenu) addEventHandler("onClientMarkerLeave",cwm,ToggleCWMMenu) addEventHandler ('onClientGUIClick',GUIEditor_Button[11], -- that was the closing button function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showPlayerHudComponent("weapon", true) showPlayerHudComponent("radar", true) end,false ) --rest of buttons addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function () guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) triggerServerEvent ("GiveM4",localPlayer) end,false ) --then the second part function drawStaticBar() dxDrawRectangle((sx/2)-270, (sy/2)-22, 540.0, 44.0, tocolor(255,197,0,150), false) dxDrawRectangle((sx/2)-265, (sy/2)-16, 530.0, 33.0, tocolor(0,0,0,250), false) end function drawLoadingBar() if (tonumber(createPercent) >= 100) then removeEventHandler("onClientRender", root, drawStaticBar) removeEventHandler("onClientRender", root, drawLoadingBar) showCursor(false) guiSetInputEnabled(false) else dxDrawRectangle((sx/2)-261, (sy/2)-12, tonumber(createPercent)*5.22, 25.0, tocolor(0,0,235,255), true) end dxDrawBorderedText("Creating... "..tostring(createPercent).."%", (sx/2)-145, (sy/2)-15, (sy/2)-1, (sx/2)-5, tocolor(0,255,0,255),1.0,"bankgothic","left","top",false,false,true) end addEvent("creating",true) addEventHandler("creating",root, function (weaponName) name = tostring(weaponName) if isTimer(createTimer) then killTimer(createTimer) end trainPercent = 0 showCursor(true) guiSetInputEnabled(true) trainTimer = setTimer(function () createPercent = createPercent +1 end, 100, 100) addEventHandler("onClientRender",getRootElement(),drawLoadingBar) addEventHandler("onClientRender",getRootElement(),drawStaticBar) if tonumber(createPercent) == 100 then showPlayerHudComponent("weapon", true) else showPlayerHudComponent("weapon", false) showPlayerHudComponent("radar", false) end end) Edited October 31, 2016 by Dimos7 Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 the progress bar didn't get shown also i didn't get the weapon .it takes the money only . Link to comment
Dimos7 Posted October 31, 2016 Share Posted October 31, 2016 why you have put only give m4 and not all the weapons you try to make? Link to comment
Abdul KariM Posted October 31, 2016 Share Posted October 31, 2016 (edited) reset server side to this addEvent ('GiveM4',true) addEventHandler ('GiveM4',root, function ( ) if not getPlayerTeam( source ) or getPlayerTeam ( source ) ~= getTeamFromName("Criminal") then return outputChatBox( 'You are not a criminal to create weapons',source,255,0,0 ) end if getPlayerMoney ( source ) >= 150 then setTimer ( giveWeapon , 1000 , 1 , source , 31 , 100 , true ) triggerClientEvent( source ,"creating", source , getWeaponNameFromID ( 31 ) ) takePlayerMoney( source ,150 ) else outputChatBox('You do not have enough money to create this weapon', source , 255, 0, 0 ) end end ) Edited October 31, 2016 by Abdul KariM Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 when i learn to make M4 then i will know how to make the rest ":3 Just now, Abdul KariM said: reset server side to this addEvent ('GiveM4',true) addEventHandler ('GiveM4',root, function ( ) if not getPlayerTeam( source ) or getPlayerTeam ( source ) ~= getTeamFromName("Criminal") then return outputChatBox( 'You are not a criminal to create weapons',source,255,0,0 ) end if getPlayerMoney ( source ) >= 150 then setTimer ( giveWeapon , 1000 , 1 , source 31 , 100 , true ) triggerClientEvent( source ,"creating", source , getWeaponNameFromID ( 31 ) ) takePlayerMoney( source ,150 ) else outputChatBox('You do not have enough money to create this weapon', 255, 0, 0 ) end end ) this part has a lot of bugs in debugscript log not working Link to comment
Abdul KariM Posted October 31, 2016 Share Posted October 31, 2016 Oh really ? show me a bugs 1 Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 |1| ')' expected near '31' |2| '<eof>' expected near 'else' |3| '<eof>' expected near 'end' |4| '<eof>' expected near 'end' |5| unexpected symbol near ')' Here you are :3 Link to comment
Abdul KariM Posted October 31, 2016 Share Posted October 31, 2016 Copy a my code again Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 it's perfect after editing expect 1 thing i can't see the progress bar :# Link to comment
Abdul KariM Posted October 31, 2016 Share Posted October 31, 2016 (edited) reset this code to your code addEvent("creating",true) addEventHandler("creating",root, function (weaponName) name = tostring(weaponName) if isTimer(trainTimer) then killTimer(trainTimer) end createPercent = 0 showCursor(true) guiSetInputEnabled(true) trainTimer = setTimer(function () createPercent = createPercent +1 end, 100, 0) addEventHandler("onClientRender",getRootElement(),drawLoadingBar) addEventHandler("onClientRender",getRootElement(),drawStaticBar) if tonumber(createPercent) >= 100 then showPlayerHudComponent("weapon", true) else showPlayerHudComponent("weapon", false) showPlayerHudComponent("radar", false) end end) Edited October 31, 2016 by Abdul KariM Link to comment
Deep thinker Posted October 31, 2016 Author Share Posted October 31, 2016 what about this, i think the bug is over here function drawStaticBar() dxDrawRectangle((sx/2)-270, (sy/2)-22, 540.0, 44.0, tocolor(255,197,0,150), false) dxDrawRectangle((sx/2)-265, (sy/2)-16, 530.0, 33.0, tocolor(0,0,0,250), false) end function drawLoadingBar() if (tonumber(createPercent) >= 100) then removeEventHandler("onClientRender", root, drawStaticBar) removeEventHandler("onClientRender", root, drawLoadingBar) showCursor(false) guiSetInputEnabled(false) else dxDrawRectangle((sx/2)-261, (sy/2)-12, tonumber(createPercent)*5.22, 25.0, tocolor(0,0,235,255), true) end dxDrawBorderedText("Creating... "..tostring(createPercent).."%", (sx/2)-145, (sy/2)-15, (sy/2)-1, (sx/2)-5, tocolor(0,255,0,255),1.0,"bankgothic","left","top",false,false,true) end Link to comment
Abdul KariM Posted October 31, 2016 Share Posted October 31, 2016 Client : --client cwm = createMarker( 1983.65601, -2413.86963, 12.54688, "cylinder", 2, 150, 0, 75, 255 ) --this creates the marker GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.2726,0.3275,0.3186,0.4537,"(Weapon Factory)",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Memo[1] = guiCreateMemo(151,51,199,46,"On button click you will w\nait for 20 second to create M4",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(151,99,202,46,"On button click you will wait for 20 second to create AK-47",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Button[1] = guiCreateButton(16,59,130,41,"100M4 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(15,105,130,41,"100AK-47 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(17,152,130,41,"18 Gernades for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[3] = guiCreateMemo(150,148,202,46,"On button click you will wait for 20 second to create Gernade",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Memo[4] = guiCreateMemo(150,195,202,46,"On button click you will wait for 20 second to create Rifle",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[4],true) GUIEditor_Button[4] = guiCreateButton(17,197,130,41,"75 Rifle for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[5] = guiCreateMemo(150,243,202,46,"On button click you will wait for 20 second to create Sniper",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[5],true) GUIEditor_Button[5] = guiCreateButton(18,246,130,41,"75 Sniper for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[6] = guiCreateMemo(151,290,202,46,"On button click you will wait for 20 second to create UZI",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[6],true) GUIEditor_Button[6] = guiCreateButton(20,293,130,41,"200 UZI for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[7] = guiCreateMemo(150,337,202,46,"On button click you will wait for 20 second to create C.shotgun",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(18,340,130,41,"200 C.shotgun for 150$",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(24,30,324,20,"Regards,(T-RPG)ProMax",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],150,0,150) GUIEditor_Button[11] = guiCreateButton(298,20,55,26,"Close",false,GUIEditor_Window[1]) --creates the GUI function ToggleCWMMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == "onClientMarkerHit" then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) showChat ( false ) showPlayerHudComponent("weapon", false) showPlayerHudComponent("radar", false) elseif eventName == "onClientMarkerLeave" then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showPlayerHudComponent("weapon", true) showPlayerHudComponent("radar", true) -- shows the chat and i don't know what about the hud end end end addEventHandler("onClientMarkerHit",cwm,ToggleCWMMenu) addEventHandler("onClientMarkerLeave",cwm,ToggleCWMMenu) addEventHandler ('onClientGUIClick',GUIEditor_Button[11], -- that was the closing button function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showPlayerHudComponent("weapon", true) showPlayerHudComponent("radar", true) end,false ) --rest of buttons addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function () guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) triggerServerEvent ("GiveM4",localPlayer) end,false ) local sx , sy = guiGetScreenSize ( ) --then the second part function drawStaticBar() dxDrawRectangle((sx/2)-270, (sy/2)-22, 540.0, 44.0, tocolor(255,197,0,150), false) dxDrawRectangle((sx/2)-265, (sy/2)-16, 530.0, 33.0, tocolor(0,0,0,250), false) end function drawLoadingBar() if (tonumber(createPercent) >= 100) then removeEventHandler("onClientRender", root, drawStaticBar) removeEventHandler("onClientRender", root, drawLoadingBar) showCursor(false) guiSetInputEnabled(false) else dxDrawRectangle((sx/2)-261, (sy/2)-12, tonumber(createPercent)*5.22, 25.0, tocolor(0,0,235,255), true) end dxDrawBorderedText("Creating... "..tostring(createPercent).."%", (sx/2)-145, (sy/2)-15, (sy/2)-1, (sx/2)-5, tocolor(0,255,0,255),1.0,"bankgothic","left","top",false,false,true) end addEvent("creating",true) addEventHandler("creating",root, function (weaponName) name = tostring(weaponName) if isTimer(trainTimer) then killTimer(trainTimer) end createPercent = 0 showCursor(true) guiSetInputEnabled(true) trainTimer = setTimer(function () createPercent = createPercent +1 end, 100, 0) addEventHandler("onClientRender",getRootElement(),drawLoadingBar) addEventHandler("onClientRender",getRootElement(),drawStaticBar) if tonumber(createPercent) >= 100 then showPlayerHudComponent("weapon", true) else showPlayerHudComponent("weapon", false) showPlayerHudComponent("radar", false) end end) 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