Jump to content

roaddog

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by roaddog

  1. Yes. due to the height's of label cant go highter than 600, I need to split the file into tables by lines. and make a label for each lines, is that alright?
  2. Oh alright then. -- Vehicle Commands /engine - Turn your engine on or off. l /lock - Lock your vehicle. /unlock - Unlock your vehicle. /fp - Toggle first person view. hey so this is pretty much the txt file. how do I split it by lines?
  3. What do you mean by break behind lines? The label is just 1 block, not that each line for each label
  4. So I got a label which is in a scrollpane, and This label is gonna be filled by a txt file which has many lines. and then I place it, but The text didn't really fill them up, the buttom just get wrapped out. See this picture if you dont get what I mean by wrapped out. You see it, the text isnt really finished. I need to calculate it, and then the offset will be used to set the size of it. Thankee.
  5. no its not, It returned false, I have checked several times. what should I get from this line loadstring("return "..funcname)()(unpack(arg)) ?
  6. So I use this useful function CallServerFunction server: -- Always, always, always, (always) use a list of allowed servers functions. -- Otherwise hackers can call any function and destroy your server. allowedFunctions = { ["isPlayerInACL"]=true } function callServerFunction(funcname, ...) if not allowedFunctions[funcname] then -- Protect server from abuse outputServerLog( "SECURITY: " .. tostring(getPlayerName(client)) .. " tried to use function " .. tostring(funcname) ) return end local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction", true) addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction) client: function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the serverside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg)) end My function: ---Client function isPlayerStaff ( p ) local p = p or getLocalPlayer() if ( p and getElementType ( p ) == 'player' ) then if ( callServerFunction("isPlayerInACL", p, "Level 1" ) ) then return true end return false end end --Server function isPlayerInACL ( player, acl ) local account = getPlayerAccount ( player ) if ( isGuestAccount ( account ) ) then return false end return isObjectInACLGroup ( "user."..getAccountName ( account ), aclGetGroup ( acl ) ) end This code returns nothing. I don't know why but it should return true @isPlayerInACL.
  7. The resource is suspended :c
  8. function playerQuit () if isElement(source) then if isElementWithinMarker ( source, marker1 ) then moveObject ( gate1, 3000, 2507.400390625, 1602.7001953125, 13.7 ) end if isElementWithinMarker ( source, marker2 ) then moveObject ( gate2, 3000, 2567.1005859375, 1484.099609375, 13.7 ) end end end addEventHandler ("onPlayerQuit", root, playerQuit )
  9. How about tbis? local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end end addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin) function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) X = 0.0825 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.25 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
  10. I doubt it is. Check debugscript please? give this resource admin priveleges.
  11. Try this, not tested but It could work. local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end end function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) X = 0.0825 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.25 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) guiSetVisible(wdwLogin, false) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") if not guiGetVisible(wdwLogin) then guiSetVisible(wdwLogin, true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
  12. Hai, guys. So how can I get files from a directory. It's like checking the directory and return all the file names and its extensions. for example I have a directory called mydir and inside mydir there are 4 files which are 1.lua, 2.lua, 3.map, and 4.xml then I want to randomly know what files in the mydir by using function. Thanks, I hope you understand what Im tryna say. Peace.
  13. <meta> <info author="Tiger" version="1.0" type="gamemode" name="Server" description="a simple spawn script" /> <script src="Server.lua" /> <script src="Client.lua" type="client" /> </meta> You have to put the client type, if you dont put the type it will load as server side script. therefore, you got the error.
  14. data[num].color.rr, data[num].color.rg, data[num].color.rb
  15. function onVehicleStartEnter(thePlayer, seat, jacked) if (isElement(jacked) and seat == 0 and getElementData( jacked, "seatbelt" )) then outputChatBox( getPlayerName(jacked).." uses his belt. Therefore, you are unable to hijack him", thePlayer, 255, 0, 0, false) cancelEvent() end end addEventHandler( "onVehicleStartEnter", getRootElement(), onVehicleStartEnter ) edit: just realized that the source was player that starts entering the vehicle, my bad
  16. Eh, no... the table is like this; local Chats = { "Support", "Main", "Team", "Local", "Group", "Advert", "Kills","Joinquit" } Update: With your code, now the file only has one child. <Chats> <chat name="Joinquit" enabled="false"></chat> </Chats> Update2: NVM, JR10's worked till I deleted the xml. and recreated it Thanks
  17. Here's the script: addEventHandler ( "onClientResourceStop", resourceRoot, function ( ) local file = xmlLoadFile("@Chat.xml", "Chats") or xmlCreateFile('@Chat.xml', 'Chats') if not file then xmlCreateFile('@Chat.xml', 'Chats') end for i, v in pairs ( Chats ) do local child = xmlFindChild ( file, 'chat', 0 ) if child then xmlDestroyNode(file) child = xmlCreateChild(file, 'chat') xmlNodeSetAttribute(child, 'name', v) xmlNodeSetAttribute(child, 'enabled', tostring(isset(eTable[v]))) end if not child then child = xmlCreateChild(file, 'chat') xmlNodeSetAttribute(child, 'name', v) xmlNodeSetAttribute(child, 'enabled', tostring(isset(eTable[v]))) end end xmlSaveFile(file) xmlUnloadFile(file) end ) and the result: <chat name="Support" enabled="false"></chat> <chat name="Main" enabled="false"></chat> <chat name="Team" enabled="false"></chat> <chat name="Local" enabled="false"></chat> <chat name="Group" enabled="false"></chat> <chat name="Advert" enabled="false"></chat> <chat name="Kills" enabled="false"></chat> <chat name="Joinquit" enabled="false"></chat> <chat name="Support" enabled="false"></chat> <chat name="Main" enabled="false"></chat> <chat name="Team" enabled="false"></chat> <chat name="Local" enabled="false"></chat> <chat name="Group" enabled="false"></chat> <chat name="Advert" enabled="false"></chat> <chat name="Kills" enabled="false"></chat> <chat name="Joinquit" enabled="false"></chat> The childs keep getting duplicated everytime I restart the resource. How to fix this? Thanks
  18. roaddog

    To-Do List

    hmm, how about just stricking it instead of stricking and delete. I mean you click once it will be struck-out, you click twice it will be deleted. here's why: anothernob has to-do list, and he has done something, and then stroke the list.... somenob: "Hey man what have you done, lately?" anothernob: "Lemme check on my to-do list." later.... anothernob: "ducking help, I forgot. I have struck that out. dang it" Maybe some setting that can make it public? with this you can actually bring people to the site.
  19. local cmds1 = fileOpen("content/cmds.txt", true) local jobinfo2 = fileOpen("content/jobinfo.txt", true) local english = fileOpen("languages/english.txt", true) local french = xmlLoadFile("languages/french.xml") --local italian = xmlLoadFile("languages/italian.xml") local georgian = xmlLoadFile("languages/georgian.xml") local turkish = xmlLoadFile("languages/turkish.xml") local dutch = xmlLoadFile("languages/german.xml") local serbian = fileOpen("languages/serbian.txt", true) local spanish = xmlLoadFile("languages/spanish.xml") local filipino = fileOpen("languages/filipino.txt", true) local arabic = xmlLoadFile("languages/arabic.xml") cmds = fileRead(cmds1, 50000) jobInfoIG = fileRead(jobinfo2, 50000) eng = fileRead(english, 50000) fre = xmlNodeGetValue(french) --ita = xmlNodeGetValue(italian) geo = xmlNodeGetValue(georgian) turk = xmlNodeGetValue(turkish) deu = xmlNodeGetValue(dutch) serb = fileRead(serbian, 50000) spa = xmlNodeGetValue(spanish) fil = fileRead(filipino, 50000) arab = xmlNodeGetValue(arabic) --Creating GUI elements... function F1Gui() tabPan = guiCreateTabPanel(52, 247, 931, 477, false) guiSetVisible (tabPan, false) rulesTab = guiCreateTab("Server Rules", tabPan) servMemo = guiCreateMemo(4, 12, 917, 431, eng, false, rulesTab) guiMemoSetReadOnly(servMemo, true) jobInfTab = guiCreateTab("Job Informations", tabPan) jobMemo = guiCreateMemo(4, 12, 917, 431, jobInfoIG, false, jobInfTab) guiMemoSetReadOnly(jobMemo, true) cmdsTab = guiCreateTab("Commands", tabPan) cmdMemo = guiCreateMemo(4, 12, 917, 431, cmds, false, cmdsTab) guiMemoSetReadOnly(cmdMemo, true) staffTab = guiCreateTab("Staff Roster", tabPan) gbFlag = guiCreateStaticImage(747, 156, 24, 15, ":NGChelp/images/gb.png", false) frFlag = guiCreateStaticImage(778, 156, 24, 15, ":NGChelp/images/fr.png", false) itFlag = guiCreateStaticImage(809, 156, 24, 15, ":NGChelp/images/it.png", false) deFlag = guiCreateStaticImage(840, 156, 24, 15, ":NGChelp/images/de.png", false) saFlag = guiCreateStaticImage(871, 156, 24, 15, ":NGChelp/images/sa.png", false) skFlag = guiCreateStaticImage(778, 181, 24, 15, ":NGChelp/images/sk.png", false) phFlag = guiCreateStaticImage(809, 181, 24, 15, ":NGChelp/images/ph.png", false) trFlag = guiCreateStaticImage(747, 181, 24, 15, ":NGChelp/images/tr.png", false) esFlag = guiCreateStaticImage(840, 182, 24, 14, ":NGChelp/images/es.png", false) geFlag = guiCreateStaticImage(871, 181, 24, 15, ":NGChelp/images/ge.png", false) guiSetVisible(gbFlag, false) guiSetVisible(frFlag, false) guiSetVisible(itFlag, false) guiSetVisible(deFlag, false) guiSetVisible(skFlag, false) guiSetVisible(saFlag, false) guiSetVisible(geFlag, false) guiSetVisible(phFlag, false) guiSetVisible(esFlag, false) guiSetVisible(trFlag, false) addEventHandler("onClientGUIClick", gbFlag, translatingEnglish, false) addEventHandler("onClientGUIClick", frFlag, translatingFrench, false) --addEventHandler("onClientGUIClick", itFlag, translatingItalian, false) addEventHandler("onClientGUIClick", esFlag, translatingSpanish, false) addEventHandler("onClientGUIClick", geFlag, translatingGeorgian, false) addEventHandler("onClientGUIClick", trFlag, translatingTurkish, false) addEventHandler("onClientGUIClick", phFlag, translatingFilipino, false) addEventHandler("onClientGUIClick", skFlag, translatingSerbian, false) addEventHandler("onClientGUIClick", saFlag, translatingArabic, false) addEventHandler("onClientGUIClick", deFlag, translatingDutch, false) end addEventHandler("onClientResourceStart", resourceRoot, F1Gui) -- Creating dx elements function F1Draw() dxDrawRectangle(35, 59, 966, 41, tocolor(3, 191, 194, 171), true) dxDrawRectangle(35, 99, 966, 635, tocolor(3, 0, 0, 171), false) dxDrawText("NGC Information Panel", 360, 63, 680, 101, tocolor(0, 0, 0, 255), 1.20, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("NGC Information Panel", 360, 61, 680, 99, tocolor(0, 0, 0, 255), 1.20, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("NGC Information Panel", 358, 63, 678, 101, tocolor(0, 0, 0, 255), 1.20, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("NGC Information Panel", 358, 61, 678, 99, tocolor(0, 0, 0, 255), 1.20, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("NGC Information Panel", 359, 62, 679, 100, tocolor(255, 255, 255, 225), 1.20, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("Click on the flag to get the rules translated", 748, 112, 977, 151, tocolor(0, 0, 0, 255), 0.70, "pricedown", "left", "top", false, true, true, false, false) dxDrawText("Click on the flag to get the rules translated", 748, 110, 977, 149, tocolor(0, 0, 0, 255), 0.70, "pricedown", "left", "top", false, true, true, false, false) dxDrawText("Click on the flag to get the rules translated", 746, 112, 975, 151, tocolor(0, 0, 0, 255), 0.70, "pricedown", "left", "top", false, true, true, false, false) dxDrawText("Click on the flag to get the rules translated", 746, 110, 975, 149, tocolor(0, 0, 0, 255), 0.70, "pricedown", "left", "top", false, true, true, false, false) dxDrawText("Click on the flag to get the rules translated", 747, 111, 976, 150, tocolor(255, 255, 255, 255), 0.70, "pricedown", "left", "top", false, true, true, false, false) dxDrawImage(347, 110, 342, 114, ":NGChelp/images/NGC.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) end function showF1() addEventHandler("onClientRender", getRootElement(), F1Draw) end function removeF1() removeEventHandler("onClientRender", getRootElement(), F1Draw) end -- GUI visibility and binding function F1Panel() if getElementData(localPlayer, "isPlayerLoggedin") then if guiGetVisible(tabPan) then guiSetVisible(tabPan, false) guiSetVisible(gbFlag, false) guiSetVisible(frFlag, false) guiSetVisible(itFlag, false) guiSetVisible(deFlag, false) guiSetVisible(skFlag, false) guiSetVisible(saFlag, false) guiSetVisible(geFlag, false) guiSetVisible(phFlag, false) guiSetVisible(esFlag, false) guiSetVisible(trFlag, false) showCursor(false) showChat(true) removeF1() else guiSetVisible(tabPan, true) guiSetVisible(gbFlag, true) guiSetVisible(frFlag, true) guiSetVisible(itFlag, true) guiSetVisible(deFlag, true) guiSetVisible(skFlag, true) guiSetVisible(saFlag, true) guiSetVisible(geFlag, true) guiSetVisible(phFlag, true) guiSetVisible(esFlag, true) guiSetVisible(trFlag, true) showCursor(true) showChat(false) showF1() end end end bindKey("F1", "down", F1Panel) function translatingEnglish(gbFlag) if (gbFlag == "left") then guiSetText(servMemo, eng) end end function translatingFrench(frFlag) if (frFlag == "left") then guiSetText(servMemo, fre) end end function translatingArabic(saFlag) if (saFlag == "left") then guiSetText(servMemo, arab) end end function translatingDutch(deFlag) if (deFlag == "left") then guiSetText(servMemo, deu) end end --[[function translatingItalian(itFlag) if (itFlag == "left") then guiSetText(servMemo, ita) end end]]-- function translatingGeorgian(geFlag) if (geFlag == "left") then guiSetText(servMemo, geo) end end function translatingTurkish(trFlag) if (trFlag == "left") then guiSetText(servMemo, turk) end end function translatingSerbian(skFlag) if (skFlag == "left") then guiSetText(servMemo, serb) end end function translatingSpanish(esFlag) if (esFlag == "left") then guiSetText(servMemo, spa) end end function translatingFilipino(phFlag) if (phFlag == "left") then guiSetText(servMemo, fil) end end
  20. roaddog

    To-Do List

    Add edit button, because sometimes people make simple mistakes to their typing. Strike button would be good too, to mark a to-do that has been done. Good luck with the web.
  21. roaddog

    Dem Tables!

    Yay! That could work. Thanks TAPL.
  22. roaddog

    Dem Tables!

    Yes it did. function destroyShitsAll(p, job) if p == getLocalPlayer() and job == "Lumberjack" then treeloaded = false outputChatBox("Passed!") for i, index in ipairs(trees) do destroyElement(trees[i]) outputChatBox("how about this spam?") end for i, v in ipairs(treesblip) do outputChatBox("Spam this server man") destroyElement(treesblip[i]) end end end addEventHandler("onClientPlayerQuitJob", root, destroyShitsAll) all outputs got passed.
  23. roaddog

    Dem Tables!

    This is how I created the trees trees = {} treesblip = {} function createTrees(p) if p == getLocalPlayer() then for i, index in pairs(treesPositions) do for i, v in ipairs(index) do local x, y, z = unpack(v) trees[i] = createObject(idList[math.random(1, 3)], x, y, z) treesblip[i] = createBlipAttachedTo(trees[i], 0, 1, 255, 255, 0, 255, 0, 500) end end end end This is how I destroy. this is the problem, it didnt get destroyed ._. how do I destroy dem? addEvent("onClientPlayerQuitJob", true) function destroyShitsAll(p, job) if p == getLocalPlayer() and job == "Lumberjack" then treeloaded = false for i, index in ipairs(trees) do destroyElement(trees[i]) end for i, v in ipairs(treesblip) do destroyElement(treesblip[i]) end end end addEventHandler("onClientPlayerQuitJob", root, destroyShitsAll) I also tried for i, index in ipairs(trees) do destroyElement(index) end it does nothing.
  24. Hey.. How to avoid having multiple values in a column? When I store the data in SQL, it most likely get me multiple values in the column. Like I store an account, it can allow me to have 2 or more same account. how to avoid this? In short, No same values in table. I hope you get this. Thanks
×
×
  • Create New...