Jump to content

WiBox

Members
  • Posts

    234
  • Joined

  • Last visited

Everything posted by WiBox

  1. Did you check the debug? If you did, can you send what it says? If you don't know what's the debug it's a command "/debugscript" use it at level 3: "/debugscript 3", it will tell you were there're warning or errors.
  2. rpgLimiter = {} function shotCheck(weapon) if ( weapon == 35 or weapon == 36 ) then rpgLimiter[localPlayer] = true setTimer( function() rpgLimiter[localPlayer] = false end, 10000, 1) toggleControl( "fire", false) toggleControl( "aim-wepaon", false) end end addEventHandler("onClientPlayerWeaponFire", localPlayer, shotCheck) function disableRPGonSwitch( privSlot, newSlot) if ( ( ( getPedWeapon( localPlayer, newSlot) == 35 ) or ( getPedWeapon( localPlayer, newSlot) == 36 ) ) and ( rpgLimiter[localPlayer] == true ) ) then toggleControl( "fire", false) toggleControl( "aim-wepaon", false) else toggleControl( "fire", true) toggleControl( "aim-wepaon", true) end end addEventHandler("onClientPlayerWeaponSwitch", root, disableRPGonSwitch) I'm trying to make a limit between each RPG shots, but for some reasons when I use "onClientRender" instead of "onClientPlayerWeaponSwitch" it works...
  3. I've made a panel with enabling and disabling shader from World Textures, the issue is, when I enable it for the first time it works, then I disable it works. I enable it for the second time, I disable that second time doesn't work, like the engineRemoveShaderFromWorldTexture worked one time... Any clue?
  4. So you want that onPlayerLogin check if players have the files? If they don't have it I'll use fileCreate/write/close? You're idea works, I can let them play while those files are downloading and add a note that they download some stuff, so I won't need to add them in a meta.xml, I thought of it, but I've read at Avoid using fileExists before calling downloadFile. Always call downloadFile and handle the result in onClientFileDownloadComplete at https://wiki.multitheftauto.com/wiki/DownloadFile, but I don't have a choice anyway, thanks.
  5. Dude, I trigger it every time a player tries to add a picture, you can't add a command handler for it... It starts as a panel write the link and stuff, then press the button, then it triggers the FetchRemote to download it, then it goes to fileCreate write and close, then it triggers addToXML then it triggers a client event downloadFile, that's it. But the thing is, it doesn't say like file doesn't exist, I go to MTA > Mods > Deathmatch ... > to the script, but the picture wasn't there. I've reconnected, like maybe it will load the XML file, didn't. As I said only when I restart the script, that picture gets downloaded.
  6. function addToXML( player, GlobalID, folder, folder1 ) local xml = xmlLoadFile("meta.xml") if ( xml ) then huh = xmlCreateChild( xml, "file" ) xmlNodeSetAttribute( huh, "src", folder.."/"..folder1.."/"..GlobalID) xmlSaveFile(xml) xmlUnloadFile(xml) else print("Unable to open meta.xml") end end Already did that, unfortunate it didn't work, I've tried to reconnect thought maybe when I join the server that picture will be downloaded, but it didn't, only when I restarted the script, the picture gets downloaded
  7. So my only choice is to reload the XML file, means my only choice is the restart the script?
  8. Okay I'm not sure why but it's not working anymore, so I'm trying to download a picture using fetchRemote(Worked), then it will edit the (xmlLoadFile, xmlSaveFile, xmlUnloadFile) meta.xml(worked), and the file gets downloaded in the server script, BUT when I use downloadFile by triggering it from the client side(triggerClientEvent), the file doesn't get downloaded... So what should I do? Note: I need the file to be download globally, not for the client only...
  9. WiBox

    [HELP] Text

    Okay use addEventHandler( "onClientGUIClick", label, function, false) at the function write the login event, when he press on the text, the event will get trigger for whatever you desire
  10. Nvm worked, I used that function, but I've forgotten to add the client script to meta.xml, silly right? Thanks anyway
  11. WiBox

    [HELP] Text

    My bad local label function fedit() edit1 = guiCreateStaticImage(608, 544, 150, 40, "gfx/edit.png", false) addEventHandler("onClientGUIClick", edit1, fedit1, false) end addEventHandler("onClientResourceStart", getRootElement(), fedit) function fedit1 (button) if button == "left" then label = guiCreateLabel( 608, 544, 200, 30, "Text", false) guiSetVisible( label, true) end end function removeLabel() guiSetVisible( label, false) end --What ever you need to addEventHandler or addCommandHandler or call the function ' removeLabel() '
  12. WiBox

    [HELP] Text

    What about guiCreateLabel to write a text? But then you need to fix the position of it guiCreateLabel( x, y, width, height, text, relative, parent) so you can write it without using a window: guiCreateLabel( x, y, width, heigh, "The text you want to write here..", relative ) Don't write a parent so it can be shown, if you want to remove it you can write guiSetVisible( labelname, false) example: local label function fedit() edit1 = guiCreateStaticImage(608, 544, 150, 40, "gfx/edit.png", false) addEventHandler("onClientGUIClick", edit1, fedit1, false) end addEventHandler("onClientResourceStart", getRootElement(), fedit) function fedit (button) if button == "left" then label = guiCreateLabel( 608, 544, 200, 30, "Text", false) guiSetVisible( label, true) end end function removeLabel() guiSetVisible( label, false) end --What ever you need to addEventHandler or addCommandHandler or call the function ' removeLabel() ' I suggest guiCreateLabel because dxDrawText needs onClientRender and the event handler onClientRender reduce players FPS...
  13. I need to reload a xml file without restarting the resource is there a way to do that?
  14. How can I check if a link works? I've tried to write " https://imgur.com/download/B8ta5Aa/The+Senate+upvote+this+image+of+our+glorious+ruler+so+it's+the+first+image+when+you+google+%22The%20Senate%22 " and it worked, : How can I know if the link will work in MTA? Okay, thanks I tried to use, fileCreate, fileWrite, fileClose and it worked! I used outputChatBox and print, and suddenly I remembered that that encrypted language doesn't work in MTA, so I tried those 3 functions, worked. Thanks!
  15. -- Server function startImageDownload( playerToReceive ) fetchRemote ("https://imgur.com/download/B8ta5Aa/The+Senate+upvote+this+image+of+our+glorious+ruler+so+it's+the+first+image+when+you+google+%22The%20Senate%22", myCallback, "", false, playerToReceive ) end addCommandHandler( "d", startImageDownload) function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end -- Client addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function( pixels ) downloadFile( pixels ) end ) File doesn't exist, it is the first time I use fetchRemote, so I'm not sure what's the wrong thing in it, now I know so I can download it I should edit meta.xml, but the image has not been downloaded, so any explanations?
  16. If I need to download a picture via link, which should be used? fetchRemote or callRemote ?
  17. WiBox

    Micro In MTA!

    Oh thanks, I didn't see that coming
  18. WiBox

    Micro In MTA!

    Hello. I was thinking if there's a way I can make a Voice Chat in MTA. Does someone know if that thing exists? Because by LUA scripting I'm sure it doesn't work, I'm thinking if there's any thing else can be used.
  19. WiBox

    Tips, examples

    Well no I'm from Lebanon, means arabic ?
  20. WiBox

    Tips, examples

    Well setElementData and getElementData is so easier and you can use it to link many scripts but the only issue is if you were lagging ( ping higher than 200 ) the setElementData will take time to function, function setData() setElementData( vehicle, "fuel", vehicle.fuel[vehicle] ) end addCommandHandler( "setData", setData) function getData() fuel = getElementData( vehicle, "fuel" ) end .... setElementData and getElementData you can use it in Server and Client side, but the thing is, it set the data using an element ( player, ped, vehicle ... ) so if you want to setElementData(vehicle... ) then you need to have at the other scripts (server or client) side the same vehicle, example, if you're speaking of yourself( player ), you can use in SERVER SIDE: source example: function test() setElementData(source, "testsetsetset", "aaaa" ) end addCommandHandler( "z", test) -- Who use the command ' /z ' is the source or add a variable in function test function test( player, command) setElementData( player, "testsetsetset", "aaaa" ) end addCommandHandler( "z", test) -- Who use the command ' /z ' is the player and the command ' z ' but we write it because if you need example to write something to add in setElementData: function test( player, command, data) setElementData( player, "testsetsetset", data ) end addCommandHandler( "z", test) -- here we use /z aaaaa -- So player is the source. command is ' z ' and the data is aaaaa Now in CLIENT SIDE: function setData() setElementData( localPlayer, "test", "aaaaaaaaaaaaaaa" ) end addCommandHandler( "z", setData) -- In client side you can't add player in the function variable there's only localPlayer do specify who used the command, and the variable you add for addCommandHandler are function setData( command, data) setElementData( localPlayer, "test", data ) end addCommandHandler( "z", setData) -- command = ' z ' the difference in server side and client side that in client side you don't need to write the player in variable you always use localPlayer -- but in server side you cant' write -- THINK AS THAT FUNCTION IS IN SERVER SIDE: function setData( command, data) setElementData( source, "test", data ) end addCommandHandler( "z", setData) -- so here the variables are command and data, command = source or player and the data = ' z ' what I mean in server side you should write player you can't avoid it, in client side you don't need to write it, hope you understand what I meant, my English writing skils are horrible..
  21. WiBox

    Tips, examples

    Example: Server Side: function sendData() triggerClientEvent( source, "fuel", source, Vehicle.fuel [ vehicle ] ) -- you should specify the vehicle... end addCommandHandler("sendData", sendData) Client Side: local vehicleFuel addEvent ( "fuel", true ) addEventHandler ( "fuel", root, function ( fuel ) vehicleFuel = fuel end) so when you use /sendData , vehicleFuel will be equal to the fuel which came from the server side Vehicle.fuel[vehicle]
  22. WiBox

    Tips, examples

    Well I know 2 ways, setElementData and getElementData either TriggerServerEvent and TriggerClientEvent
  23. WiBox

    Tips, examples

    Well there's no standards for scripting, there's only logic and basic. However asking here if the script is good isn't going to help you, test the script in MTA server. If it has bugs, fix them or send them here and we will help~
  24. https://pilovali.nl/youtube-to-mp3/ This site can convert youtube to MP3, using the function callRemote But I need a example of it using any converter link from youtube to mp3 does anyone has an idea?
  25. The Other Utube TO Mp3 topic..
×
×
  • Create New...