xXMADEXx
Members-
Posts
2,718 -
Joined
-
Last visited
Everything posted by xXMADEXx
-
Good tutorial, but you should add in the "..." operator too.
-
Not really, the same rules apply -- It's basically useless. Example, if I had this file functions.php that didn't have the ending: <?php function func1 ( ) { echo "Calling func 1"; } And I had this in index.php <?php include "functions.php"; ?> HTML code it would still run the same as if the functions.php file did have the PHP ?> ending. PHP itself will automatically end the file.
-
Hello everyone, On GitHub, I've added a new branched named "Development." On this branch, some scripts of the gamemode may not be as stable as the "master" branch, but it will typically have more features. I will be uploading updates one at a time on this branch, as as soon as I feel that the gamemode is stead then I'll merge the branches, thus releasing a new version of NG. In conclusion, the development branch will be updated much more often than the master branch, because I'll be uploading updates to it almost every day, for any fixes or added features. Thank you, xXMADEXx.
-
It's perfectly fine for servers to use community resources, plain and simple, they're there for a reason. However, when you use community resources, it doesn't give your server very much uniqueness. Overall, the server might be a little bit unique, but it is still running the same scripts and systems that anyone could get, and put on a server for themselves. When people use basic community scripts (ex. login panel, jobs, etc) it's because they don't know how to make the script themselves (most the time, there are exceptions.) So, if the server owner can't make a basic script such as a login panel, why would the server be unique at all? If they can't make the script, they probably either don't know how to link or barely know how to link all the resources together to make them all work, to create a good server. When someone's server is running on community scripts, it's always easy to find bugs and glitches in the server, and even if you do report them, they don't know how to fix it. I'm not saying using the community is bad, I mean hell, I learned to script because of the community resources. Just, when you want to make a server, you should at least have some type of understanding of scripting, so that you can create your own stuff that other people can't just download.
-
I'd just like to point out that 'pairs' don't loop in order of the table either, just because there are some scripts that want to loop the table in order. Example: local myTable = { ["Index 1"] = "Some random information", ["Another Key?"] = "Some random information ", ["Should be index 3"] = "Some random information", ["Master Race"] = "Some random information", ["Madex"] = "Some random information", } for index, value in pairs ( myTable ) do print ( index..": "..value ); end --[[ Expected printout: Index 1: Some random information Another Key?: Some random information Should be index 3: Some random information Master Race: Some random information Madex: Some random information -- There's a slight chance it could be in that order, but most likley it won't be -- There may be some algorithm that randomises them, but I don't know what it would be Real print-out (Example): Another Key?: Some random information Index 1: Some random information Madex: Some random information Master Race: Some random information Should be index 3: Some random information ]] But if you do need to loop a table with non-numerical keys for whatever reason, you can use this function: function foreachinorder(t, f, cmp) local keys = {} for k,_ in pairs(t) do keys[#keys+1] = k end table.sort(keys,cmp) local data = { } for _, k in ipairs ( keys ) do table.insert ( data, { k, t[k] } ) end return data end The only argument you need to worry about is t which is just the table you want to loop. You'll need to do some experimenting to see how it works, because I'm not sure how to explain it. Here's how I used it in my gamemode: local jobRanks = { ['fisherman'] = { [0] = "Deck Hand", [20]= "Net Baiter", [75]= "Line Thrower", [100]="Line Roller", [140]="Boat Captain", [200]="Experienced Fisherman", [270]="Underwater Trap Setter" } } -- Some other code... Skipping to the point local isNext = false; for _, v in ipairs ( foreachinorder ( jobRanks['fisherman'] ) ) do if ( isNext ) then data.nextRank = v[2]; data.requiredCatches = v[1] - data.caughtFish; break; end if ( v[2]:lower() == data.jobRank:lower() ) then isNext = true; end end
-
Thanks! Hope it helps. Closing the PHP tags isn't required at the end of a file. It's only required if you want to start writing in HTML. Non-requirment example: <?php echo "This is a simple php script that doesn't end at the end of a file"; Required example: <?php echo "This is a simple php script that does require an ending"; ?> <br /> Because I want to write in HTML here... So basically for this tutorial, it would be completely pointless to even end the PHP tag.
-
Are you sure the accounts table exists in the database? If so, do all the columns match up? Try using dbConnect/dbExec, they have better debugging features than the MySQL modules does.
-
Does debug script say any errors? I know the radius argument isn't required, but try putting it in to see what happens. The image file may be corrupted, also make sure that you have the image files in the meta.xml.
-
You should use the MTA SQL functions. I'm not sure if mysql_query sends any errors, but in debugscript are there any errors or warnings?
-
I think this may be what you're looking for: https://forum.multitheftauto.com/viewto ... 91&t=85392
-
I don't think any of those codes are what he is looking for. He wants it so that you can still edit in a text box, but just can't paste in it. This can be achieved by comparing the lengths of the text box with the old text and the new text. I have tested this code, and it seemed to be working just fine. local textBox = guiCreateEdit ( 100, 100, 200, 40, "Some Sample Text", false ); addEventHandler ( "onClientGUIChanged", textBox, function ( ) local oldText = getElementData ( source, "guiEdit:oldTextString" ); local text = guiGetText ( source ); if ( not oldText ) then setElementData ( source, "guiEdit:oldTextString", text ) return false; end if ( string.len ( text ) > string.len ( oldText ) ) then if ( string.len ( text ) - string.len ( oldText ) > 1 ) then guiSetText ( source, oldText ); outputChatBox ( "Pasting is not allowed!" ); return end end setElementData ( source, "guiEdit:oldTextString", text ); end );
-
Did debugscript show any results? (/debugscript 3)
-
Nobody asked for you script, all you had to do is what I said. Try using this: local sx,sy = guiGetScreenSize() local px,py = 1280,720 local x,y = (sx/px), (sy/py) local x2, y2, x3, y3 = 0, 0, 0, 0 local loopTimer = false; function speed() local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then if ( getControlState ( "handbrake" ) ) then dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/2/hb2.png", 0,0,0, tocolor(255, 255, 255 , 255)) if ( not isTimer ( loopTimer ) ) then playSound("files/handbrake.wav") loopTimer = setTimer ( function() loopTimer = nil end, 5000, 1 ); end else dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/2/hb.png", 0,0,0, tocolor(255, 255, 255 , 255)) end end end addEventHandler ( "onClientRender", root, speed )
-
I'd just like to inform that this DX library isn't finished, so it doesn't have all the features that the MTA GUI system has yet.
-
Do you know how Lua is executed? Anything that isn't in a function, event, or timer is executed ONLY ONCE when the script is first ran. Therefore, you need to either set a timer or create another event that changes the playing variable from true to false.
-
it is already set to false in line 1 local playing = false -- set to false function speed() if ( enablelight ) and ( getVehicleOverrideLights ( theVehicle ) ~= 2 ) then dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/2/light.png", 0,0,0, tocolor(255, 255, 255 , 255)) if ( not playing ) then playSound("files/lightswitch.mp3") playing = not playing end else dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/2/light2.png", 0,0,0, tocolor(255, 255, 255 , 255)) end end addEventHandler ( "onClientRender", root, speed ) Well obviously. After the sound is played, it sets playing to true, and it never gets updated again. Somewhere, you need to set playing to false again.
-
You should give more information about your server if you want to attract any players. Any server posting should include extreme details about the server, along with some type of media (videos/images).
-
[quote name=..&G:..]Ok, I did what you said and got this: elseif ( source == Inter.btn.downloadAll ) then for i, v in pairs ( Inter.rows ) do local row = unpack(v) local name = guiGridListGetItemText ( Inter.grid.list, row, 1) local dtxd = Downloader.Mods[ name ].txd local ddff = Downloader.Mods[ name ].dff triggerEvent("startDownloadModSelected", root, dtxd, ddff) Inter.refresh ( ); end The thing is that MTA freezes as it downloads all the mods at the same time. How can I make the mods add to the download at an interval of 5 seconds? What I mean is, how can I get each row at an interval of 5 seconds? I was thinking of setTimer but it doesn't seem to be the right thing to do Yes, you can use setTiemr to do this. Try this: elseif ( source == Inter.btn.downloadAll ) then for i, v in pairs ( Inter.rows ) do setTimer ( function ( v ) local row = unpack(v) local name = guiGridListGetItemText ( Inter.grid.list, row, 1) local dtxd = Downloader.Mods[ name ].txd local ddff = Downloader.Mods[ name ].dff triggerEvent("startDownloadModSelected", root, dtxd, ddff) Inter.refresh ( ); end, (i-1)*5000, 1, v ); end
-
You just put whatever 'v' is equal to in the youtube tags. Eg. this one would be: [youtube ]PDbknDDELqE[ /youtube]
-
It just sounds like you're not replacing the skin properly. Follow the example on EngineLoadTXD page.
-
From the looks of, you're using playSound in an onClientRender event... Therefore, anytime onClientRender is triggered, it's going to play the sound again.
-
It's fine, he obviously a new scripter, don't need to be dramatic about it. The error is becoming the event Paunch is being called from the client script (using triggerServerEvent). To fix this, you need to add the event into the server-side script, using the following functions: - addEvent - addEventHandler
