Jump to content

AGENT_STEELMEAT

Members
  • Posts

    551
  • Joined

  • Last visited

Everything posted by AGENT_STEELMEAT

  1. Hi all. I have this script that loads locations from an XML file. Apparently, there is a bad argument at line 3 (xmlRootGetChildren) so it wont return a table, triggering another error (expected tables, got nil). server.lua function getTaxiLocations() local root = getResourceConfig("locations.xml") local taxiNodes = xmlNodeGetChildren(root) for _,node in pairs(taxiNodes) do local atributes = xmlNodeGetAttributes(node) local id = atributes.id local name = atributes.name local price = atributes.price triggerClientEvent ( source, "sendTaxiLocations", source, id, name, price) end xmlUnloadFile(root) end addEvent( "getTaxiLocations", true ) addEventHandler( "getTaxiLocations", getRootElement(), getTaxiLocations) locations.xml <root> <location id="1" name="Some random street" price="10000" posX="2049.38671875" posY="1535.5419921875" posZ="10.671875" /> </root> Any advice would be appreciated. tysm
  2. I was wondering if anyone had any experience using MTA with the Myriad Islands mod? I figured since the game "engine" stays the same that it would be possible to make it work. Also, for reference, here is the MI-SA subforum on GTAFORUMS.com: http://www.gtaforums.com/index.php?showforum=98
  3. I am (heavily) editing a pay'n'spray script, and want to check that a car is not of a certain model. I was hoping I could check it against a table, but I can't seem to come up with the proper syntax. Any help would be appreciated. Here is the code I need help with: --the table local notAllowed = {509, 481, 510, 485, 574, 420, 552, 416, 433, 490, 528, 407, 544, 523, 470, 598, 596, 597, 599, 432, 601, 428, 532, 578, 486, 406] --then, after the source is for sure a car with a ped in it, check it with: if (getElementModel(hitElement) ~= --what goes here? lol --if it is, continue. if not, output a message to the chatbox.
  4. Wouldn't it work if when "onVehicleDamage" I triggered an event that got the status of the tires, and if they were not inflated, inflate them?
  5. There are setVehicleWheelStates and getVehicleWheelStates available serverside.
  6. Version 3 is released, it adds support for preventing vehicle damage.
  7. SUPERSQUIRELL was me getting bored, but the rest of that was the forum interpreting a smiley face I put in the code and trying to convert it into a little smiley face picture. lol thanks.
  8. I have a script that shows a MOTD, then a window with 3 buttons you can click to select a city to spawn in. Right now, I just want them to output to the console so that I know that they are being triggered. I wrote this script, and right now it just isn't triggering the buttons for some reason. Also, I can't lock the window (with guiSetMovable and guiSetSizable) without having the mouse disappear (regardless of whether showCursor() is true or false). Any help would be appreciated. function initiateSpawn() --after player login , this is called addEventHandler("onClientRender", getRootElement(), spawnTitle) --add the MOTD createTeleportWindow() -- add the teleport menu end addEvent("spawnReady", true) -- event that is called by the login addEventHandler("spawnReady", getRootElement(), initiateSpawn) function createTeleportWindow() -- create the spawn menu local selectMenu = guiCreateWindow(0, 0.75, 1, 0.25, "Select a City to start!", true) local buttonLS = guiCreateButton(0.125, 0.25, 0.25, 0.5, "Los Santos", true, selectMenu) local buttonSF = guiCreateButton(0.375, 0.25, 0.25, 0.5, "San Fierro", true, selectMenu) local buttonLV = guiCreateButton(0.625, 0.25, 0.25, 0.5, "Las Venturas", true, selectMenu) addEventHandler("onClientGUIClick", buttonLS, handleSpawn, false) addEventHandler("onClientGUIClick", buttonSF, handleSpawn, false) addEventHandler("onClientGUIClick", buttonLV, handleSpawn, false) showCursor(true) end function handleSpawn(button,state) --handler that is called by the spawn menu if button == "left" and state == "up" then if source == buttonLS then outputConsole("LS Selected.") --testing, but not even this happens. will add the real stuff later. elseif source == buttonSF then outputConsole("SF Selected.") elseif source == buttonLV then outputConsole("LV Selected.") end end end function spawnTitle() -- a MOTD using dxDraw (this works fine), based on wiki example local screenWidth, screenHeight = guiGetScreenSize() local MOTDText = [[ Welcome to SUPERSQUIRELL -- s:D -->! Latest news: -New Login system, MOTD and spawn menu are DONE! -The spawn buttons will be enabled soon, once more of the gamemode is done. -Expect fun gameplay features by the end of the week. **Please disconnect, as there is nothing else to do here at this point. Thank you all for your continued patience while we continue development. -John ([email protected]) ]] local playerName = getPlayerName ( getLocalPlayer() ) -- Get players name. local x,y = guiGetScreenSize() -- Get players resolution. dxDrawText( "Read the MOTD, or select a city to spawn in!", screenWidth/10, screenHeight/10, screenWidth, screenHeight, tocolor ( 0, 255, 255, 255 ), 1.5, "pricedown" ) dxDrawRectangle ( x/3, y/3, x/2, y/2, tocolor ( 0, 0, 0, 150 ) ) -- Create our black transparent MOTD background Rectangle. dxDrawText ( "Welcome " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) -- Create Welcome title. dxDrawText ( "Welcome " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) -- Create Welcome title shadow. dxDrawLine ( x/3.59, y/3.275, x/1.348, y/3.275, tocolor ( 0, 0, 255, 255 ), 2 ) -- Create underline shadow. dxDrawText ( MOTDText, x/3.6, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 1, "clear" ) end
  9. You want to bind the key after the function, and have it trigger an event that starts the countdown.
  10. For your countdown timer, do you want to activate the countdown when a player presses 'o'? That code dosen't look right to me.
  11. How just wondering, how do I stop zombies from spawning within a certain radar area? You might wanna update your wiki info.
  12. Hey Slothman, great script! I am having an error, which I believe to do with setting the zombies' rotation. When I first ran the script with one spawnpoint, it gave no errors, which was cool. I noticed tho, as I added more spawnpoints that are rotated in different directions, I got this error in the debugconsole. Luckily, the zombie still spawned, but I want to clean up this error. The error I get in debugconsole is: ERROR: zombies\zombie_server.lua:141: attempt to perform arithmetic on global 'x' (a boolean value) I am having trouble tracking this down, so I figured I'd come to you. Also, out of curiosity, do you know of a way to make zombie not exit a colshape? It is not a big issue since I will be using it in the Restricted Area base, but I want to isolate the zombie gamemode in that area, so to speak. I do have an idea on how to do this, but wanted your advice. Thanks in advance!
  13. I"m trying to get the slothbots to hunt anyone who is not on their team, but they also attack each other. Here is the script I'm using to create the team and spawn the bots: function createSlothTeam() createTeam("SlothBots") end function commandSpawn() call(getResourceFromName("slothbot"), "spawnBot", 2397, 1954, 6, 0, 183, 0, 0, SlothBots, 30, "hunting") end addCommandHandler("spawnbot", commandSpawn) addEventHandler("onResourceStart", getRootElement(), createSlothTeam) What am I doing wrong?
  14. This easy to use resource will allow you to create a Safe Zone fairly easily, and provide a HUD used to let people know that they are in the Safe Zone. It also makes use of the helpmanager resource, there is a help.xml file with info for users included. Features: -Displays a message whenever someone is in a safezone. -Prevents firing of weapons within a safezone. -Anyone in a safezone is completely invincible. -Vehicles are damageproof (minus the tires) -FIXED IN v4! -You can add more than one safezone, without using multiple copies of the resource. -NEW IN v4! Coming soon: -I need suggestions! Known issues: -If a user glues to a vehicle (with the glue resource) , he/she can fire with the TAB key. Setup Instructions: -Move folder to your server/mods/deathmatch/resources directory. -Modify safezone_server.lua to add safezones (other than the defualt provided). -Start the resource. ("start safezones" in the console) The latest version will be at: https://community.multitheftauto.com/index.php?p= ... ls&id=1568 Any feedback is welcome.
  15. Hey, I'm having trouble getting an indicator to work for a greenzone script. The greenzone itself works well and the actual GUI looks good when brought up with a command, but it refuses to come up when its supposed to. It's not giving any error, so I assume I missed something major. Any help would once again be appreciated. Here is the server-side script: x, y, size = 1844.5594482422, 1375.3376464844, 120 local greenzone = createColRectangle ( 1844.5594482422, 1375.3376464844, 284, 312.22 ) local greenzonemaparea = createRadarArea (1844.5594482422, 1375.3376464844, 284, 312.22, 0, 255, 0, 120) function greenzoneEnter ( thePlayer, matchingDimension ) if getElementType( thePlayer ) ~= "player" then return end triggerClientEvent("zoneEnter", thePlayer) toggleControl ( thePlayer, "fire", false ) toggleControl ( thePlayer, "next_weapon", false ) toggleControl ( thePlayer, "previous_weapon", false ) setPedWeaponSlot ( thePlayer, 0 ) toggleControl ( thePlayer, "aim_weapon", false ) toggleControl ( thePlayer, "vehicle_fire", false ) toggleControl ( thePlayer, "vehicle_secondary_fire", false ) end addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) function greenzoneExit ( thePlayer, matchingDimension ) if getElementType( thePlayer ) ~= "player" then return end triggerClientEvent("zoneExit", thePlayer) toggleControl ( thePlayer, "fire", true ) toggleControl ( thePlayer, "next_weapon", true ) toggleControl ( thePlayer, "previous_weapon", true ) toggleControl ( thePlayer, "aim_weapon", true ) toggleControl ( thePlayer, "vehicle_fire", true ) toggleControl ( thePlayer, "vehicle_secondary_fire", true ) end addEventHandler ( "onColShapeLeave", greenzone, greenzoneExit ) and here is the client-side script: function buildNotice() purpleLabel = guiCreateLabel(0.65, 0, 1, 1, "You are in a Safe Zone.", true) guiSetFont(purpleLabel, "sa-header") guiLabelSetColor(purpleLabel,0,255,0) end addEventHandler("onClientResourceStart", getLocalPlayer(), buildNotice) addEvent("zoneEnter", true) addEventHandler("zoneEnter", getLocalPlayer(), function() guiSetVisible(purpleLabel, true) end ) addEvent("zoneExit", true) addEventHandler("zoneExit", getLocalPlayer(), function() guiSetVisible(purpleLabel, false) end )
  16. Well that makes perfect sense, now I fell a little stupid. Thanks again!
  17. Wow, that was quick. I can sorta see how that worked, but could you maybe explain what was wrong / what it needed? Thanks!
  18. I've been following the GUI tutorial, and am trying to script a very basic login system. I have been trying to link it to the actual accounts system in MTA (like the one /login uses) and am having a lot of issues. So far, I have the login GUI passing the credentials to the server, and the server is able to check if they are valid or not (but not log them in). The big issue is getting it to pass that user along to the joinHandler function, so they can spawn. I can't seem to figure it out, and every solution I've tried has failed miserably. any help is appreciated. core.lua (server) function spawnHandler() local x = 2028 local y = 1545 local z = 11 local r = 270 local s = 167 spawnPlayer(source, x, y, z, r, s) fadeCamera(source, true) setCameraTarget(source, source) end function joinHandler() spawnHandler() newPlayer = getPlayerName(source) outputChatBox("Welcome to John's Test Server, " ..newPlayer.. "!", source, 0, 255, 0, true) outputChatBox( newPlayer.. " has joined the server.", getRootElement(), 255, 0, 0, true) end function quitHandler(quitType) local quittingPlayerName = getPlayerName(source) outputChatBox(quittingPlayerName .. " has left the server [" .. quitType .. "]" ) end addEventHandler("onPlayerQuit", getRootElement(), quitHandler) --addEventHandler("onPlayerJoin", getRootElement(), joinHandler) function loginHandler(username, password) --This is the area where the trouble begins local account = getAccount(username, password) if ( account ~= false ) then outputChatBox("good pass") else outputChatBox ("bad pass") end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler) and here is login.lua (clientside) function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) guiSetVisible(wdwLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createLoginWindow() if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end showCursor(true) guiSetInputEnabled(true) end ) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), username, password, logger) guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else outputChatBox("Please enter a username and password.") end end end
  19. It's not a colshape problem, its a radar area problem.
  20. Looks like I'm on a roll today. I've been looking at different ways to find the nearest ammunation and warp to it, and this is what I've come up with: ammunations = { { 2150.1499023438, 936.83428955078, 10.306272506714 }, { 782.69812011719, 1872.9688720703, 4.4971857070923 }, {-1508.8366699219, 2603.4729003906, 55.322311401367} } function findNearestAmmunation(thePlayer) local nearest = nil local min = 999999 for key,val in pairs(ammunations) do local xx,yy,zz=getElementPosition(thePlayer) local x1=val[1] local y1=val[2] local z1=val[3] local dist = getDistanceBetweenPoints2D(xx,yy,x1,y1) if distthen nearest = val min = dist end end return nearest[1],nearest[2],nearest[3] end addCommandHandler("warp", function() local xx,yy,zz = findNearestAmmunation(source) spawnPlayer(source,xx,yy,zz) end) I get a "attempt to compare boolean with number" error at line 16. I'm totally lost here, I've been working on this for hours. Any help is once again apreciated.
  21. It's gonna be a light purple, and it covers LV. The plan is that anyone that exists that area is immediatley blown up.
  22. I just tested that, and your right, that's the issue. anyway around that?
  23. Hi everyone, I've been trying to draw a purple box around LV with a colshape that kills anyone who tries to leave. The issue I've been having is that whenever I use the createRadarArea function, the box is only shown on the F11 map rather than the small minimap. I've tried scripting it all server-side, client-side, and a combination of both (draw map on client, draw colshape on server and vise-versa). Nothing seems to be working. Here is the code I'm using to draw the actual box on the radar (the colShape works fine, I've left that out). function drawOnRadar() createRadarArea( 886, 679, 2000, 2000, 255, 0, 0, 255, getRootElement()) end addCommandHandler("zone", drawOnRadar) Thanks in advance.
×
×
  • Create New...