-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
I apologize for double post. I made it working but now it got even worse. I don't know if this is a bug or what. When I fileWrite a meta and do /refreshall, it says: Couldn't parse meta for etc... All I know (for now) meta was converted to UNIX (I'm not sure what is it, but I think it is kind of EOL conversion...). Before it was Dos/Windows. (This 'conversions' can be seen in Notepad++). Wondering now, how to fix that?
-
Thanks 50p but I can't store a string into variable. That's because meta.xml has those " in it. I tried that but it didn't work: if file then fileSetPos(file, 0) local index = 0 while string.char(string.byte(fileRead(file, 1))) ~= ">" do index = index + 1 fileSetPos(file, index) end fileSetPos(file, index) local buffer = fileRead(file, fileGetSize(file)) if buffer then fileClose(file) fileDelete(":"..getResourceName(v).."/".."meta.xml") local newFile = fileCreate(":"..getResourceName(v).."/".."meta.xml") if fileWrite(newFile, "<meta>", "\n<script src=\"common_messages.lua\" type=\"client\"/>", "\n<script src=\"common_messages.lua\" type=\"server\"/>") then end fileSetPos(newFile, fileGetSize(newFile)) if fileWrite(newFile, buffer) then outputChatBox("Done") end end end
-
If so, how? As far as I know, I can't decide where node will be (I want it at the start).
-
How can I write a code with fileSetPos and NOT removing/overwriting further bytes? An example: I have meta.xml: <meta> <file src="gta_tree_palm2.txd" /> <file src="veg_palm02.dff" /> <file src="music.mp3"></file> <script src="client.lua" type="client"></script> <info gamemodes="race" type="map" name="arr" author="t" version="1.0.0"></info> <map src="arr.map" dimension="0"></map> <settings> <setting name="#skins" value='[ "cj" ]'></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#ghostmode" value='[ "true" ]'></setting> <setting name="#time" value="5:20"></setting> <setting name="#vehicleweapons" value='[ "true" ]'></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#weather" value="[ 2 ]"></setting> <setting name="#gravity" value="[ 0.008000 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#respawntime" value="[ 5 ]"></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#duration" value="[ 1800 ]"></setting> <setting name="#respawn" value='[ "none" ]'></setting> </settings> </meta> And I want to put the code below after without removing and <script src="common_messages.lua"/> <script src="common_messages.lua" type="client"/> So, it must look like this: <meta> <script src="common_messages.lua"/> <script src="common_messages.lua" type="client"/> <file src="gta_tree_palm2.txd" /> <file src="veg_palm02.dff" /> <file src="music.mp3"></file> <script src="client.lua" type="client"></script> <info gamemodes="race" type="map" name="arr" author="t" version="1.0.0"></info> <map src="arr.map" dimension="0"></map> <settings> <setting name="#skins" value='[ "cj" ]'></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#ghostmode" value='[ "true" ]'></setting> <setting name="#time" value="5:20"></setting> <setting name="#vehicleweapons" value='[ "true" ]'></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#weather" value="[ 2 ]"></setting> <setting name="#gravity" value="[ 0.008000 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#respawntime" value="[ 5 ]"></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#duration" value="[ 1800 ]"></setting> <setting name="#respawn" value='[ "none" ]'></setting> </settings> </meta> My recent code looks like this: local file = fileOpen(":"..getResourceName(v).."/".."meta.xml") if file then fileSetPos(file, 0) if fileWrite(file, "<meta>", " \n<script src=\"common_messages.lua\" type=\"client\"/>", " \n<script src=\"common_messages.lua\" type=\"server\"/>") then end fileClose(file) end But it overwrites code after tag. (And meta tag itself, but that doesn't matter as I put it in again.) Any idea? Thanks in advance.
-
I wanted to get resource, not text. I was thinking about that too. Thanks, I will try it.
-
Hello. I want to cancel resource's outputChatBox. I tried with onChatMessage but I can't use cancelEvent there. If I try onClientChatMessage, I can't get the resource. Any other idea? Because I want to cancel outputChatBox from another resource/map. There are like 1000 maps and I can't override outputChatBox 1000 times... Thanks in advance.
-
I think this is ridiculous... Why would it cost less? Scripter gave the same amount of time and work to build a gamemode. I doubt you'll get a scripter with your current price.
-
function dxsetText ( ) local text = "" local UP = tonumber ( getElementData ( localPlayer, "level" ) ) or 0 if ( UP == 1 ) then text = " 350" elseif ( UP == 2 ) then text = " 700" elseif ( UP == 3 ) then text = " 1000" elseif ( UP == 4 ) then text = " 2000" elseif ( UP == 5 ) then text = " 3000" elseif ( UP == 6 ) then text = " 4000" elseif ( UP == 7 ) then text = " 6000" elseif ( UP == 8 ) then text = " 8000" elseif ( UP == 9 ) then text = " 10000" elseif ( UP == 10 ) then text = " 12000" elseif ( UP == 11 ) then text = " 14000" elseif ( UP == 12 ) then text = " 16000" elseif ( UP == 13 ) then text = " 18000" elseif ( UP == 14 ) then text = " 20000" elseif ( UP == 15 ) then text = " 25000" elseif ( UP == 16 ) then text = " 30000" elseif ( UP == 17 ) then text = " 35000" elseif ( UP == 18 ) then text = " 40000" elseif ( UP == 19 ) then text = " 45000" elseif ( UP == 20 ) then text = " 50000" end if isElement(GUIEditor_Label[5]) then destroyElement(GUIEditor_Label[5]) end GUIEditor_Label[5] = guiCreateLabel(706,159,63,13,text,false) guiSetFont ( GUIEditor_Label[5], "default-bold-small" ) end addEventHandler ( "onClientResourceStart", resourceRoot, dxsetText ) addEventHandler ( "onClientElementDataChange", localPlayer, function ( dataName ) if ( dataName == "level" ) then dxsetText ( ) end end ) ...
-
Try: local checkX = ( x > sX/4 and x < sX/4+sX/8 ) local checkY = ( y > sY/4 and y < sY/4+sY/8 )
-
Use "player" instead of localPlayer. dxDrawText ( tostring ( getTeamName ( getPlayerTeam ( player ) ) ), team_X, name_Y, team_X * 1.2, name_Y * 1.2, tocolor ( 255, 255, 255, 255 ), 1.0, "bankgothic" )
-
https://luac.multitheftauto.com/api/ --Lua example: local FROM="example.lua" local TO="compiled.lua" fetchRemote( "https://luac.multitheftauto.com/?compile=1&debug=0&blockdecompile=0&encrypt=0", function(data) fileSave(TO,data) end, fileLoad(FROM), true )
-
Hit and Run Let me introduce you to new, fresh scripted game mode, which has gone public and is still in beta. We, MGO, (Multi Gaming Organization) developed it while we were playing on my local server. We tried to make it bugless and we're still checking for any - either minor or big - bug. What actually is Hit&Run? Well, I have no professional explanation for this. When you start the game, it will randomly choose hunter. (Note that hunter is NOT vehicle! Hunter is player, that has Infernus.) The chosen player will hunt other players, tagged with green light (while the hunter has red light). The hunter has a col shape, which is attached to his car. If someone, tagged with green light enters this col shape, he will be tagged with red light and set as hunter, while previous hunter will be tagged with green light. The area is limited within Los Santos. If player leaves Los Santos, count down will start, which will count 10 seconds till his death. Coming soon: - Custom stats system (Money, points, ranks) - Bonus drops (UAV (Runners can be seen on the radar), Speed ups, traps and so on) - More vehicles - More cities - Ability to add custom maps - Ability to change city (e.g: From Los Santos to Las Venturas) Video is coming soon! DOWNLOAD Changelog: Any suggestions, bugs, questions; Post below! And yeah, note that this is still beta. It will be updated!
-
I'm using setControlState for opening the parachute but it doesn't work. It's like: setControlState("fire", true) -- Client sided. But that doesn't work. Why? Is it a MTA bug?
-
There's a setting in race's meta, called "classicchangez". Its value must be true.
-
If you set source, it will be sent only to player who has logged in. Root will send to everyone. I'm sure he wants to send text to all players, not only one.
-
bool triggerClientEvent ( [element sendTo=getRootElement()], string name, element theElement, [arguments...] ) What? "sendTo" argument is optional. And I'm sure he wants to show text to all players.
-
Server: addEventHandler("onPlayerLogin", root, function() triggerClientEvent("loginDraw", source) end ) addEventHandler("onPlayerLogout", root, function() triggerClientEvent("logoutDraw", source) end ) Client: addEvent("loginDraw", true) addEventHandler("loginDraw", root, function() local data = getPlayerName(source).." has logged in!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end ) addEvent("logoutDraw", true) addEventHandler("logoutDraw", root, function() local data = getPlayerName(source).." has logged out!" exports["drawData"]:outputDraw(data, 255, 100, 100, false) end )
-
How can I send a timer (so, I can do getTimerDetails later) from server-side to client-side? At the moment, I'm using this: Server-sided code: function endA() -- Something. end endTimer = setTimer(endA, 60000, 1) if isTimer(endTimer) then -- Success. triggerClientEvent("onTimerRecieve", root, endTimer) end Client-sided code: local endTimer function draw() if isTimer(endTimer) then -- Nothing here. Maybe timer is not timer? local a, b, c = getTimerDetails(endTimer) if a then dxDrawText(a, 10, 10) end end end addEventHandler("onClientRender", root, draw) addEvent("onTimerRecieve", true) addEventHandler("onTimerRecieve", root, function(timer) -- Success till here. outputDebugString(type(timer)) -- Returns: userdata. endTimer = timer end ) The text doesn't draw. Maybe sent timer isn't a timer? Thanks in advance.
-
onClientPedDamage? and playSound
-
Race is using fadeCamera. Use fadeCamera(player, true) to 'disable' black screen.
-
for i, v in ipairs(getElementsByType"sound") do setSoundPaused(v, true) end To enable the sounds again: for i, v in ipairs(getElementsByType"sound") do setSoundPaused(v, false) end
-
Awesum!
-
You could use getPlayerNametagText(player) too.
-
As I said, do the wrappers. Show your code. Did you override addEventHandler too?