Jump to content

Backsage

Members
  • Posts

    168
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Backsage

  1. How do I send data to other clients via onClientGUIClick? I'm working on a script where I need to send data to other clients for example, the current number of respawns. When I click on a button called "Set Round", it sets data (for example the respawns) but only for the client that clicked that button. I can then use /round5showdx to show some text, but it only shows it to the client that clicked that "Set Round" button. If another client wants to see that text, they have to click "Set Round" as well. As soon as they click it, the text automatically shows up. I get the error The text wasn't showing up because of that error and it spammed my debugscript because of onClientRender. It was trying to send information to the other client, but it couldn't because it was nil and because the other client didn't click the button (setting the data). I don't want that. I want to be able to show the text to other clients with the command. Nvm. I've fixed the bug.
  2. Almost works, except that it shows P1 RP: nil and P2 RP: nil to the other client's screen. Need it to be 0. And the dim == 1 check is to make sure that the text only shows up in that dimension. Edit: I think what I need to do is use onPlayerSpawn server side which will trigger a special event client side that'll add scores and trigger the render. Nvm, I've fixed the bug.
  3. When a client sets the players and then sets/creates the round and then does /round5showdx, it gives me (the admin) an error in the debugscript: And it just spams the debugscript. If that other client was an admin and did /debugscript 3 and me (the admin) did/round5showdx, it would show up in the debugscript. And it doesn't even matter what kind of round the other client side. If someone set a round first, then the text for that round will show up on the other client's screen, even if the other's client's round is different.So it's not showing up because the other client didn't set the round yet. How do I fix this? And Etha, your code didn't work
  4. Yes, they are. It's just, I don't know. It was working a couple days ago.
  5. Hi, today I ran into a problem with dxDrawText again. It shows the text to me, but it's not showing the text to other players! It's doing it again! Client side: function createRound() if (source == SetRoundButton) then if (guiCheckBoxGetSelected(GUIEditor.checkbox[7]) and guiCheckBoxGetSelected(GUIEditor.checkbox[1]) and guiCheckBoxGetSelected(GUIEditor.checkbox[6]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[8]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[5]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[2]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[3]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[4])) then NoTimeLimitNeedsKPToWinNoRespawnLimit = true outputChatBox("You've selected a round with No Time Limit, Needs KP to Win, and no Respawn Limit") -- works elseif (guiCheckBoxGetSelected(GUIEditor.checkbox[7]) and guiCheckBoxGetSelected(GUIEditor.checkbox[4]) and guiCheckBoxGetSelected(GUIEditor.checkbox[6]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[8]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[5]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[2]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[1]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[3])) then NoTimeLimitNeedsDPToWinNoRespawnLimit = true outputChatBox("You've selected a round with No Time Limit, Needs DP to Win, and no Respawn Limit") -- works elseif (guiCheckBoxGetSelected(GUIEditor.checkbox[8]) and guiCheckBoxGetSelected(GUIEditor.checkbox[2]) and guiCheckBoxGetSelected(GUIEditor.checkbox[6]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[7]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[5]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[1]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[3]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[4])) then TimeLimitWhoeverGetsTheMostKPWinsNoRespawnLimit = true outputChatBox("You've selected a round with a Time Limit, whoever gets the most KP wins, and no Respawn Limit") -- works elseif (guiCheckBoxGetSelected(GUIEditor.checkbox[8]) and guiCheckBoxGetSelected(GUIEditor.checkbox[3]) and guiCheckBoxGetSelected(GUIEditor.checkbox[6]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[7]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[5]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[2]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[1]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[4])) then TimeLimitWhoeverGetsTheMostDPWinsNoRespawnLimit = true outputChatBox("You've selected a round with a Time Limit, whoever gets the most DP wins, and no Respawn Limit") -- works elseif (guiCheckBoxGetSelected(GUIEditor.checkbox[8]) and guiCheckBoxGetSelected(GUIEditor.checkbox[6]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[7]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[5]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[2]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[1]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[3]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[4])) then TimeLimitPersonWithTheMostRepawnsLoses = true outputChatBox("You've selected a round with a Time Limit and the person with the most respawns loses") -- works elseif (guiCheckBoxGetSelected(GUIEditor.checkbox[7]) and guiCheckBoxGetSelected(GUIEditor.checkbox[5]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[8]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[6]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[2]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[1]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[3]) and not guiCheckBoxGetSelected(GUIEditor.checkbox[4])) then NoTimeLimitPersonWhoReachesSpecifiedRespawnsLoses = true outputChatBox("You've selected a round with No Time Limit and the person who reaches specified respawns loses") -- works end RoundTimeLimit = tonumber(guiGetText(GUIEditor.edit[1])) RoundRespawnLimit = tonumber(guiGetText(GUIEditor.edit[3])) PaymentsPerKill = tonumber(guiGetText(GUIEditor.edit[4])) NeedsKPToWin = tonumber(guiGetText(GUIEditor.edit[6])) NeedsDPToWin = tonumber(guiGetText(GUIEditor.edit[5])) PlayerTeam1CurrentKP = 0 PlayerTeam2CurrentKP = 0 PlayerTeam1CurrentDP = 0 PlayerTeam2CurrentDP = 0 PlayerTeam1CurrentRespawns = 0 PlayerTeam2CurrentRespawns = 0 end end function round5(attacker) for k, v in ipairs(colshape) do if (isElementWithinColShape(attacker, v) and isElementWithinColShape(source, v)) then playerInCol = true if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(source) == 0 and source == player2) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Player2Killed", getLocalPlayer(), source, cor) elseif (getElementHealth(source) == 0 and source == player) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Player1Killed", getLocalPlayer(), source, cor) end end end end end addEventHandler("onClientPlayerWasted", root, round5) function round5teams(attacker) for k, v in ipairs(colshape) do if (isElementWithinColShape(attacker, v) and isElementWithinColShape(source, v)) then playerInCol = true if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(source) == 0 and getPlayerTeam(source) == team) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Team2Killed", getLocalPlayer(), source, cor) elseif (getElementHealth(source) == 0 and getPlayerTeam(source) == team2) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Team1Killed", getLocalPlayer(), source, cor) end end end end end addEventHandler("onClientPlayerWasted", root, round5teams) function round5alltext() local dim = getElementDimension(localPlayer) for i, v in ipairs (getElementsByType("player")) do if (dim == 1) then dxDrawText("P1 RP: " .. PlayerTeam1CurrentRespawns, 118, 358, 291, 380, tocolor(255, 174, 0, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("P2 RP: " .. PlayerTeam2CurrentRespawns, 767, 358, 940, 380, tocolor(255, 174, 0, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false) end end end function thisistest(score) addEventHandler("onClientRender", root, round5alltext) end addEvent("round5addtext", true) addEventHandler("round5addtext", root, thisistest) function thisistest2() removeEventHandler("onClientRender", root, round5alltext) end addEvent("round5removetext", true) addEventHandler("round5removetext", root, thisistest2) addCommandHandler("showdx", function() local dim = getElementDimension(localPlayer) for i, v in ipairs (getElementsByType("player")) do if (dim == 1) then triggerServerEvent("onRound5ShowText", getLocalPlayer(), PlayerTeam1CurrentRespawns, PlayerTeam2CurrentRespawns) end end end ) addCommandHandler("removedx", function () local dim = getElementDimension(localPlayer) for i, v in ipairs (getElementsByType("player")) do if (dim == 1) then triggerServerEvent("onRound5RemoveText", getLocalPlayer()) end end end ) Server side: function round5AddText(score1, score2) local dim1players = getElementsInDimension("player", 1) for k, v in ipairs (dim1players) do local text1 = "P1 RP: " local text2 = "P2 RP: " triggerClientEvent(v, "round5addtext", v, text1, text2) end end addEvent("onRound5ShowText", true) addEventHandler("onRound5ShowText", root, round5AddText) function round5RemoveText() local dim1players = getElementsInDimension("player", 1) for k, v in ipairs (dim1players) do triggerClientEvent(v, "round5removetext", v) end end addEvent("onRound5RemoveText", true) addEventHandler("onRound5RemoveText", root, round5RemoveText) function getElementsInDimension(theType,dimension) local elementsInDimension = { } for key, value in ipairs(getElementsByType(theType)) do if getElementDimension(value)==dimension then table.insert(elementsInDimension,value) end end return elementsInDimension end function round5spawnplayer(player, cor) local plrSkin = getElementModel(player) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player then setTimer( spawnPlayer, 2000, 1, player, x, y, z, 0, plrSkin, 0, 1) end end addEvent("onRound5Player2Killed", true) addEventHandler("onRound5Player2Killed", root, round5spawnplayer) function round5spawnplayer2(player, cor) local plrSkin = getElementModel(player) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player then setTimer( spawnPlayer, 2000, 1, player, x, y, z, 0, plrSkin, 0, 1) end end addEvent("onRound5Player1Killed", true) addEventHandler("onRound5Player1Killed", root, round5spawnplayer2) function round5spawnplayer3(player, cor) local plrSkin = getElementModel(player) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player then setTimer( spawnPlayer, 2000, 1, player, x, y, z, 0, plrSkin, 0, 1) end end addEvent("onRound5Team2Killed", true) addEventHandler("onRound5Team2Killed", root, round5spawnplayer3) function round5spawnplayer4(player, cor) local plrSkin = getElementModel(player) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player then setTimer( spawnPlayer, 2000, 1, player, x, y, z, 0, plrSkin2, 0, 1) end end addEvent("onRound5Team1Killed", true) addEventHandler("onRound5Team1Killed", root, round5spawnplayer4)
  6. Yeah, I don't know why I'm getting those errors. It still works, so it's obviously getting the coordinates from the cor table. But thanks for your help anyway. EDIT: Not working again. It works for players, but not for players in teams. Client side: function round5() if (getElementDimension(player) == 1 and getElementDimension(player2) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(player2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Player2Killed", getLocalPlayer(), player2, cor) elseif (getElementHealth(player) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Player1Killed", getLocalPlayer(), player, cor) end end for k, v1 in ipairs (teamplayers) do for k, v2 in ipairs (teamplayers2) do if (getElementDimension(v2) == 1 and getElementDimension(v1) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(v2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Team2Killed", getLocalPlayer(), teamplayers2, cor) elseif (getElementHealth(v1) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Team1Killed", getLocalPlayer(), teamplayers, cor) end end end end end end end addEventHandler("onClientPlayerWasted", root, round5) Server side: function round5spawnplayer(player2, cor) local plrSkin = getElementModel(player2) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player2 then setTimer( spawnPlayer, 2000, 1, player2, x, y, z, 0, plrSkin, 0, 1) end end addEvent("onRound5Player2Killed", true) addEventHandler("onRound5Player2Killed", root, round5spawnplayer) function round5spawnplayer2(player, cor) local plrSkin = getElementModel(player) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player then setTimer( spawnPlayer, 2000, 1, player, x, y, z, 0, plrSkin, 0, 1) end end addEvent("onRound5Player1Killed", true) addEventHandler("onRound5Player1Killed", root, round5spawnplayer2) function round5spawnplayer3(teamplayers2, cor) for k, vskin in ipairs (teamplayers2) do local plrSkin2 = getElementModel(vskin) end local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if teamplayers2 then for k, v in ipairs (teamplayers2) do setTimer( spawnPlayer, 2000, 1, v, x, y, z, 0, plrSkin2, 0, 1) end end end addEvent("onRound5Team2Killed", true) addEventHandler("onRound5Team2Killed", root, round5spawnplayer3) function round5spawnplayer4(teamplayers, cor) for k, vskin in ipairs (teamplayers) do local plrSkin2 = getElementModel(vskin) end local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if teamplayers then for k, v in ipairs (teamplayers) do setTimer( spawnPlayer, 2000, 1, v, x, y, z, 0, plrSkin2, 0, 1) end end end addEvent("onRound5Team1Killed", true) addEventHandler("onRound5Team1Killed", root, round5spawnplayer4) Edit: fixed by making the functions seperate. function round5() if (getElementDimension(player) == 1 and getElementDimension(player2) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(player2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Player2Killed", getLocalPlayer(), player2, cor) elseif (getElementHealth(player) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Player1Killed", getLocalPlayer(), player, cor) end end end end addEventHandler("onClientPlayerWasted", root, round5) function round5teams() for k, v1 in ipairs (teamplayers) do for k, v2 in ipairs (teamplayers2) do if (getElementDimension(v2) == 1 and getElementDimension(v1) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(v2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Team2Killed", getLocalPlayer(), teamplayers2, cor) elseif (getElementHealth(v1) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Team1Killed", getLocalPlayer(), teamplayers, cor) end end end end end end addEventHandler("onClientPlayerWasted", root, round5teams)
  7. Hi again. Need a little help. When the mission timer expires, it's supposed to warp me, but it doesn't. I get the errors: [2015-08-09 00:20:58] ERROR: Loading script failed: tdm-panel\server.lua:362: '=' expected near 'local' [2015-08-09 00:21:37] ERROR: Client (Backsage) triggered serverside event onTimerExpired, but event is not added serverside [2015-08-09 00:21:37] ERROR: Client (Backsage) triggered serverside event onTimerExpired2, but event is not added serverside And when I die, I get these errors: [2015-08-09 00:21:46] ERROR: Client (Backsage) triggered serverside event onRound5Player2Killed, but event is not added serverside [2015-08-09 00:21:46] ERROR: Client (Backsage) triggered serverside event onRound5Player1Killed, but event is not added serverside The round5spawnplayer and round5spawnplayer2 are supposed to warp me to a position specified in the table cor, but it doesn't because I get those errors. It seems I don't get those errors when I comment out those functions and the whole script works perfectly again. But now I want it to warp me when I die. Client side: Server side: I don't understand why I'm getting these errors when the events are already added server side. EDIT: I found out why I was getting those errors But now I have a new error. [2015-08-09 00:34:10] WARNING: tdm-panel\server.lua:360: Bad argument @ 'getElementModel' [Expected element at argument 1, got number '0'] [2015-08-09 00:34:10] ERROR: tdm-panel\server.lua:362: attempt to get length of local 'cor' (a nil value) [2015-08-09 00:34:10] WARNING: tdm-panel\server.lua:375: Bad argument @ 'getElementModel' [Expected element at argument 1, got number '0'] [2015-08-09 00:34:10] ERROR: tdm-panel\server.lua:377: attempt to get length of local 'cor' (a nil value) EDIT: All bugs fixed. Everything working perfectly. Thank you!
  8. Thank you GTX! It works!
  9. Thanks so much man, it works. Hopefully, I can apply this to another script I'm working on Edit: One last thing. How can I get this to work based on dimension? I want to be able to remove the text by the command AND based on dimension. It removes the text when I'm not in dimension 1, but I can't get it to remove it on the command. Client side: local score = 0 function hello() local dim = getElementDimension(localPlayer) for i, v in ipairs (getElementsByType("player")) do if (dim == 1) then dxDrawText("Score: " .. tostring(score), 118, 358, 291, 380, tocolor(255, 174, 0, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false) end end end function wepfire() if getElementHealth(source) == 0 then score = score + 3 --addEventHandler("onClientRender", root, hello) end end addEventHandler("onClientPlayerWasted", localPlayer, wepfire) function thisistest(score) addEventHandler("onClientRender", root, function() hello(score) end) end addEvent("justfortest1", true) addEventHandler("justfortest1", root, thisistest) addCommandHandler("removedx", function () local dim = getElementDimension(localPlayer) for i, v in ipairs (getElementsByType("player")) do if (dim == 1) then removeEventHandler("onClientRender", localPlayer, hello) end end end ) addCommandHandler("showdx", function() local dim = getElementDimension(localPlayer) for i, v in ipairs (getElementsByType("player")) do if (dim == 1) then triggerServerEvent("justfortest", getLocalPlayer(), score) end end end ) Server side: function scorehandler(score) local dim1players = getElementsInDimension("player", 1) for k, v in ipairs (dim1players) do text1 = "Score " .. score triggerClientEvent(v, "justfortest1", v, text1) end end addEvent("justfortest", true) addEventHandler("justfortest", root, scorehandler) function getElementsInDimension(theType,dimension) local elementsInDimension = { } for key, value in ipairs(getElementsByType(theType)) do if getElementDimension(value)==dimension then table.insert(elementsInDimension,value) end end return elementsInDimension end
  10. I tried using this function hello2() removeEventHandler("onClientRender", root, hello) end addCommandHandler("removedx", hello2) but it still didn't work.
  11. This won't remove the text. Why? function hello(score) dxDrawText("Score: " .. score, 118, 358, 291, 380, tocolor(255, 174, 0, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false) end score = 0 function wepfire() if getElementHealth(source) == 0 then score = score + 3 addEventHandler("onClientRender", root, function() hello(score) end) end end addEventHandler("onClientPlayerWasted", root, wepfire) addCommandHandler("removedx", function () removeEventHandler("onClientRender", root, hello) end )
  12. How do I make dxDrawText appear on other client's screen? And how can I make sure that it gets removed from other client's screen too?
  13. Hello. I have been banned on irc.mtasa.com for the following channels, #mta, #mta.scripting, and probably some other ones that I don't know of. If this is the right place to post a ban appeal, could I please be unbanned? I don't even know why I was banned. Thanks.
  14. Hello again, I need some help. I won't post the whole code because it's not important. But whenever I click a button called "Set", I get an error: ERROR: teleportscript4\gui2.lua:142:table index is nil and whenever I do I get an error: ERROR:teleportscript3\gui2.lua:155: bad argument #1 to 'insert' (table expected, got nil) Strangely, when I do It works, but I know this can't be the only way of making it work because when I do and It works. So how can I make it work like either of these two solutions?
  15. Edit: I just changed the drive letter and now it works. Don't think it's necessary, but thanks for trying to help.
  16. Hello, guys. I need some help here! When I tried starting MTA 1.4 on my computer, I get this error message: "There is no disk in the drive. Please insert a disk into drive \Device\Hardisk7\DR7." http://i.imgur.com/RRzvHrC.png Any idea on how to fix it?
  17. @CapY I think the memo is called Text Browser, but I may be wrong. If it's not that, then there should have been something called Memo for making memos. EDIT: Text Browser doesn't convert into a GUI Element. Text Edit also doesn't convert into a GUI Element. plainTextEdit converted to a guiCreateEdit and lineEdit converted to a guiCreateMemo. Anyway, I never actually tested the guieditor, but with this Qt to Lua, it may make it easier for me when it comes to scripting GUIs, especially gridlists! /me shurgs. I don't know if guieditor also made GUI lua code. Anything made in C++ must be good. So I'll try it. Thank you for making this.
  18. Solidsnake14, or Castillo, I tried doing what you said, it didn't work for me. MTA wouldn't allow itself to open up on another user because it detected another copy was already running.
  19. Hey guys. I've been trying to follow this tutorial on gridlists: https://wiki.multitheftauto.com/wiki/Sc ... Tutorial_1 There's 3 ways to do it. The first 2 ways that I've done it don't work. It always gives me "Invalid Arguments." But the 3rd method using XML worked. (I'm still very confused on how gridlists work) Anyway, here's the first way: client: server: Second way: client: server: Any help?
  20. Nvm, got it fixed. Didn't even need to export anything.
  21. Hi, there. I need some help. I'm trying to call a function that I exported in another resource (yes, I put it in the meta.xml), but it's not working. I'm always getting a fail. And for some reason, the output isn't appearing in scripts.log, even though I have it set to 3 in mtaserver.config. This code for a resource, let's say it's Resource 1. EDIT: Whoops, nothing to see here. Now what I'm trying to do is call the function 'teamlist' so that it can grab the list of teams and so that the function 'StaffPunch' can execute accordingly. The following code is for Resource 2. EDIT: Whoops, nothing to see here. I don't know what I'm doing wrong. EDIT: I'd also like to add that function teamlist() local teamtype1 = getTeamFromName("Unemployed") local teamtype2 = getTeamFromName("Unoccupied") local teamtype3 = getTeamFromName("Civilian Workers") local teamtype4 = getTeamFromName("Police Service") local teamtype5 = getTeamFromName("Criminals") local teamtype6 = getTeamFromName("Gangsters") local teamtype7 = getTeamFromName("Purple Team") local teamtype8 = getTeamFromName("Pink Team") local teamtype9 = getTeamFromName("Orange Team") local teamtype10 = getTeamFromName("Blue Team") local teamtype11 = getTeamFromName("White Team") local teamtype12 = getTeamFromName("Yellow Team") local teamtype13 = getTeamFromName("Cyan Team") local teamtype14 = getTeamFromName("Gray Team") local teamtype15 = getTeamFromName("Staff Team") local teamtype16 = getTeamFromName("Emergency Services") end addEvent("onTeamList", true) addEventHandler("onTeamList", resourceRoot, teamlist) caused part of my script to not work (Not being able to enter a colshape even when in a certain team).
  22. This tutorial could be a lot better. A lot of the stuff I don't understand because you're not putting the script names/type of scripts next side by side to the code. So it's not exactly clear to me. Also, I don't know if I'm supposed to put the in the meta.xml of the source resource or in the meta.xml of the remote resource.
  23. Backsage

    Team Healthbar

    I think you need to put Team 1 in quotation marks, otherwise, it doesn't read the team. If not that, then "Team 1" probably isn't defined.
  24. Why do I always get table index is nil error, line 21? I had this working previously and now it don't work. function kicknotdueler(source, matchingDimension) local teamtype1 = getTeamFromName("Unemployed") local teamtype2 = getTeamFromName("Unoccupied") local teamtype3 = getTeamFromName("Civilian Workers") local teamtype4 = getTeamFromName("Police Service") local teamtype5 = getTeamFromName("Criminals") local teamtype6 = getTeamFromName("Gangsters") local teamtype7 = getTeamFromName("Duel Team 1") local teamtype8 = getTeamFromName("Duel Team 2") local teamtype9 = getTeamFromName("Duel Team 3") local teamtype10 = getTeamFromName("Duel Team 4") local teamtype11 = getTeamFromName("Duel Team 5") local teamtype12 = getTeamFromName("Duel Team 6") local teamtype13 = getTeamFromName("Duel Team 7") local teamtype14 = getTeamFromName("Duel Team 8") --duelTeamTable = {teamtype7, teamtype8, teamtype9, teamtype10, teamtype11, teamtype12, teamtype13, teamtype14} --normalsTeamTable = {teamtype1, teamtype2, teamtype3, teamtype4, teamtype5, teamtype6} duelTeamTable = {} duelTeamTable[a] = teamtype1, teamtype2, teamtype3, teamtype4, teamtype5, teamtype6 duelTeamTable[b] = teamtype7, teamtype8, teamtype9, teamtype10, teamtype11, teamtype12, teamtype13, teamtype14 --duelTeamTable["tea"] = teamtype1, teamtype2, teamtype3, teamtype4, teamtype5, teamtype6 --duelTeamTable["tea2"] = teamtype7, teamtype8, teamtype9, teamtype10, teamtype11, teamtype12, teamtype13, teamtype14 local team = getPlayerTeam(source) if getElementType ( source ) == "player" then if (team == duelTeamTable[b]) then cancelEvent() setElementDimension (source, 1) elseif (team == duelTeamTable[a]) then setElementPosition ( source, 934.74, 1586.27, -17.50 ) setElementDimension (source, 1) outputChatBox("You are not allowed to be in the arena!", source, 255, 0, 0) else setElementPosition ( source, 934.74, 1586.27, -17.50 ) setElementDimension (source, 1) outputChatBox("You are not allowed to be in the arena!", source, 255, 0, 0) end end end addEventHandler("onColShapeHit", colshape, kicknotdueler) If I set the keys to ["a"] and ["b"] respectively, the script only works if I'm on "Duel Team 1".
  25. Ehh, I tried doing what you posted, but to no avail, I couldn't get the script to work properly. function kicknotdueler(source, matchingDimension) local teamisAllowed = false for numberData, teamData in ipairs(team) do for placeNumber, tableData in ipairs(allowedTeams) do if (getTeamName(teamData) == teamName) then teamIsAllowed = true end end end if getElementType ( source ) == "player" then if (teamisAllowed ~= true) then setElementPosition ( source, 934.74, 1586.27, -17.50 ) setElementDimension (source, 1) outputChatBox("You are not allowed to be in the arena!", source, 255, 0, 0) else -- spawnPlayer(source, 949.14, 1613.63, -22.11, 0, plrSkin, 0, 1) cancelEvent() setElementDimension (source, 1) end end end addEventHandler("onColShapeHit", colshape, kicknotdueler) Even if I was on one of the allowed teams, it still wouldn't let me in the colshape no matter what. Back to square 1
×
×
  • Create New...