Jump to content

bradio10

Members
  • Posts

    118
  • Joined

  • Last visited

Everything posted by bradio10

  1. Nope, not working. The markers won't appear when I get moved to it. Reason I put it like that is because it works fine without the team, it's just when I put the team, it doesn't work. Is that the reason why? Because if so, then how would I go about setting it out?
  2. Still is not working. If this is ment to fix it, then I have no clue what is going on. Do I have to do anything with the first getPlayerTeam at the part where it starts when the resource starts? function create() local x, y, z = unpack ( locations [ math.random ( #locations ) ] ) if getTeamName (getPlayerTeam(source)) == "Miners" then marker = createMarker (x, y, z, "cylinder", 2, 255, 255, 0, 255) blip = createBlipAttachedTo( marker, 0, 2, 0, 250, 0, 170 ) end end addEventHandler ("onResourceStart", root, create) addEvent ("createLoc", true) addEventHandler ("createLoc", root, create)
  3. Ok, none of those fixed it and Fury, the reason why I have root, is because I am using a table, so if I put the marker name, it comes up with a bad argument. And Samer, the team thing didn't work. So here is my full script. Once this gets fixed, I will then make it abit neater like you said Samer. function giveMoney () cash = math.random (500, 1000) givePlayerMoney (source, cash) outputChatBox ( "You have just received $ " ..cash , source, 0, 255, 0, true) fadeCamera (source, false, 0.8, 0, 0, 0) setTimer ( fadeCamera, 3000, 1, source, true, 1 ) end addEvent ("pay", true) addEventHandler ("pay", root, giveMoney) locations = { {459.93146, 888.78650, -27.64281}, {507.28488, 971.90436, -24.47141}, {664.53302, 721.46564, -4.02670}, } function create() local x, y, z = unpack ( locations [ math.random ( #locations ) ] ) if getTeamName (getPlayerTeam(source)) == "Miners" then marker = createMarker (x, y, z, "cylinder", 2, 255, 255, 0, 255) blip = createBlipAttachedTo( marker, 0, 2, 0, 250, 0, 170 ) end end addEventHandler ("onResourceStart", root, create) addEvent ("createLoc", true) addEventHandler ("createLoc", root, create) function onHit(hitElement) if getElementType(hitElement) =="player" and getTeamName (getPlayerTeam(source)) == "Miners" then triggerEvent ("pay", getRootElement(), onHit) destroyElement (blip) destroyElement (marker) triggerEvent ("createLoc", root, onHit) end end addEventHandler ("onMarkerHit", marker, onHit)
  4. Even with source, it still doesn't work.
  5. Doesn't work. It says bad "player" pointer @ "getPlayerTeam" (1)
  6. Hi guys. I have used this to get my scripting only working for the people in this team and for some reason, it doesn't work and I have no clue why. At time to time, if I change something, somtimes I get a stack overflow Here is the script: Server: locations = { {459.93146, 888.78650, -27.64281}, {507.28488, 971.90436, -24.47141}, {664.53302, 721.46564, -4.02670}, } function create() local x, y, z = unpack ( locations [ math.random ( #locations ) ] ) if getTeamName (getPlayerTeam(thePlayer)) == "Workers" then marker = createMarker (x, y, z, "cylinder", 2, 255, 255, 0, 255) blip = createBlipAttachedTo( marker, 0, 2, 0, 250, 0, 170 ) end end addEventHandler ("onResourceStart", root, create) addEvent ("createLoc", true) addEventHandler ("createLoc", root, create) function onHit() if getTeamName (getPlayerTeam(thePlayer)) == "Workers" then triggerEvent ("pay", getRootElement(), onHit) destroyElement (blip) destroyElement (marker) triggerEvent ("createLoc", root, onHit) end end addEventHandler ("onMarkerHit", root, onHit) And yes, I have created the team, I just at the moment, need to set myself to it via the admin panel. function team() team = createTeam ("Workers", 255, 255, 0) end addEventHandler ("onResourceStart", resourceRoot, team) Thanks.
  7. Nice, I really like these scripts. Simple and quite easy to make. Thanks. The first 2 work fine. A few errors, but most of them still worked. I wasn't able to test the 3rd one because I didn't have a friend with me. Also, with the drop wep script, I found it really annoying because when it creates, it creates right where you are, so I modified it so it creates 3 steps in front of you. function drop( player, cmd, amount) local x,y,z = getElementPosition( player) -- Get player pozition local weapon = getPedWeapon( player ) -- get player weapon local ammo = getPedTotalAmmo( player ) -- get amount of ammo who you have local amount = tonumber(amount) -- get the amount if ammo > amount then -- it look's if player have more ammo of that who he won drop takeWeapon( player, weapon, amount) --take's the ammo for player to create pickup setElementID(createPickup(x,y+3,z,2,weapon,5000,amount),"weaponpickup") -- create's pickup with element id outputChatBox(" You have Droped "..amount.." Ammo for weapon : "..getWeaponNameFromID(weapid).."", player, 200, 100, 0, true) else outputChatBox(" You Don't Have enough Ammo in that weapon to Drop", player, 255, 0, 0, true) end end addCommandHandler("drop",drop) addEventHandler("onPickupHit", root, function ( player ) if getElementID ( source ) == "weaponpickup" then local weapid = getPickupWeapon ( source ) -- get the weapon id after hit on pickup local wepammo = getPickupAmmo ( source ) -- get the weapon ammo after hit on pickup setTimer(destroyElement,50,1,source) -- destroy the pickup after hit outputChatBox(" You pickedup "..wepammo.." Ammo for Weapon ID: "..getWeaponNameFromID(weapid).."", player, 200, 100, 0, true) end end) FYI, the modification was made here: setElementID(createPickup(x,y+3,z,2,weapon,5000,amount),"weaponpickup") -- create's pickup with element id So as you can see, I just added +3 to the y co-ordinate. Also, the outputChatBox where it says how much you have dropped to the player who has dropped the ammo. That didn't work. So I fixed it and here is the fix. outputChatBox(" You have Droped "..amount.." Ammo for weapon : "..getWeaponNameFromID(weapon).."", player, 200, 100, 0, true) The problem was, where I have put weapon in getWeaponNameFromID, you put weapid which is in the next function. Where as in this function, it was named weapon. Thanks and good work.
  8. I love Vortex Servers. Fast User Friendly Cheap and the best thing I love is the multiple locations and my ping My ping on most servers is around 300 But when I host my developing server, I get a ping around 200 because I have it hosted in LA I am from Australia so it is hard to find a good server with a good ping. Thanks Vortex Servers.
  9. Hi. I am looking for a good hosting company with cheap, fastDL, user friendly control panel, maybe free .net domain and all the other good stuff you need. I am located in Victoria, Australia and a good company around anywhere in Australia would be great. What am I gonna use the server for? Well it is gonna be a server I can practice my scripting on, for my friends to make maps and play them, just stuff around on it, make events and have fun. All my friends are located in the same vacinety as me so if I have a great connection, so will they. If there aint any in Australia, then anything closest to Australia would be great. Thanks and I hope to hear from someone soon.
  10. I need help badly. My MTA Map Editor won't let me open a map, make a new one or let me do a test on a map. Any way to fix this? thanks
  11. ok, I will post it next time as a Lua script instead of a code. I used /debugscript 3 in-game and yeh, it came up with faults, but when I tryed to fix the faults by doing what it said, it still was saying that it needed to be fixed still. This also happened with my other script aswell. It was saying for me to put brackets over "local", which I did. Then it said to put either or '..' over "local" aswell. I did but it didn't fix it. So now I am more stuck and to be honest, more confused. If there are any other ways of fixing it like maybe a autocorrect script to put in Notpad ++, that would help me HEAPS. Thanks
  12. Ok, so this wont open the GUI and the map won't load for the gate to be in the location either. Script; function createKeypad local sWidth, sHeight = guiGetScreenSize() local Width,Height = 142,276 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) keypadWindow = guiCreateWindow(X,Y,Width,Height,"Keypad",false) guiWindowSetSizable(keypadWindow,false) keypadButton1 = guiCreateButton(13,68,37,36,"1",false,keypadWindow) keypadButton2 = guiCreateButton(53,68,37,36,"2",false,keypadWindow) keypadButton3 = guiCreateButton(93,68,37,36,"3",false,keypadWindow) keypadButton4 = guiCreateButton(13,108,37,36,"4",false,keypadWindow) keypadButton5 = guiCreateButton(53,108,37,36,"5",false,keypadWindow) keypadButton6 = guiCreateButton(93,108,37,36,"6",false'keypadWindow) keypadButton7 = guiCreateButton(13,148,37,36,"7",false,keypadWindow) keypadButton8 = guiCreateButton(53,148,37,36,"8",false,keypadWindow) keypadButton9 = guiCreateButton(93,148,37,36,"9",false,keypadWindow) keypadButtonAsterix = guiCreateButton(13,188,37,36,"*",false,keypadWindow) keypadButton0 = guiCreateButton(53,188,37.36,"0",false,keypadWindow) keypadButtonHash = guiCreateButton(93,188,37,36,"#",false,keypadWindow) keypadButtonExit = guiCreateButton(13,288,37,36,"Exit",false,keypadWindow) keypadButtonEnter = guiCreateButton(53,288,37,36,"Enter",false,keypadWindow) keypadButtonClear = guiCreateButton(93,288,37,36,"Clear",false,keypadWindow) keypadGridListDisplay = guiCreateGridList(13,25,117,33,false,keypadWindow) guiGridListSetSelectionMode(keypadGridListDisplay,2) guiSetAplpha(keypadGridListDisplay,0.6) keypadLabelDisplay = guiCreateLabel(14,26,115,30,"Enter Keycode.",false,keypadWindow) guiLabelSetColor(keypadLabelDisplay,255,000,000) guiLabelSetVerticalAlign(keypadLabelDisplay,"center") guiLabelSetHorizontalAlign(keypadLabelDisplay,"center",false) guiSetVisible(keypadWindow,false) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),creaeKeypad) function updateDisplay(text) if text then if tonumber(text) or text == "x" or text === "#" then guiSetText(keypadLabelDisplay,guiGetText(keypadLabelDisplay) .. text) else guiSetText(keypadDisplay,text) end else guiSetText(keypadLabelDisplay,"") end end addEventHandler("onClientGUIClick",keypadWindow,processKeypadClicks,true) function processKeypadClicks(button,state) if button == "left" and state == "up" then if getElementType(source) == "gui-button" then triggerEvent("onKeypadButtonClicked",source,getElementData(keypadWindow,"keypadID")) end end end addEvent("onkeypadButtonClicked",false) addEventHandler("onKeypadButtonClicked,rooy, function(keypadID) end ) addEvent("onkeypadButtonClicked",false) addEventHandler("onKeypadButtonClicked",root, function(keypadID) if guiGetText(keypadLabelDisplay) == "Enter Keycode." or guiGetText(keypadLabelDisplay) == "Invalid Keycode." then updateDisplay) end if guiGetText(source) == "Enter" then local code = guiGetText(keypadLabelDisplay) if code then triggerServerEvent("verifyKeypadCode",getLocalPlayer(),code,keypadID) end elseif guiGetText(source) == "Exit" then guiSetVisible(keypadWindow,false) updateDisplay("Enter Keycode.") showcursor(false,false) else updateDisplay(guiGetText(source)) end end ) addEvent("onKeypadVerificationSuccessful",true) addEventHandler("onKeypadVerificationSuccessful",root, function() guiSetVisible(keypadWindow,false) updateDisplay("Enter Keycode.") showcursor(false,false) end ) addEvent("onKeypadVerificationFailed",true) addEventHandler("onKeypadVerificationFailed",root, function() updateDisplay("Invalid Keycode.") end ) addCommandHandler("a51gate",function() guiSetVisible(keypadWindow,true) showCursor(true,true) setElementData(keypadWindow,"keypadID","a51MainGateKeypadCode") end) addEventHandler("onKeypadVerificationSuccessful",root, function(keypadID) local gate = getElementByID(keypadID) if gate then local x = tonumber(getElementData(gate,"newPosX")) local y = tonumber(getElementData(gate,"newPosY")) local z = tonumber(getElementData(gate,"newPosZ")) moveObject(gate,1500,x,y,z) x = tonumber(getELementData(gate,"PosX")) y = tonumber(getElementData(gate,"posY")) z = tonumber(getElementData(gate,"posZ")) setTimer(moveObject,5000,1,gate,1500,x,y,z) end end ) Serverside: local keypadCodes = { ["a51MainGateKeypadCode"]= "4455*#" } addEvent("verifyKeypadCode",true) addEventHandler("verifyKeypadCode",root,function(code,keypadID) if code then if code == keypadCodes[keypadID] then triggerClientEvent(client,"onKeypadVerificationSuccessful",client,keypadID) else triggerClientEvent(client,"onKeypadVerificationFailed",client,keypadID) end end end) Map: <map> <object id="a51MainGateKeypadCode" model="971" posX="96.736" posY="1918.352" posZ="20.694" rotX="0" rotY="0" rotZ="270.40" newPosX="96.751" newPosY="1914.474" newPosZ="20.694" /> </map> Meta: <meta> <script src="keypad.lua" type="client" /> <script src="server.lua" type="server" /> <map src="gate.map" dimension="0"></map> </meta> Any help would be appreciated heaps and I am only a rookie/noob scripter for Lua Thanks heaps
  13. Ok thanks to all the people. This script was the one that teleported me and all I had to do was to fix the numbers on the scripts and now I know what I did worng. I put the addEventHandlers for the buttons in the worng place. Thanks guys.
  14. Ok, thanks, but that didn't work either. I am not sure if I am doing somthing wrong but none of the wiki scripts have worked. Only the scripts I have downloaded from the community page have worked. I must be doing somthing wrong then EDIT: Never mind, it worked. I am a idiot, I still had the numbers in the script that were copyed when I pasted it from here. Anyway thx man. The only thing is, it doesn't teleport me anywhere, it just stays there and nothing happens
  15. You are really talented JR10. I don't know how you do it Thanks man
  16. It didn't work for me. I have done all of the GUI scripts from the Wiki and none have worked for me so far. I have no idea what I am doing wrong
  17. I have made a city teleporter from the wiki. When I type t/teleportme (what the command is as shown in the wiki,) it just shows the cursor and nothing else AKA the GUI. Here is the script and I followed the wiki as well as I can and I can't figure what I did wrong. Here is the code: function createTeleportWindow() local sWdith, sHeight = guiGetScreenSize() local Width,Height = 231,188 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) teleportWindow = guiCreateWindow(X,Y,Width,Height,"City Teleporter",false) guiWindowSetSizeable(teleportWindow,false) teleportLabel = guiCreateLabel(18.23,191,33,"click a button to teleport to that location",false,teleportWindow) guiLabelSetHorizontalAlign(teleportLabel,"center",true) teleportButtonLS = guiCreateButton(18,63,195,35,"Los Santos",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonLS, teleportPlayer, false) teleportButtonSF = guiCreateButton(18,103,195,35,"San Fierro",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonSF, teleportPlayer, false) teleportButtonLV = guiCreateButton(18,143,195,35,"Las Venturas",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonLV, teleportPlayer, false) guiSetVisible(teleportWindow,false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() createTeleportWindow() end ) function openTeleportWindow() guiSetVisible(TeleportWindow,true) showCursor(true,true) end addCommandHandler("teleportme",openTeleportWindow) function teleportPlayer(button,state) if button == "left" and state == "up" then if source == teleportButtonLS then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),1479.6,-1612.8,14.0,0) ouputChatBox("Welcome to Los Santos!") elseif source == teleportButtonSF then tiggerServerEvent("movePlayerToPosition",getLocalPlayer(),-2265.5,534.0,35.0,270) outputChatBox("Welcome to San Fierro!") elseif source == teleportButtonLV then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),2036.9,1545.2,10.8,270) outputChatBox("Welcome to Las Venturas!") end guiSetVisible(teleportWindow, false) showCursor(false) end end And here is the other code that you need aswell (serverside:) function moveThePlayer(x,y,z) if x and y and z and rotation then local skin = getElementModel(client) spawnPlayer(client,x,y,z,rotation,skin) setCameraTarget(client,client) end end addEvent("movePlayerToPosition",true addEventHandler("movePlayerToPosition",root,moveThePlayer) Hope somone can help. Also all of the other wiki GUI tutorials I made aswell didn't work. Thanks, regards, bradio10
×
×
  • Create New...