1LoL1 Posted September 12, 2015 Share Posted September 12, 2015 Hello i created script when i use /base and i warped to x,y,z but i created guiCreateLabel and timer in guiCreateLabel but not work i don't know why. Can anyone help me please? and what do I do so that man could not move when the port? function mybase(source) local number = 5 setTimer(function() number = number-1 local myLabel = guiCreateLabel(0,0,1,1,"",false,mybase) guiSetText(myLabel, "For "..number.." seconds") if number < 1 then setElementPosition(source, x,y,z) end end, 5000, 1) end addCommandHandler("test", mybase) Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 x,y,z cordinations aren't defined Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 x,y,z cordinations aren't defined lol, i know but i put there when will fixed. ERROR: attempt to call global "guiCreateLabel" (a nil value) Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 ok, it should be like that function mybase(source) local number = 5 setTimer(function() number = number-1 local myLabel = guiCreateLabel(0, 0, 1, 1,"",true) guiSetText(myLabel, "For "..number.." seconds") if number < 1 then setElementPosition(source, x,y,z) end end, 5000, 1) end addCommandHandler("test", mybase) Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 ok, it should be like that function mybase(source) local number = 5 setTimer(function() number = number-1 local myLabel = guiCreateLabel(0, 0, 1, 1,"",true) guiSetText(myLabel, "For "..number.." seconds") if number < 1 then setElementPosition(source, x,y,z) end end, 5000, 1) end addCommandHandler("test", mybase) not work same error.. but how i can put timer in DxDrawText? i mean this dxDrawText("For "..number.."", 146, 476, 304, 536, tocolor(255,255,255), 1, "default-bold", "center") but i have here error: attempt to call global "tocolor" (a nil value) Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 dxDrawText("For "..number.."", 146, 476, 304, 536, tocolor(255,255,255,255), 1, "default-bold", "center") Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 dxDrawText("For "..number.."", 146, 476, 304, 536, tocolor(255,255,255,255), 1, "default-bold", "center") same error Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 dxDrawText("For "..number.."", 146, 476, 304, 536, tocolor(255,255,255,255), 1, "default-bold", "center",false, false, false, false, false) Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 dxDrawText("For "..number.."", 146, 476, 304, 536, tocolor(255,255,255,255), 1, "default-bold", "center",false, false, false, false, false) same error Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 This must be client-side? i mean this when i use /test dxDrawText displays 5 4 3 2 1 warp and dxDrawText disappears Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 This must be client-side? Lmao, dxDraws works only in client side , use trigger to send it from client to server Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 This must be client-side? Lmao, dxDraws works only in client side , use trigger to send it from client to server hm and that if the trigger I know Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 hm and that if the trigger I know triggerServerEvent --it will send the data from client to server side Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 hm and that if the trigger I know triggerServerEvent --it will send the data from client to server side Can you please fix this? When it is done so at least I learn to trigger Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 Can you please fix this? When it is done so at least I learn to trigger Alright, put the full code i will do it for you to learn from it Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 Can you please fix this? When it is done so at least I learn to trigger Alright, put the full code i will do it for you to learn from it function mybase(source) local number = 5 setTimer(function() number = number-1 dxDrawText("For "..number.."", 146, 476, 304, 536, tocolor(255,255,255,255), 1, "default-bold", "center", false, false, false, false, false) if number < 1 then setElementPosition(source, x,y,z) end end, 5000, 1) end addCommandHandler("base", mybase) Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 I made a full code for you, your code was totally messy and bugged --Client side: local number = 15 -- You can edit the timer to your choice. local sx, sy = guiGetScreenSize() --getting the screen size and defining it function dxDraw () dxDrawText("You'll be warped after "..tostring(number).. " seconds!", (sx-390)/ 2, (sy-36)/ 2, ((sx-390)/ 2) + 390, ((sy-36)/ 2) + 36, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top" ) if ( getTickCount ( ) - count >= 1000 ) then --we will conver the 1000 mili seconds to 1, so 3000 mili seconds will be as number 3. number = number - 1 count = getTickCount ( ) showCursor (true ) --showing the cursor to avoid abusers setElementFrozen ( localPlayer,true ) -- frozening the player to avoid abusers if ( number < 0 ) then --checking if the time remaining became 0 then we will remove the event handler of dxDrawImage. number = nil count = nil fadeCamera(false) setTimer(fadeCamera, 3000, 1, true) --fading the screen setElementPosition(localPlayer, 1170.24, -1207.2, 19.66) --You can edit these cordinations to your choice,it was just for test the code. removeEventHandler ( "onClientRender", root, dxDraw ) -- we remove the event handler of dxDraw function. showCursor (false ) setElementFrozen ( localPlayer,false ) end end end addCommandHandler("base", --Creating our command we name it "base". function () count = getTickCount () addEventHandler ( "onClientRender", root, dxDraw ) end) Link to comment
1LoL1 Posted September 12, 2015 Author Share Posted September 12, 2015 (edited) lol work but can you delete froze + curcor? i mean this add: when player move dxDrawText will remove and must be again use /base and can you please add when i use /base i warped to x,y,z but when i use /baseback i go warped for 15/30 seconds to back position? so can you add player can't move when have used /base? and when i have used /base i can't use again and can you this use only in group "Admin" ? this is easy but i don't know where i must put Edited September 12, 2015 by Guest Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 I will do the other things when i have time local sx, sy = guiGetScreenSize() --getting the screen size and defining it local number = 15 function dxDraw () dxDrawText("You'll be warped after "..tostring(number).. " seconds!", (sx-390)/ 2, (sy-36)/ 2, ((sx-390)/ 2) + 390, ((sy-36)/ 2) + 36, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top" ) if ( getTickCount ( ) - count >= 1000 ) then number = number - 1 count = getTickCount ( ) if ( number < 0 ) then number = nil count = nil fadeCamera(false) setTimer(fadeCamera, 3000, 1, true) setElementPosition(localPlayer, 1170.24, -1207.2, 19.66) removeEventHandler ( "onClientRender", root, dxDraw ) end end end addCommandHandler("base", function () count = getTickCount () addEventHandler ( "onClientRender", root, dxDraw ) end) Link to comment
KariiiM Posted September 12, 2015 Share Posted September 12, 2015 so can you add player can't move when have used /base? and when i have used /base i can't use again and can you this use only in group "Admin" ? this is easy but i don't know where i must put -Here you go, i updated the script and i cleaned it so it's now with all features that you need ! -Client side: local sx, sy = guiGetScreenSize() --getting the screen size and defining it local number = 15 local client = getLocalPlayer() function dxDraw () dxDrawText("You'll be warped after "..tostring(number).. " seconds!", (sx-390)/ 2, (sy-36)/ 2, ((sx-390)/ 2) + 390, ((sy-36)/ 2) + 36, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top" ) if ( getTickCount ( ) - count >= 1000 ) then number = number - 1 count = getTickCount ( ) setElementFrozen ( client,true ) if ( number < 0 ) then number = nil count = nil setElementFrozen ( client,false ) fadeCamera(false) setTimer(fadeCamera, 3000, 1, true) setTimer(setElementPosition, 1000, 1, client, 1170.24, -1207.2, 19.66) removeEventHandler ("onClientRender", root, dxDraw ) end end end addEvent ("sendData", true) addEventHandler ("sendData", root, function () count = getTickCount () addEventHandler ( "onClientRender", root, dxDraw ) end) -Server side: addCommandHandler("base", function (thePlayer) if ( getElementType ( thePlayer ) == "player" ) then local account = getPlayerAccount(thePlayer) if not account or isGuestAccount(account) then return end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) ) then triggerClientEvent(thePlayer,"sendData",thePlayer) else outputChatBox("Base system: You must be admin to use this command",thePlayer,255,0,0) end end end) ~Regards, KariM 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