Jump to content

JoZeFSvK

Members
  • Posts

    201
  • Joined

  • Last visited

Everything posted by JoZeFSvK

  1. When i rename folder then dont work
  2. Hey i want rename race folder because: Player download race folder from all servers (on which is this mod) so i want create folder like etc. nab_race and then customer, will download race to folder nab_race so but i cheange folder then i cheange gamemode "race" to gamemode nab_race, then i must in all maps edit meta.xml ? but in this is "
  3. I want create checkbox like image Miki This is not stolen script this script is free in community. I try learn and trying understand lua, but sometimes i dont know. yes when i like script and its client i use from client something things to create new script or edit.
  4. Hey i have problem with adding image to checkbox parts from checkbox i try paste guiStaticImage but dont work. who know where i must paste it ? thank checkbox_save = guiCreateCheckBox( X + 210, Y + 300,105,20,"Remember Me.",false,false) guiSetFont(checkbox_save,"default-bold-small") ------------------------------------------------------- local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) -- HERE I TRY PASTE BUT DONT WORK guiStaticImageLoadImage(checkImage, "on.png") guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) -- guiStaticImageLoadImage(checkImage, "off.png") guiSetText ( edit_password, tostring(password)) end end end ------------------------------------------------------- if(button == "left" and state == "up") then if (source == shLogin) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end
  5. JoZeFSvK

    Travelling

    I try create travelling script but i have problem with this dont work good have bugs who can help me ? thank you local sw, sh = guiGetScreenSize() lol = 0 createPed(40, 173.35345, -1320.99438, 79.13128) function drawBackround() lol = lol + 1 if getPedOccupiedVehicle(localPlayer) then local x, y, z = getElementPosition(getPedOccupiedVehicle(localPlayer)) setElementPosition(getPedOccupiedVehicle(localPlayer), x, y, z) end if lol > 3350 then setCameraMatrix(-437.14282226563 + lol, -1320 + lol - 3350, 80, 2580, -1628.5712890625, -300, 0, 70) else setCameraMatrix(-437.14282226563 + lol, -1320, 80, 2580, -1628.5712890625, -300, 0, 70) end end addEventHandler("onClientRender", getRootElement(), drawBackround) function showdx () dxDrawText ("Twin Stars Loading...", 0, sh/2-200, sw, sh, tocolor (255,255,255,255), 2, "default-bold", "center", "top") addEventHandler ( "onClientRender", root, drawBackround ) end addEvent( "onTravelScreenStart", true ) addEventHandler( "onTravelScreenStart", getRootElement(), showdx ) function manageTravelScreenStop () removeEventHandler ( "onClientRender", root, drawBackround ) end addEvent( "onTravelScreenStop", true ) addEventHandler( "onTravelScreenStop", getRootElement(), showdx )
  6. nobody dont know help with this problem ?
  7. Hey i have problem with login panel when i edit positions for me screen its good but when i edit for other its bad . Problem you can see in video Client.lua lol = 0 createPed(40, 173.35345, -1320.99438, 79.13128) function drawBackround() lol = lol + 1 if getPedOccupiedVehicle(localPlayer) then local x, y, z = getElementPosition(getPedOccupiedVehicle(localPlayer)) setElementPosition(getPedOccupiedVehicle(localPlayer), x, y, z) end if lol > 3350 then setCameraMatrix(-437.14282226563 + lol, -1320 + lol - 3350, 80, 2580, -1628.5712890625, -300, 0, 70) else setCameraMatrix(-437.14282226563 + lol, -1320, 80, 2580, -1628.5712890625, -300, 0, 70) end end addEventHandler("onClientRender", getRootElement(), drawBackround) Xg,Yg =625,299 local scrX,scrY = guiGetScreenSize() local x = scrX/2-Xg/2 local y = scrY/2-Yg/2 local x2 = x+388 image1=0-389 image2=Xg+237 local infoTable = {} function onresourceStart () if image1 < x then image1 = image1+10 guiSetPosition ( left, image1, y, false ) guiSetPosition ( name, image1+162, y+96, false ) guiSetPosition ( pass, image1+162, y+140, false ) guiSetPosition ( login, image1+235, y+175, false ) --guiSetPosition ( label, image1+220, y+214, false ) end if image1 > x+1 then image1 = 299 --outputChatBox(""..image1) end if image2 >= x2 then guiSetPosition ( right, image2, y, false ) guiSetPosition ( register, image2+130, y+220, false ) image2 = image2-5 end if image2 < x2-1 then image2 = image2+1 end end xmlFileName = tostring("login.xml") function HandleTheRendering ( ) confFile = xmlLoadFile("preferences.xml") if (confFile) then infoTable["account"] = xmlNodeGetAttribute(confFile,"username") infoTable["pass"] = xmlNodeGetAttribute(confFile,"pass") else confFile = xmlCreateFile("preferences.xml","user") xmlNodeSetAttribute(confFile,"username","") xmlNodeSetAttribute(confFile,"pass","") infoTable["account"] = getPlayerName(localPlayer) infoTable["pass"] = "" end xmlSaveFile(confFile) guiSetInputEnabled(true) showCursor(true) showChat(false) showPlayerHudComponent("all", false) left = guiCreateStaticImage( image1 , y, 389, Yg, 'img/LLeft.png', false) right = guiCreateStaticImage( image2, y, 237, Yg, 'img/Right.png', false) XxX = guiCreateButton(210,10,20,20,'X',false,right) addEventHandler("onClientGUIClick",XxX,hideLoginWindow2) guiSetAlpha(XxX,0) if (infoTable["account"]) then name = guiCreateEdit( image1, y, 150, 25, infoTable["account"], false) else name = guiCreateEdit( image1, y, 150, 25, '', false) end if (infoTable["pass"]) then pass = guiCreateEdit( image1, y, 150, 25, infoTable["pass"], false) else pass = guiCreateEdit( image1, y, 150, 25, '', false) end login = guiCreateStaticImage( image1, y, 79, 32, 'img/login.png', false) register = guiCreateStaticImage( image1, y, 75, 26, 'img/SignUp.png', false) registerWindow = guiCreateStaticImage( scrX/2-545/2, scrY/2-425/2, 545, 425, 'img/win.png', false) guiSetVisible(registerWindow, false) nameReG = guiCreateEdit( 200, 150, 200, 50, '', false,registerWindow) passReG = guiCreateEdit( 200, 220, 200, 50, '', false,registerWindow) btnConfirmRegistration = guiCreateStaticImage( 200, 300, 168, 71, 'img/sin.png', false,registerWindow) addEventHandler ( "onClientRender", root, onresourceStart ) -- keep the text visible with onClientRender. addEventHandler("onClientGUIClick",login,onClickLogin) addEventHandler("onClientGUIClick",register,onClickRegisterToggle) addEventHandler("onClientGUIClick",btnConfirmRegistration,onClickRegisterConfirm) for i,k in ipairs(getElementsByType("gui-staticimage")) do if k ~= registerWindow then guiSetProperty(k,'RiseOnClick','False') else end end end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) function hideLoginWindow2(button,state) playSound("sounds/hover.mp3", false) if(button == "left" and state == "up") then if (source == XxX) then guiSetVisible(registerWindow, false) guiSetInputEnabled(false) guiSetVisible(left, false) guiSetVisible(name, false) guiSetVisible(right, false) guiSetVisible(pass, false) guiSetVisible(login, false) guiSetVisible(register, false) showCursor(false) showChat(true) showPlayerHudComponent("all", true) removeEventHandler ( "onClientRender", root, onresourceStart ) -- keep the text visible with onClientRender. removeEventHandler("onClientRender", getRootElement(), drawBackround) removeEventHandler("onClientRender", getRootElement(), kokotnosti) end end end function hideRegisterWindow() showChat(true) showPlayerHudComponent("all", true) guiSetInputEnabled(true) guiSetVisible(registerWindow, false) showCursor(true) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(left, false) guiSetVisible(name, false) guiSetVisible(right, false) guiSetVisible(pass, false) guiSetVisible(login, false) guiSetVisible(register, false) showCursor(false) showChat(true) showPlayerHudComponent("all", true) removeEventHandler ( "onClientRender", root, onresourceStart ) -- keep the text visible with onClientRender. removeEventHandler("onClientRender", getRootElement(), drawBackround) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) function onClickRegisterConfirm(button,state) playSound("sounds/hover.mp3", false) if(button == "left" and state == "up") then if (source == btnConfirmRegistration) then username = guiGetText(nameReG) password = guiGetText(passReG) passwordConfirm = guiGetText(passReG) triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm) end end end function onClickLogin(button,state) if(button == "left" and state == "up") then if (source == login) then username = guiGetText(name) password = guiGetText(pass) triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password) toggleSavePassword(true, username, password) end end end function toggleSavePassword(save, name, pass) confFile = xmlLoadFile("preferences.xml") xmlNodeSetAttribute(confFile, "username", name) xmlNodeSetAttribute(confFile, "pass", pass) xmlSaveFile(confFile) end function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == register) then guiSetVisible(registerWindow, true) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) showChat(false) showPlayerHudComponent("all", false) end end end addEventHandler( "onClientMouseEnter", getRootElement(), function () if (source == login) then guiStaticImageLoadImage ( login, "img/login2.png" ) playSound("sounds/hover.mp3", false) elseif (source == register) then guiStaticImageLoadImage ( register, "img/SignUp2.png" ) playSound("sounds/hover.mp3", false) end end ) addEventHandler("onClientMouseLeave", getRootElement(),function () if (source == login ) then guiStaticImageLoadImage ( source, "img/login.png" ) elseif (source == register ) then guiStaticImageLoadImage ( source, "img/SignUp.png" ) end end )
  8. Yes Yes WTF? its for hunter rocket ye ?
  9. yes and only vip will have colored rocket and others no
  10. when player will in vip group then can enable colored rocket
  11. Hey i want create command for VIP and i have problem Server rRoot = getResourceRootElement(getThisResource()) function raketa (player, command) local accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then outputChatBox("#1e90ff*#ffffff~TS~ #ffff00VIP#ffffff: You enabled rocket!", player, 255, 255, 255, true ) triggerClientEvent("onRaketa", root) else outputChatBox ( "#1e90ff~TS~*#ffffff You dont have permission for this command", player, 255, 0, 0, true ) return end end addCommandHandler("rocket", raketa) Client local rocketColor = {0, 102, 255, 255} local rootElement = getRootElement() local localPlayer = getLocalPlayer() local markers = {} addEvent( "onRaketa", true ) addEventHandler( "onRaketa", root, function updateMarkers() for i,m in pairs(markers) do if getProjectileType(m[2]) then local rx, ry, rz = getElementPosition(m[2]) setElementPosition(m[1], rx, ry, rz) else markers[i] = nil destroyElement(m[1]) end end end --addEventHandler("onClientRender", rootElement, updateMarkers) function onRocketCreate(creator) if getProjectileType(source) ~= 19 then return end setTimer(function(source) local rx, ry, rz = getElementPosition(source) local marker = createMarker(rx, ry, rz, "corona", 5, rocketColor[1], rocketColor[2], rocketColor[3], rocketColor[4]) table.insert(markers, {marker, source}) end, math.random(50, 100), 1, source) end addEventHandler("onClientProjectileCreation", rootElement, onRocketCreate) i have problem i dont know where add addevent handler I tried different but i have problems thank you
  12. Hey race work, redo,nextmap but when i buy map then (i play bought map) and then i cant give redo. This is a racevoting server i think problem will in it but i dont know where thank you community -- -- racemidvote_server.lua -- -- Mid-race random map vote and -- NextMapVote handled in this file -- local lastVoteStarterName = '' local lastVoteStarterCount = 0 local mapIsAlreadySet = false local g_ForcedNextMap local mapBlock local hunterMsg = false ---------------------------------------------------------------------------- -- displayHilariarseMessage -- -- Comedy gold ---------------------------------------------------------------------------- function displayHilariarseMessage( player ) if not player then lastVoteStarterName = '' else local playerName = getPlayerName(player) local msg = '' if playerName == lastVoteStarterName then lastVoteStarterCount = lastVoteStarterCount + 1 if lastVoteStarterCount == 5 then msg = playerName .. ' started a vote. Hardly a suprise.' elseif lastVoteStarterCount == 10 then msg = 'Guess what! '..playerName .. ' started ANOTHER vote!' elseif lastVoteStarterCount < 5 then msg = playerName .. ' started another vote.' else msg = playerName .. ' continues to abuse the vote system.' end else lastVoteStarterCount = 0 lastVoteStarterName = playerName msg = playerName .. ' started a vote.' end outputRace( msg ) end end ---------------------------------------------------------------------------- -- displayKillerPunchLine -- -- Sewing kits available in the foyer ---------------------------------------------------------------------------- function displayKillerPunchLine( player ) if lastVoteStarterName ~= '' then outputRace( 'Offical news: Everybody hates ' .. lastVoteStarterName ) end end ---------------------------------------------------------------------------- -- startMidMapVoteForRandomMap -- -- Start the vote menu if during a race and more than 30 seconds from the end -- No messages if this was not started by a player ---------------------------------------------------------------------------- function startMidMapVoteForRandomMap(player) -- Check state and race time left if not stateAllowsRandomMapVote() or g_CurrentRaceMode:getTimeRemaining() < 30000 then if player then outputRace( "I'm afraid I can't let you do that, " .. getPlayerName(player) .. ".", player ) end return end displayHilariarseMessage( player ) exports.votemanager:stopPoll() -- Actual vote started here local pollDidStart = exports.votemanager:startPoll { title='Do you want to change to a random map?', percentage=51, timeout=15, allowchange=true, visibleTo=getRootElement(), [1]={'Yes', 'midMapVoteResult', getRootElement(), true}, [2]={'No', 'midMapVoteResult', getRootElement(), false;default=true}, } -- Change state if vote did start if pollDidStart then gotoState('MidMapVote') end end addCommandHandler('new',startMidMapVoteForRandomMap) ---------------------------------------------------------------------------- -- event midMapVoteResult -- -- Called from the votemanager when the poll has completed ---------------------------------------------------------------------------- addEvent('midMapVoteResult') addEventHandler('midMapVoteResult', getRootElement(), function( votedYes ) -- Change state back if stateAllowsRandomMapVoteResult() then gotoState('Running') if votedYes then startRandomMap() else displayKillerPunchLine() end end end ) ---------------------------------------------------------------------------- -- startRandomMap -- -- Changes the current map to a random race map ---------------------------------------------------------------------------- function startRandomMap() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get a random map chosen from the 10% of least recently player maps, with enough spawn points for all the players (if required) local map = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) if map then g_IgnoreSpawnCountProblems = map -- Uber hack 4000 if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then problemChangingMap() end else outputWarning( 'startRandomMap failed' ) end end ---------------------------------------------------------------------------- -- outputRace -- -- Race color is defined in the settings ---------------------------------------------------------------------------- function outputRace(message, toElement) toElement = toElement or g_Root local r, g, b = getColorFromString(string.upper(get("color"))) if getElementType(toElement) == 'console' then outputServerLog(message) else if toElement == rootElement then outputServerLog(message) end if getElementType(toElement) == 'player' then message = '[PM] ' .. message end outputChatBox(message, toElement, r, g, b) end end ---------------------------------------------------------------------------- -- problemChangingMap -- -- Sort it ---------------------------------------------------------------------------- function problemChangingMap() outputRace( 'Changing to random map in 5 seconds' ) local currentMap = exports.mapmanager:getRunningGamemodeMap() TimerManager.createTimerFor("resource","mapproblem"):setTimer( function() -- Check that something else hasn't already changed the map if currentMap == exports.mapmanager:getRunningGamemodeMap() then startRandomMap() end end, math.random(4500,5500), 1 ) end -- -- -- NextMapVote -- -- -- local g_Poll ---------------------------------------------------------------------------- -- startNextMapVote -- -- Start a votemap for the next map. Should only be called during the -- race state 'NextMapSelect' ---------------------------------------------------------------------------- function startNextMapVote() exports.votemanager:stopPoll() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get all maps local compatibleMaps = exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource()) -- limit it to eight random maps if #compatibleMaps > 8 then math.randomseed(getTickCount()) repeat table.remove(compatibleMaps, math.random(1, #compatibleMaps)) until #compatibleMaps == 8 elseif #compatibleMaps < 2 then return false, errorCode.onlyOneCompatibleMap end -- mix up the list order for i,map in ipairs(compatibleMaps) do local swapWith = math.random(1, #compatibleMaps) local temp = compatibleMaps[i] compatibleMaps[i] = compatibleMaps[swapWith] compatibleMaps[swapWith] = temp end local poll = { title="Choose the next map:", visibleTo=getRootElement(), percentage=51, timeout=15, allowchange=true; } for index, map in ipairs(compatibleMaps) do local mapName = getResourceInfo(map, "name") or getResourceName(map) table.insert(poll, {mapName, 'nextMapVoteResult', getRootElement(), map}) end local currentMap = exports.mapmanager:getRunningGamemodeMap() if currentMap then table.insert(poll, {"Play again", 'nextMapVoteResult', getRootElement(), currentMap}) end -- Allow addons to modify the poll g_Poll = poll
  13. Thank you so much work
  14. When i add this on script then i see message end expected to close function at line near and when i add "or if isObject" then i see unexpected symbol near if in debugscript 3
  15. Aha thank you so much. and when i will want 2 groups ? Admin and Supermoderator ? i must duplicate this line or can edit this line ? if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then
  16. rRoot = getResourceRootElement(getThisResource()) local accountname = getAccountName (getPlayerAccount(player)) function noob (player, command) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox( "Player "..getPlayerName(player).." : say you are NOOB! ", root, 255, 255, 255, true ) triggerClientEvent("onNoob", root) else outputChatBox ( "You dont have permission for this command", player, 255, 0, 0, true ) return end end addCommandHandler("noob", noob) I can not like this but I have problem of bind more functions
  17. Ehm i think acl it good ?
  18. Client addEvent( "onNoob", true ) addEventHandler( "onNoob", root, function() local sound = playSound("noob.mp3") end ) Server rRoot = getResourceRootElement(getThisResource()) local accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then function noob (player, command) outputChatBox( "Player "..getPlayerName(player).." : say you are NOOB! ", root, 255, 255, 255, true ) triggerClientEvent("onNoob", root) else outputChatBox ( "You dont have permission for this command", player, 255, 0, 0, true ) return end end addCommandHandler("noob", noob) Ehm it is good ? with alc ? and when i will want acl Admin and Supermoderator i must add new line or ?
  19. dxCreateFont -> dxCreatemyFont ? its stupid no ?
  20. JoZeFSvK

    Custom font

    Hey community i have problem with custom font i want load digital font but dont work. Lets see my folder digital.ttf client.lua meta.xml > and client .. in client local myFont = dxCreateFont( "digital.TTF") dxDrawText(getServerTime()[2],textOffsetX+1,textOffsetY * 1.5+1,screenWidth,screenHeight,tocolor(0,0,0,alpha*1.7),1.7*(screenWidth*0.50)/1080,"myFont","left","top",true,true,true) dxDrawText(getServerTime()[2],textOffsetX,textOffsetY * 1.5,screenWidth,screenHeight,tocolor(255,255,255,alpha*1.7),1.7*(screenWidth*0.50)/1080,"myFont","left","top",true,true,true) and more ... i see font in game but it isnt my digital font. thank you
  21. JoZeFSvK

    Car color

    Hmn then why all cars have same color ?
×
×
  • Create New...