-
Posts
730 -
Joined
-
Last visited
-
Days Won
2
Posts posted by koragg
-
-
12 hours ago, zRiaan said:
yes, but I would like to add a modified radar as it worked before I changed the host, now that I have changed my host no radar wants to work, only shaders
Isn't that modified radar made with shaders? Anyway, it's strange how it stopped working... changing host can't have anything to do with the resources.
-
You can use shaders to modify it. Have a look at this and see how it's made: https://community.multitheftauto.com/index.php?p=resources&s=details&id=10225
-
Fixed!! With below code:
addEvent("onMapStarting", true) function onMapStarting() canUsePJsAndLights = true setElementData(resourceRoot, "canUsePJsAndLights", true) for k, s in pairs(getElementsByType("spawnpoint")) do if getElementData(s, "upgrades") or getElementData(s, "paintjob") then canUsePJsAndLights = false setElementData(resourceRoot, "canUsePJsAndLights", false) end end for k, s in pairs(getElementsByType("checkpoint")) do if getElementData(s, "upgrades") or getElementData(s, "paintjob") then canUsePJsAndLights = false setElementData(resourceRoot, "canUsePJsAndLights", false) end end for k, s in pairs(getElementsByType("pickup")) do if getElementData(s, "upgrades") or getElementData(s, "paintjob") then canUsePJsAndLights = false setElementData(resourceRoot, "canUsePJsAndLights", false) end end if canUsePJsAndLights == false then local customLightsRes = getResourceFromName("cr_vehiclelights") if customLightsRes then if getResourceState(customLightsRes) == "running" then return end end setTimer(outputChatBox, 1500, 1, "This map has it's own custom upgrades, paintjobs and vehicle lights are disabled!") end end addEventHandler("onMapStarting", root, onMapStarting)
And whenever I don't want paintjobs (and vehicle lights) to load I just use
if canUsePJsAndLights == false then return end
And for client-side I use the resource's element data which I've set above^.
The problem before was that I didn't know from where that "upgrades" and "paintjob" element data came for checkpoints, spawnpoints and pickups but now I found out that it's there by default in MTA. This made my work super easy Thanks for all the help guys.
- 2
-
This became way too hard Well my paintjobs script works on all vehicles, literally all so editing the dff would be a huge download and i have no Idea how to do this since I've never used zModeler before. I guess I'll just detect if there are .txd and .dff files in the map's folder when a map starts (as @IIYAMA suggested). I can live with no paintjob on default cars if there is a modded one in the map. It's not like there are a lot of maps with custom vehicles which actually contain a switch to another non-modded one.
Edit: line 435 here does that for another server but i still need to figure it out - https://github.com/JarnoVgr/Mr.Green-MTA-Resources/blob/master/resources/[gameplay]/gcshop/modshop/modshop_s.lua
-
2 hours ago, IIYAMA said:
How about starting with the map meta.xml itself?
https://wiki.multitheftauto.com/wiki/Resource:Mapmanager
- onGamemodeMapStart
- function loadMap(startedMap)
https://wiki.multitheftauto.com/wiki/GetResourceName
https://wiki.multitheftauto.com/wiki/XmlLoadFile
https://wiki.multitheftauto.com/wiki/XmlNodeGetChildren
https://wiki.multitheftauto.com/wiki/XmlNodeGetName
Node name: file
Attribute: src
And check for extensions.
Not sure how to check for extentions but also what if the vehicle changes from a pickup or on checkpoint hit? Let's say map starts with a modded Sultan, then there is a pickup or checkpoint and it changes to a not modded Infernus, can I somehow know at any point during the race if the current vehicle is a mod or not?
-
I've seen it been done at one server but even though it's resoures are open-source I found it hard to make it work. Basically I'm looking for a way to see if the currently played map has a custom vehicle model into it. I need this check because I want to disable custom paintjobs/vehicle lights if the player's current vehicle is a modded one (with txd and dff files). Also if the map starts with the modded vehicle but then switches to a normal gtasa vehicle I need paintjobs/lights to work normally. So I'm looking for a way to keep checking if the vehicle is a modded one or not and I'll make it with a setTimer of 50ms. Hope you can help. Merry Christmas to everyone btw
-
You can always simply use "resourceRoot" client side as well instead of that ugly long thing
-
@IIYAMA I'm studying trees in university and I hate it Haven't payed attention to that graph although I've seen it before.
-
Try to set the client event handler for 'root' as well instead of 'resourceRoot'. I had problems if it wasn't root recently.
-
You're welcome.
-
You're welcome
-
You're trying to set position of a string, not of a player. You should put getPlayerFromName (targetPlayerName) instead of targetPlayerName in setElementPosition function.
-
On line 18 put "targetPlayer" instead of "player" in the outputChatBox. My bad.
-
Try to output in chat the content of the account data. Maybe it's not a number?
Do this in a separate function:
function testStuff (player)
local acc = getPlayerAccount (player)
if acc and isGuestAccount (acc) then return end
local data = getAccountData (acc, "Zombie kills")
if data then
outputChatBox (data, player, 255, 0, 0)
end
addCommandHandler ("testdata", testStuff)
Just type "testdata" in chat and tell me what comes up. Server side script btw.
- 1
-
Should work. Try this:
if tonumber(getAccountData(account, "Zombie kills")) < 3000 then
- 1
-
Try this. Not tested though. Server-side:
function changePlayerNick(player, command, target, newNick) local account = getPlayerAccount(player) local accName = getAccountName(account) if account and isGuestAccount(account) then return end if isObjectInACLGroup("user." ..accName, aclGetGroup("Admin")) then if not target or not newNick then outputChatBox("Correct command is /changenick player nick.", player, 255, 0, 0, true) return end local targetPlayer = getPlayerFromPartialName(target) if not targetPlayer then outputChatBox("No such player found.", player, 255, 0, 0, true) return end outputChatBox("You changed #FFFFFF"..getPlayerName(targetPlayer).."#00FF00's nickname to #FFFFFF"..newNick.."#00FF00.", player, 0, 255, 0, true) outputChatBox("Your nickname was changed from #FFFFFF"..getPlayerName(targetPlayer).."#00FF00 to #FFFFFF"..newNick.."#00FF00.", player, 0, 255, 0, true) setPlayerName(targetPlayer, newNick) else outputChatBox("You're not an Admin!", player, 255, 0, 0, true) return end end addCommandHandler("changenick", changePlayerNick) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end
- 1
-
Put this code at the end of the file: https://wiki.multitheftauto.com/wiki/GetPedClothesID
That error means that the function doesn't exist so you should add it as it's a useful function, not mta default one.
-
7 minutes ago, TorNix~|nR said:
is it the same? because I'm using dxDrawImage, not text
Yes it's same for all dxDraw functions.
- 1
-
It's really irritating when i switch to spectating and objects around the target haven't loaded. Would love to make them load faster as well.
- 1
-
Have a look at this tutorial:
It makes things look fine on any resolution. If the first method seems hard for you i posted an easier one as a reply. At least it's easier for me. Good luck!
- 1
-
At first glance I saw that you've made a typo
OnPlayerScreenShot
should be
onPlayerScreenShot
The wiki says
- imageData: A string which contains the JPEG image data. This can be saved with the file functions, or sent to players with triggerClientEvent or even uploaded to a web site.
But it's pretty weird that there isn't any mention of saving a picture in none of the file functions. All of the parameters required are strings so putting the image data instead won't work. I'd also like to know the answer to this since it's something I've never even thought of doing.
5 minutes ago, Salem said:I'm trying to save it directly:
addEvent( "onPlayerScreenShot", true ) addEventHandler ( "onPlayerScreenShot", getRootElement(), function( theResource, status, pixels, timestamp, tag ) if status == "ok" then local iname = tag.."_"..getRealDateTimeNowString(); outputDebugString( "[IMAGE] "..iname ) local newFile = fileCreate( "e:/"..iname..".jpg" ) -- attempt to create a new file if ( newFile ) then -- check if the creation succeeded fileWrite( newFile, "This is a test file!" ) -- write a text line fileClose( newFile ) -- close the file once you're done with it outputDebugString( "[IMAGE] saved." ) else outputDebugString( "[IMAGE] not saved." ) end else outputDebugString( "Image failed by "..tag.." at "..getRealDateTimeNowString() ) end end );
but error 'image not saved' appears.Try without the "e:/" part in fileCreate:
local newFile = fileCreate(iname..".jpg")
But fileWrite's second argument must be a string so I can't see how you'll put the image data there.
-
-
1 hour ago, IIYAMA said:
Then there is no difference I think.
Hm ok then. Btw, does 'removeElementData(source, "data")" do the same thing as 'setElementData(source, "data", nil)' ?
-
3 minutes ago, TorNix~|nR said:
I want when a player join, he can not use the F1 F2 F3, for example all panels
Yeah, that will never work with 'guiSetInputMode'. You'll need to do something like
if getElementData(localPlayer, "LoggedIn") == true then --open panel end
client-side and something like this
function onPlayerJoin() setElementData(source, "LoggedIn", false) end addEventHandler("onPlayerJoin", root, onPlayerJoin) function onPlayerLogin() setElementData(source, "LoggedIn", true) end addEventHandler("onPlayerLogin", root, onPlayerLogin)
server-side. That's what I do and it works for me. Good luck
- 1
SEARCH FOR VEHICLES FROM THE GRIDLIST
in Scripting
Posted · Edited by koragg
You can make both the input text and the thing you're searching for (the result to be found) in small letters by using this: http://www.lua.org/manual/5.1/manual.html#pdf-string.lower
That way it won't matter if you type "Infernus", "infernus", "INFERNUS", "iNfeRnuS" and so on. It will still work and show you the vehicle.