Jump to content

Dev

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by Dev

  1. Dev

    if check dont work

    function warpPlayerIntoAndro(hitElement, matchingDimension) outputDebugString("Warp function triggered") local elementType = getElementType(hitElement) if (elementType == "player") then outputDebugString("hitElement verified as a player!") setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11) end end Tell me if the second Debug string comes up. EDIT: Lol, sorry didn't see there were 3 pages.. Delete this
  2. Do you mean ascending order by the creation of account? I believe it will automatically populate in an ascending order if you use an ipairs loop or the one I suggested. I wouldn't call that a very efficient method JR10, because constant server-client calls can result in lag as well as increased bandwidth use, so I'd suggest sending the whole table at once and then using it client side.
  3. Just trying to elaborate what JR10 said, Server Side: -- Server Side function fetchAccounts( ) local accounts = getAccounts() triggerClientEvent(source, "giveAccounts", source, accounts) end addEvent("fetchAccounts", true) addEventHandler("fetchAccounts", true) -- Client Side local gridList -- Lets consider you already have a gridList made function giveAccounts( accounts ) -- Now we'll loop and populate the gridList with account names, -- PS: I don't know the what each index holds in the 'getAccounts()' table, -- so consider the first index to be storing the account name for i = 1, #accounts do local row = guiGridListAddRow(gridList) guiGridListSetItemText(gridList, row, 1, tostring(accounts[i]), false, false) end end addEvent("giveAccounts", true) addEventHandler("giveAccounts", getLocalPlayer(), giveAccounts) If there is any more detail you need, reply back to this topic.
  4. Dev

    RobQuotes

    I am getting the real purpose of this thread now..
  5. That is one bug you cannot fix, in MTA the train will only work with 'setTrainSpeed' if there is any player in syncing range near the train. I made a train resource myself and it was working fabulous until I noticed that as soon as I go far away from it, the train stops moving.
  6. Didn't know MTA supports recording features.
  7. Atleast he'll get the idea of how to do it?
  8. Uhm.. I guess you want to make it like.. after a player dies he can spawn at a hospital or something, try this: function spawnOnDeath( ) outputChatBox("You died, wait 10 seconds until you respawn at the Hospital", source, 255, 255, 0) -- send the notification setTimer(function() -- set the timer for spawning cost = math.random(100, 300) -- cost could be anything from 100 to 300 spawnPlayer(source, 1187.5576171875, -1326.41015625, 13.559711456299, 271, getElementModel(source), 0, 0, getPlayerTeam" class="kw2">getPlayerTeam(source)) -- spawn the player at LS Hospital outputChatBox("The Doctors have treated you, be careful next time. Treatment Cost: ".. tonumber(cost) .. "$", source, 255, 255, 0) -- Money has been taken takePlayerMoney(source, tonumber(cost)) -- take the money end, 10000, 1) end addEventHandler("onPlayerWasted", getRootElement(), spawnOnDeath)
  9. Try this, I believe the reason behind the script not working is because you're calling a function which is below the eventHandler, try this, I am pretty sure it'll work. function spawnTitle() -- a MOTD using dxDraw (this works fine), based on wiki example local screenWidth, screenHeight = guiGetScreenSize() local MOTDText = [[ Welcome to ------! Latest news: - New GUIs are complete and look a lot nicer than the old ones. - Fixed the webadmin stuff for easy administration (by me <!-- s:P --><img src=\"{SMILIES_PATH}/icon_razz.gif\" alt=\":P\" title=\"Razz\" /><!-- s:P --> ). New features will be coming as I have time to add them. Meanwhile, I have decided to enable the freeroam GUI for you convenience. Remember that this is a TEMPORARY luxury! Thank you all for your continued patience while we continue development. ------ ]] 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/4, y/4, screenWidth/2, screenHeight/2, tocolor ( 0, 0, 0, 175 ) ) -- Create our black transparent MOTD background Rectangle. dxDrawText ( "Message of the Day:", x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) -- Create Welcome title. 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 function initiateSpawn() --after player login , this is called addEventHandler("onClientRender", getRootElement(), spawnTitle) --add the MOTD createTeleportWindow() -- add the teleport menu end addEvent("startSpawn", true) -- event that is called by the login addEventHandler("startSpawn", getLocalPlayer(), initiateSpawn) function createTeleportWindow() -- create the spawn menu selectMenu = guiCreateWindow(0, 0.75, 1, 0.25, "Select a City to start!", true) buttonLS = guiCreateButton(0.125, 0.25, 0.25, 0.5, "Los Santos", true, selectMenu) buttonSF = guiCreateButton(0.375, 0.25, 0.25, 0.5, "San Fierro", true, selectMenu) buttonLV = guiCreateButton(0.625, 0.25, 0.25, 0.5, "Las Venturas", true, selectMenu) addEventHandler("onClientGUIClick", root, handleSpawn) 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 removeEventHandler("onClientRender", getRootElement(), spawnTitle) guiSetVisible(selectMenu, false) triggerServerEvent( "spawnMe", getLocalPlayer(), 1) elseif source == buttonSF then removeEventHandler("onClientRender", getRootElement(), spawnTitle) guiSetVisible(selectMenu, false) triggerServerEvent( "spawnMe", getLocalPlayer(), 2) elseif source == buttonLV then removeEventHandler("onClientRender", getRootElement(), spawnTitle) guiSetVisible(selectMenu, false) triggerServerEvent( "spawnMe", getLocalPlayer(), 3) end end end function startNormalPlay() showPlayerHudComponent("ammo", true) showPlayerHudComponent("area_name", true) showPlayerHudComponent("armour", true) showPlayerHudComponent("breath", true) showPlayerHudComponent("clock", true) showPlayerHudComponent("health", true) showPlayerHudComponent("money", true) showPlayerHudComponent("radar", true) showPlayerHudComponent("vehicle_name", true) showPlayerHudComponent("weapon", true) setCameraTarget(getLocalPlayer()) showChat(true) showCursor ( false ) guiSetVisible(selectMenu, false) outputChatBox("test") end addEvent("readyToPlay", true) addEventHandler("readyToPlay", getRootElement(), startNormalPlay)
×
×
  • Create New...