-
Posts
551 -
Joined
-
Last visited
Everything posted by AGENT_STEELMEAT
-
There is no way to define a constant in LUA like you can in C. It's really not necessary. In your case, just do: MySQL_HOST = "localhost" MySQL_USER = "root" MySQL_PASS = "" MySQL_DATA = If you want them to be global to all server or client side scripts in this resource. Since this is MySQL stuff though, your probably only going to need it in this script, so: local MySQL_HOST = "localhost" local MySQL_USER = "root" local MySQL_PASS = "" local MySQL_DATA = would be a better solution.
-
Hop off this guys nuts, he did a good job.
-
I've tested it (in 1.1) and it works just fine.
-
This is what I use in my gamemode: --function to prevent use of certain commands. function filterCommands(command) if(command == "nick") then cancelEvent() outputChatBox("* You can only change your account name via the F1 panel!", source, 255, 0, 0) end if(command == "register") then cancelEvent() outputChatBox("* You can only register an account via the register screen!", source, 255, 0, 0) end end addEventHandler("onPlayerCommand", ROOT, filterCommands) You can adapt that to whatever commands you need.
-
server/mods/deathmatch/internal.db actually. Here is the in-game sqllite browser: https://community.multitheftauto.com/index.php?p= ... ils&id=495
-
Well 2 things: First, the above code will work, but is inefficient. function ResourceStart(name, root) for i, thePlayer in ipairs(getElementsByType("player")) do --You dont need a players table, especially as a global variable. setPlayerNametagShowing(thePlayer, false) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), ResourceStart) --Only run this when THIS resource starts function PlayerJoin() setPlayerNametagShowing(source, false) end addEventHandler("onPlayerJoin", getRootElement(), PlayerJoin) --No need to store the root element, especially as a global variable. Second, this will hide the player's name that is attached to his/her body in-game, not necessarily their blip or name in the freeroam GUI (unless the freeroam gui is scripted to detect if their nametag is showing or not).
-
The event "onPlayerSpawn" defines source as the player who just spawned, and passes it along to player_Spawn (the handler function) automatically. So source is defined automatically.
-
Karlis, that dosent make any sense - source is the player that the blip needs to be hidden from. So you use setElementVisibleTo(blip, source, false).
-
mastermax, sourceP isn't relevant, in fact it was really bad advice. You want to use SOURCE, and it is already defined by the event onPlayerSpawn. Also, for future reference, you need to post ALL of the relevant info (either the entire script or the single function and event).
-
thats the point - source is the player he wants to attatch the blip to, and hide the blip from...
-
Okay, if you are trying to create a single blip that is shown for ALL player EXCEPT for one player, try this. NOTE: this code snippet assumes that source is a player that triggered some event. Whether or not this is what is going in I am unsure since you won't show us your full script. local blip = createBlipAttachedTo (source, 56) --Create the blip - it will be visible for all players.. setElementVisibleTo(blip, source, false ) --Hide the blip. Also, ignore the weird "sourceP" advice - that makes no sense. Also note: this is just a snippet - it wont work just on it's own, so I assume you have this all within a function.
-
Am I missing something about the Free Roam resource?
AGENT_STEELMEAT replied to erichdusk's topic in Scripting
Well, firstly, you shouldnt be merging anything with the freeroam resource. Are you trying to host a game? Try not using "host game" but instead running mtaserver.exe in your MTA directory. You can edit the options by opening mtaserver.conf with notepad(++). Also, make sure you are logged in as an admin. If you haven't, read through the server documentation on the wiki. (https://wiki.multitheftauto.com/wiki/Server_Manual) -
To help you, we need the ENTIRE script (mainly the function and any events that trigger it). Where is sourceP defined?
-
The easiest way by far is to use setElementData, as element data is synced with the client by default. --Create an abstract element for storing info serverside (this has many uses). local infoRoot = createElement("infoRoot", "infoRoot") --Set the variable as element data for the info element serverside. setElementData(infoRoot, "totalPlayers", totalPlayers) --Clientside, retrieve the element by it's ID ("infoRoot") local infoRoot = getElementByID("infoRoot") --Retrieve the data from the element playercount = getElementData(infoRoot, "totalPlayers") Note that you could also use this infoRoot element to store all types of data. Also, as a rule of thumb, if element data dosent need to be synced between server and client, you should set the fourth argument of setElementData to false, to save some bandwidth.
-
There is a LUA decompiler available @ (link removed) , but all function and variable names will be random. It would be best just to re-compile your source after fixing, rather than decompiling, editing, and recompiling, but do as you wish.
-
So, in other words, create a serverside setElementCollisionsEnabled / setElementCollidableWith? Got it. Almost worth waiting for 1.1 tho.
-
is WRONG, it should be .xmls are not scripts, therefore they do not use the script tag. rather, it is a file for the clientside script to read, so it gets the file tag. Only LUA scripts should get the script tag (.lua and .luac).
-
Hey, how can we get in on some of the testing with this resource? Read the release section, but I can never connect. Any expected release date?
-
Hey all, was wondering of anyone had any idea on how to set up "ghostmode" feature for players (rather than vehicles). I tried setElementCollisionsEnabled, and wasn't getting the results I expected. In my last attempt below, I wanted to make a player a "ghost"" to other player when he enters the colshape, and make him normal again when he exits. Any ideas? --[[ SERVERSIDE - not many issues here. ]] local hospitalDoorCuboid = createColRectangle( 115.0, 268.0, 3.0, 3.0) --local hospitalDoorCuboid = createColCubiod( 115.0, 268.0, 1000.0, 3.0, 3.0, 4.0) --Functions to tell the client when it has entered or left the zombie missions area. function doorwayEnter(hitElement, matchingDimension) if getElementType( hitElement ) == "player" then local elementDimension = getElementDimension(hitElement) if (elementDimension == 1008 or elementDimension == 1009 or elementDimension == 1010 or elementDimension == 1011 or elementDimension == 1012) then triggerClientEvent(hitElement, "doorwayStatusChange", hitElement, true) end end end addEventHandler ( "onColShapeHit", hospitalDoorCuboid, doorwayEnter) function doorwayExit(hitElement, matchingDimension) if (getElementType ( hitElement )) == "player" then triggerClientEvent(hitElement, "doorwayStatusChange", hitElement, false) end end addEventHandler ( "onColShapeLeave", hospitalDoorCuboid, doorwayExit) --[[ CLIENTSIDE - Shitstorm begins here. ]] addEvent("doorwayStatusChange", true) --Triggered by above event via server, displays a notification when a player enters or exits the hospital doorway. local localPed = getLocalPlayer() function setElementCollisions(exitOrEnter) --TRUE for has entered, FALSE is exit. if exitOrEnter == true then setElementCollisionsEnabled ( localPed, false ) else if exitOrEnter == false then setElementCollisionsEnabled ( localPed, true ) end end end addEventHandler("doorwayStatusChange", getRootElement(), setElementCollisions) --addEventHandler("doorwayStatusChange", _local, setElementCollisions)
-
Ehm, why not create the marker clientside when the resource starts, then use onClientMarkerHit to show the GUI? Saves bandwidth and works faster. Also, why is myMarker a global variable? No need for that. local myMarker = createMarker (2308.87,-1.91,25.9,"cylinder",1,255,0,0,128) function showGui (hitPlayer, matchingDimension) --gui code here end addEventHandler("onClientMarkerHit",myMarker,showGui)
-
Weather changes ClientSide for ALL PLAYERS (why)
AGENT_STEELMEAT replied to Einheit-101's topic in Scripting
What you would have to do is trigger a client event (via triggerclientevent) for the player who entered the marker, and have his client change the weather and skygradient. -
Even IF San Andreas is all they can manage on their computer, there is no way to get over the fact that the game is 6 or 7 years old now. There are also lots of people that would LOVE to play a MTAIV, even if they only get 15 FPS. Also, the R* multiplayer isn't that great, it dosen't support custom scripting, you can't run your own server, no custom mapping, you can't run your own server, and it's always empty.
-
It may not be so much an issue of MTA being dead, but San Andreas being dead. There really needs to be a push to release MTAIV. Maybe after 1.1 is released the team can shift more of it's resources over to developing MTAIV, beacuse that is the new frontier.
