FSXTim
Members-
Posts
220 -
Joined
-
Last visited
Everything posted by FSXTim
-
I found a solution! Greets
-
Hello, I got the following error in the serverside script: Bad argument @ 'setElementData' [Expected element at argument 1, got string '0'] (Zeile 5) clientside: function unbannB (state) if state == "left" then if source == GUIEditor_Admin_Button[10] then local nick = guiGetText(GUIEditor_Admin_Edit[9]) triggerServerEvent("unbannP", lp, nick) end end end addEventHandler("onClientGUIClick", getRootElement(), unbannB) serverside: function unbannP (nick) local name = MySQL_GetString("Bann", "user_data", nick) if name then local admin = getPlayerName(source) setElementData(name, "Bann", "0") outputChatBox ("#FFFFFF|INFO| "..admin.." #FF3030hat #FFFFFF"..nick.." #FF3030entbannt!", getRootElement(), 205, 0, 0, true) else local player = source outputChatBox ("Der Spieler existiert nicht!", player, 255, 48, 48) end end addEvent("unbannP", true) addEventHandler ("unbannP", getRootElement(), unbannP) Greets
-
Thank you, it's working now. Greets
-
Error (line 13): Bad argument @ 'setElementData' [expected element at argument one, got nil] function spam(message) local player = source local msg = getElementData(source, "Spam") if message == msg then outputChatBox("Bitte wiederhole dich nicht!", source, 255, 0, 0) cancelEvent() end if isTimer(spamTimer) then killTimer(spamTimer) end spamTimer = setTimer( function() setElementData(source, "Spam", "0") end , 10000, 1, source) setElementData(source, "Spam", message) end addEventHandler("onPlayerChat", getRootElement(), spam) Greets
-
Thank you, it's working now. Greets
-
I have still the same error. What do I have to change? function muteCheck() setTimer( function() playerN = source playerNa = getPlayerName(playerN) if tonumber(getElementData(playerN, "Mute")) > 0 then local muteTime = tonumber(getElementData(playerN, "Mute")) setPlayerMuted(playerN, true) mTime = muteTime*60000 setTimer( function() if getElementData(playerN, "LoggedIn") then setPlayerMuted(playerN, false) outputChatBox("#FFFFFF"..playerNa.." #00CD00kann nun wieder schreiben!", getRootElement(), 0, 205, 0, true) end end , mTime, 1, 0) end end , 50, 1) end
-
Hello, I have a small problem. Error (line 6): Bad argument @ 'getElementData' [expected element at argument one, got nil] function muteCheck() setTimer( function() local player = source local name = getPlayerName(player) if tonumber(getElementData(player, "Mute")) > 0 then local muteTime = tonumber(getElementData(player, "Mute")) setPlayerMuted(player, true) mTime = muteTime*60000 setTimer( function() if getElementData(player, "LoggedIn") then setPlayerMuted(player, false) outputChatBox("#FFFFFF"..name.." #00CD00kann nun wieder schreiben!", getRootElement(), 0, 205, 0, true) end end , mTime, 1, 0) end end , 50, 1) end Greets
-
Thanks you, it's working now. Greets
-
Hello, I have more than 61000 dollars and I type "/givemoney FSXTim 100", but the console says: "You don't have enough money!" (line 9 in the script) function giveMoney(player, command, target, m) local target = getPlayerFromName(target) local money = tonumber(m) if isElement(target) then if tonumber(getElementData(player, "Geld") == money) or tonumber(getElementData(player, "Geld") > money) then setElementData(player, "Geld", getElementData(player, "Geld") - money) setElementData(target, "Geld", getElementData(target, "Geld") + money) else outputChatBox("You don't have enough money!", player, 255, 48, 48) end end end addCommandHandler("givemoney", giveMoney) Greets
-
Thank you, it's working now. Greets
-
Error: Bad argument @ 'guiSetVisible' [expected gui-element at argument 1, got nil] [line 8] images = {} for i, index in ipairs (getElementsByType("player")) do guiCreateStaticImage(650,30 - 15 + 15 * i,18,16, rank, false, gImage["playerList"]) end function iFalse() for i = 1, getPlayerCount() do guiSetVisible(images[i], false) end end addEvent("iFalse", true) addEventHandler("iFalse", getRootElement(), iFalse) function getPlayerCount() return #getElementsByType("player") end Greets
-
Thank you, but now I have another problem. Error: attempt to index global 'images' (a nil value) (line 2) for i, index in ipairs (getElementsByType("player")) do images[i] = guiCreateStaticImage(650,30 - 15 + 15 * i,18,16, "rank/rank.png", false, gImage["playerList"]) end function iFalse() for i = 1, getPlayerCount() do guiSetVisible(images[i], false) end end addEvent("iFalse", true) addEventHandler("iFalse", getRootElement(), iFalse) function getPlayerCount() return #getElementsByType("player") end Greets
-
Could anybody help me, please? Greets
-
Error: 'end' expected (to close 'function' at line 1) near 'setTimer' function getPlayerCount() for i, playerName in ipairs (getElementsByType("player")) do players = players + 1 end return players setTimer( function() players = 0 end , 100, 1) end Greets
-
I want to make all images invisible, but at the moment only one image is invisible. Greets
-
My mistake, I wrote it incorrectly, but I have the same in my script, it doesn't work. Is there a function, to make all the images of a GUI invisible? Greets
-
Hello, I have a problem with my script. i = number of players An example: There are 3 players on the server, than is i = 3. If I type "test", only one of the 3 images is invisible, but I want, that all 3 images are invisible. images = guiCreateStaticImage(650,30 - 15 + 15 * i,18,16, "rank/rank.png", false, gImage["playerList"]) function iFalse() guiSetVisible(images, false) end addCommandHandler("test", iFalse) Is there a function, to make all the images of a GUI invisible? Greets
-
Thanks you, it's working now. Greets
-
Hello, the resource "playerlist" doesn't restart, if somebody join the game. Error: Bad argument @ 'restartResource' function join () local jPlayer = getPlayerName (source) outputChatBox("|INFO| #6495ED"..jPlayer.." #FFFFFFhat German Blue Race betreten.", getRootElement(), 255, 255, 255, true) restartResource(playerlist) end addEventHandler("onPlayerJoin", getRootElement(), join) Greets
-
Thanks, it's working now. Greets
-
Sorry, but what do you exactly mean? Could you give me an example, please? Greets
-
Hallo, I want to kill the timer in this script. But now all the timers of the resource are killed. How can I only kill this one? function spam(message, messageType) local player = source local msg = getElementData(source, "Spam") if message == msg then outputChatBox("Bitte wiederhole dich nicht!", source, 255, 0, 0) cancelEvent() end timers = getTimers(10000) for timerKey, timerValue in ipairs(timers) do killTimer(timerValue) end setTimer( function() setElementData(player, "Spam", "0") end , 10000, 1) setElementData(source, "Spam", message) end addEventHandler("onPlayerChat", getRootElement(), spam) Greets
-
Thank you, but I found another Solution. It works now. Greets
-
If I am alone on my server, this script works perfectly. If another player join, the loop stops, but why? function setZeit() outputChatBox("Test1", getRootElement()) for index, spieler in ipairs (getElementsByType("player")) do outputChatBox("Test2", getRootElement()) if getElementData( spieler, "LoggedIn" ) then outputChatBox("Test3", getRootElement()) setElementData(spieler, "Spielzeit", getElementData(spieler, "Spielzeit") + 1) local result = mysql_query(sqlcon, "UPDATE user_data SET Spielzeit='"..tostring(getElementData(spieler,"Spielzeit")).."' WHERE Username='"..tostring(getElementData(spieler,"Username")).."';") if (result) then mysql_free_result(result) end end end setTimer(setZeit2, 30000, 1) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), setZeit) function setZeit2() setTimer(setZeit, 30000, 1) end Greets
-
No, Renkon. I Want to repeat the loop every minute, so 2x30000=60000 is correct. Greets