Jump to content

Adde

Members
  • Posts

    228
  • Joined

  • Last visited

Everything posted by Adde

  1. Thx for helping, but I used markers instead.
  2. I am using meta in topchat resource and server.lua in another resource, both are running.
  3. Meta: type="script" description="Topchat" version="1.0" /> Server: function respawn() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "HeadAdmin" ) ) then exports["topchat"]:outputTopChat("Respawning ALL empty vehicles In 25 Seconds", 255, 255, 255) setTimer(function () local vehicles = getElementsByType ( "vehicle" ) for k, vehicle in ipairs ( vehicles ) do if checkEmpty( vehicle ) then local seats = getVehicleMaxPassengers(vehicle) resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end end, 25000, 1) end end addEvent( "respawn", true ) addEventHandler( "respawn", getRootElement(), respawn )
  4. if ( "source" == "player" ) then is ment to check if the elemnt that is near the gate is a player. Is it totally wrong? I tried colshapes, I found that in another forum topic but did not work..
  5. Hello, I am thinking of creating a small gatesystem. When the players position is, let´s say less than 10 from the gate, it should move up or down. I can decide that later. And if no one is that, it should be closed. I have already done a part of it. But it complains in debug. 1.bad argument at getElementPosition 2.bad argument at getDistanceBetweenPoints3D 3.a nil value somewhere, didn´t say where. I am using it server side, should it be client side? but this is the script: gate1 = createObject(980, -23, 1423, -23, 0, 0, 94, false) function openclose() if ( "source" == "player" ) then local x, y, z = getElementPosition(source) if ( getDistanceBetweenPoints3D(x, y, z, -23, 1423, -23) <= "20" ) then moveObject(gate1, 2000, -23, 1423, -23 - 4, 0, 0, 94) end end end Anyone got any ideas of why this doesn´t work or how I can make it work. I appreciate if someone helps me. And does anyone know why objects in "moveObject" are turning and twisting when they are being moved? I know that since another script i had with a command instead.
  6. If you're creating the function client-side, then yes, you should use that. If you're making it server-side, then you should switch to "server" instead, or in case both, then "shared". Okay yes ofc i know that i should switch depended on client/server. It still don´t work...
  7. Oh, I read on wiki but I missed that I had to export the function from meta. So I should add this right?:
  8. Hello, I wounder if anyone know what the message in debug means/want to tell me. I don´t understand what I am doing wrong. I am using a topchat script and want to trigger that from another script. I am supposed to trigger this in another script: outputTopChat("Respawning ALL empty vehicles In 25 Seconds", 255, 255, 255) How I added it in another script: exports["topchat"]:outputTopChat("Respawning ALL empty vehicles In 25 Seconds", 255, 255, 255) What it tells me in debug: ERROR: call:failed to call"topchat:outputTopChat"[string"?"]
  9. That´s true Citizen, but didn´t know I could do that tosfera, yes and that was just a random resource I looked in.
  10. Solved the problem. There was a cancelEvent() in the mta resource "playercolors".
  11. Manawydan: but then all blips Will be removed when anyone are more than 300away from someone? Oh forgot that part. It doesn't work at all, it doesn't remove the blip. Nothing in debug.
  12. Hello, I am trying to create a function that removes the blip for the local player when the distance between the players is more than 300. I can´t find out what i am doing wrong help? client function distance300thendestroy() p1x, p1y, p1z = getElementPosition ( source ) p2x, p2y, p2z = getElementPosition ( localPlayer ) local dist = getDistanceBetweenPoints2D ( p1x, p1y, p2x, p2y ) if ( dist >= 300 ) then local attached = getAttachedElements ( source ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then setElementVisibleTo(element, localPlayer, false) end end end end end
  13. Do you think localchat have something to do with the mainchat problem? localchat resource wasn´t the problem either..
  14. I am using zombie resource, but I changed gametype myself to "Zombiehunt 2.3". But can´t be that. Tested stop zombie resource and write in chat, didn´t help.
  15. Nope I changed it so (TEAM) is visible in team chat, and it is still same problem. I can´t find out what´s the problem. The script is perfect and no resource that manage chatBox anyway is running.. function staffchat(message, messageType) if messageType == 0 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("*Staff*"..getPlayerName(source)..": #FFFFFF"..message, root, red, green, blue, true ) end end end addEventHandler("onPlayerChat", getRootElement(), staffchat) function staffchat2(message, messageType) if messageType == 2 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("(TEAM)*Staff*"..getPlayerName(source)..": #FFFFFF"..message, root, red, green, blue, true ) end end end addEventHandler("onPlayerChat", getRootElement(), staffchat2)
  16. Hello, I have this function to set (Staff) infront of the name everytime a HeadAdmin ( atm ) write in chat. The message disappears in teamchat and shows (Staff)NameTag: message, but in mainchat the original and this chat message appears. Why doesn´t cancelEvent() work in mainchat? function staffchat(message, messageType) if messageType == 0 or messageType == 2 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("(Staff)"..getPlayerName(source)..": "..message, root, red, green, blue, true ) end end end addEventHandler("onPlayerChat", getRootElement(), staffchat)
  17. Hello, Iám using getElementHealth in dxDrawText. On the screen I get 93.58926597843859%, how do I remove all numbers after 93,....% and just have 93% ? thankfull for answears
  18. still don´t work.. I did as you said, like this: GUIEditor = { tab = {}, tabpanel = {}, button = {}, label = {}, window = {}, Grid = {} } x, y = guiGetScreenSize() GUIEditor.window[11] = guiCreateWindow(1389/1920*x, 359/1080*y, 475, 506, "Staff panel", false) guiWindowSetSizable(GUIEditor.window[11], false) guiSetVisible(GUIEditor.window[11], false) guiSetProperty(GUIEditor.window[11], "CaptionColour", "FFFF0000") GUIEditor.tabpanel[1] = guiCreateTabPanel(10, 23, 455, 473, false, GUIEditor.window[11]) GUIEditor.tab[11] = guiCreateTab("Players", GUIEditor.tabpanel[1]) GUIEditor.Grid[1] = guiCreateGridList(9, 10, 187, 428, false, GUIEditor.tab[11]) column = guiGridListAddColumn(GUIEditor.Grid[1], "Player Name", 1) row = guiGridListAddRow(GUIEditor.Grid[1]) GUIEditor.button[1] = guiCreateButton(382, 45, 63, 28, "Ban", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(382, 147, 63, 28, "Max Armor", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.button[3] = guiCreateButton(313, 147, 63, 28, "Max Health", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(313, 113, 63, 28, "Spectate", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA") GUIEditor.button[5] = guiCreateButton(382, 113, 63, 28, "Slap! 15", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFAAAAAA") GUIEditor.button[6] = guiCreateButton(313, 79, 63, 28, "Mute", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFAAAAAA") GUIEditor.button[7] = guiCreateButton(382, 79, 63, 28, "Freeze", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA") GUIEditor.button[8] = guiCreateButton(313, 10, 132, 31, "Punish", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFAAAAAA") GUIEditor.button[9] = guiCreateButton(313, 45, 63, 28, "Kick", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[9], "NormalTextColour", "FFAAAAAA") GUIEditor.button[10] = guiCreateButton(382, 411, 63, 27, "Destroy", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[10], "NormalTextColour", "FFAAAAAA") GUIEditor.button[13] = guiCreateButton(313, 411, 63, 27, "Fix", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[13], "NormalTextColour", "FFAAAAAA") GUIEditor.button[11] = guiCreateButton(313, 218, 132, 31, "Warp to player", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[11], "NormalTextColour", "FFAAAAAA") GUIEditor.button[12] = guiCreateButton(313, 181, 132, 31, "Give JetPack", false, GUIEditor.tab[11]) guiSetProperty(GUIEditor.button[12], "NormalTextColour", "FFAAAAAA") GUIEditor.label[1] = guiCreateLabel(201, 10, 78, 17, "Player:", false, GUIEditor.tab[11]) guiLabelSetColor(GUIEditor.label[1], 255, 0, 0) GUIEditor.label[2] = guiCreateLabel(202, 411, 78, 17, "Vehicle:", false, GUIEditor.tab[11]) guiLabelSetColor(GUIEditor.label[2], 255, 0, 0) GUIEditor.label[3] = guiCreateLabel(201, 34, 37, 17, "", false, GUIEditor.tab[11]) GUIEditor.label[4] = guiCreateLabel(201, 51, 37, 18, "", false, GUIEditor.tab[11]) GUIEditor.label[5] = guiCreateLabel(201, 69, 37, 20, "", false, GUIEditor.tab[11]) GUIEditor.label[6] = guiCreateLabel(201, 87, 39, 20, "", false, GUIEditor.tab[11]) GUIEditor.label[7] = guiCreateLabel(201, 255, 10, 15, "", false, GUIEditor.tab[11]) GUIEditor.label[8] = guiCreateLabel(201, 293, 10, 15, "", false, GUIEditor.tab[11]) GUIEditor.label[9] = guiCreateLabel(201, 274, 10, 15, "", false, GUIEditor.tab[11]) GUIEditor.label[11] = guiCreateLabel(201, 331, 46, 15, "", false, GUIEditor.tab[11]) GUIEditor.label[12] = guiCreateLabel(201, 312, 58, 15, "", false, GUIEditor.tab[11]) clientsideResourceStart = function() if column then for id,playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor.Grid[1]) guiGridListSetItemText(GUIEditor.Grid[1], row, column, getPlayerName(playeritem), false, false) end end end addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart ) function Refresh () guiGridListClear ( GUIEditor.Grid[1] ) if column then for id,playeritem in ipairs(getElementsByType("player")) do guiGridListSetItemText(GUIEditor.Grid[1], row, column, getPlayerName(playeritem), false, false) end end end addEventHandler ( "onClientPlayerJoin", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerQuit", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerChangeNick", getRootElement(), Refresh ) function settext( ) if ( guiGridListGetSelectedItem ( GUIEditor.Grid ) ) then local thatPlayer = getPlayerFromName(guiGridListGetItemText (GUIEditor.Grid,guiGridListGetSelectedItem(GUIEditor.Grid),1)) guiSetText(GUIEditor.label[12], "Dimension: " ..getElementDimension(thatPlayer) ) guiSetText(GUIEditor.label[11], "Interior: " ..getElementInterior(thatPlayer) ) local x, y, z = getElementPosition(thatPlayer) guiSetText(GUIEditor.label[9], "X " ..x or N/A ) guiSetText(GUIEditor.label[8], "Y " ..y or N/A ) guiSetText(GUIEditor.label[7], "Z " ..z or N/A ) guiSetText(GUIEditor.label[6], "Money: " ..getPlayerMoney(thatPlayer) ) guiSetText(GUIEditor.label[5], "Team: " ..getPlayerTeam(thatPlayer) ) guiSetText(GUIEditor.label[4], "Armor: " ..getPedArmor(thatPlayer) ) guiSetText(GUIEditor.label[3], "Health: " ..getElementHealth(thatPlayer) ) else guiSetText(GUIEditor.label[12], "Dimension: N/A" ) guiSetText(GUIEditor.label[11], "Interior: N/A" ) guiSetText(GUIEditor.label[9], "X: 0" ) guiSetText(GUIEditor.label[8], "Y: 0" ) guiSetText(GUIEditor.label[7], "Z: 0" ) guiSetText(GUIEditor.label[6], "Money: 0" ) guiSetText(GUIEditor.label[5], "Team: N/A" ) guiSetText(GUIEditor.label[4], "Armor: 0" ) guiSetText(GUIEditor.label[3], "Health: 0" ) end end function punish() if ( guiGridListGetSelectedItem ( GUIEditor.Grid[1] ) ~= -1 ) then local thatPlayer = getPlayerFromName(guiGridListGetItemText (GUIEditor.Grid[1],guiGridListGetSelectedItem(GUIEditor.Grid[1]),1)) triggerServerEvent("punishplayer", localPlayer, thatPlayer) outputChatBox("dhasudil",localPlayer,213,21,165) MissionTimer = exports.missiontimer:createMissionTimer ( 60000*4, true, "%m:%s" , 1000/1920*x, 460/1080*y, true, "default-bold", 3, 255, 10, 10 ) addEventHandler ( "onClientMissionTimerElapsed", getRootElement(), freeFromJail) end end addEventHandler("onClientGuiClick", GUIEditor.button[8], punish) function freeFromJail() if MissionTimer then destroyElement(MissionTimer) outputChatBox("You have been released", getLocalPlayer(), 0, 240, 0) triggerServerEvent("freefrompunishment", localPlayer) end end function kick() if ( guiGridListGetSelectedItem ( GUIEditor.Grid[1] ) ~= -1 ) then local thatPlayer = getPlayerFromName(guiGridListGetItemText (GUIEditor.Grid[1],guiGridListGetSelectedItem(GUIEditor.Grid[1]),1)) triggerServerEvent("kickplayer", localPlayer, thatPlayer ) end end addEventHandler("onClientGuiClick", GUIEditor.button[9], kick) function opendasGUI() if guiGetVisible(GUIEditor.window[11]) then guiSetVisible(GUIEditor.window[11], false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(GUIEditor.window[11], true) showCursor(true) guiSetInputEnabled(true) end end addEvent("showStaffPanel",true) addEventHandler("showStaffPanel", getLocalPlayer(),opendasGUI)
  19. this: client function kick() if ( guiGridListGetSelectedItem ( GUIEditor.Grid ) ~= -1 ) then local thatPlayer = getPlayerFromName(guiGridListGetItemText (GUIEditor.Grid,guiGridListGetSelectedItem(GUIEditor.Grid),1)) triggerServerEvent("kickplayer", localPlayer, thatPlayer ) end end addEventHandler("onClientGuiClick", GUIEditor.button[9], kick) server function kicktheplayer(thePlayer) kickPlayer(thePlayer, source, "You did not follow the rules") outputChatBox(getPlayerName(thePlayer).. " was kicked by " ..getPlayerName(source), root, 255, 0, 0) end addEvent("kickplayer", true) addEventHandler("kickplayer", getRootElement(), kicktheplayer) doesn´t work
  20. Okay, something like this? Bcs this doesn´t work. client function kick() if ( guiGridListGetSelectedItem ( GUIEditor.Grid ) ~= -1 ) then local thatPlayer = getPlayerFromName(guiGridListGetItemText (GUIEditor.Grid,guiGridListGetSelectedItem(GUIEditor.Grid),1)) triggerServerEvent(thatPlayer, "kickplayer", thatPlayer) end end addEventHandler("onClientGuiClick", GUIEditor.button[9], kick) server function kicktheplayer(thePlayer) kickPlayer(thatPlayer, thePlayer, "You did not follow the rules") outputChatBox(getPlayerName(thatPlayer).. " was kicked by " ..getPlayerName(thePlayer), root, 255, 0, 0) end addEvent("kickplayer", true) addEventHandler("kickplayer", getRootElement(), kicktheplayer)
  21. Hello, I have a problem. In my script there is: GUIEditor.Grid = guiCreateGridList(9, 10, 187, 428, false, GUIEditor.tab[11]) column = guiGridListAddColumn(GUIEditor.Grid, "Player Name", 1) row = guiGridListAddRow(GUIEditor.Grid) and function to show nametags there. How should I do if I want to use that targeted player in a function? I am trying with: if ( guiGridListGetSelectedItem ( GUIEditor.Grid ) ~= -1 ) then local thatPlayer = getPlayerFromName ( guiGridListGetItemText ( GUIEditor.Grid, row, column ) ) but it´s not working.. I am not good at gridlists so.. Anyone who can help?
  22. Btw, I don´t remember how I use guiGridListGetSelectedItem to use for players. I found something and tried to code it. Is this right? function kick() if ( guiGridListGetSelectedItem ( GUIEditor.Grid ) ~= -1 ) then local player = getPlayerFromNick ( guiGridListGetItemPlayerName ( GUIEditor.Grid, guiGridListGetSelectedItem( GUIEditor.Grid ), 1 ) ) if ( player ) then triggerServerEvent( player, "kickplayer") end end addEventhandler("onClientGuiClick", GUIEditor.button[5], kick)
  23. oh Thx, works now haha, someone helped you and you helped me
  24. Haha yes hmm, " attempt to index global "GUIEditor_gridlist" (a nil value) " I have changed gridlist name to GUIEditor_gridlist[1] everywere even tried to copy again and change my created gridlist name.
×
×
  • Create New...