JoZeFSvK Posted March 26, 2013 Share Posted March 26, 2013 Who know where will problem ? handle = mysql_connect(MYSQL_SERVER,MYSQL_USERNAME,MYSQL_PASSWORD,MYSQL_DB) function unmuteSpammer (serial, account) --if isPlayerMuted(player) then --setPlayerMuted(player, false) --outputChatBox("#41FE5B[!]#84F994 " .. string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") .. " #41FE5Bhas been automatically unmuted!",getRootElement(), 255,0,0,true) --end mysql_query(handle, "UPDATE spamer SET muted = 'false' WHERE spamer.serial = '" .. serial .. "'") end addEvent("onPlayerSpam", true) addEventHandler("onPlayerSpam", getRootElement(), function (action, time, message, reason) if (isPlayerMuted(source) == false) then outputChatBox(message .. " (" .. reason .. ")", getRootElement(), 255,0,0,true) if action == "mute" then local time2 = time * 1000 setPlayerMuted(source, true) --outputChatBox(time2) serialu = serialu + 1 serialy[serialu] = getPlayerSerial(source) local nick = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") setTimer(unmuteSpammer, time2, 1, serialy[serialu], getPlayerAccount(source)) setElementData(source, "muted", true) mysql_query(handle, "INSERT INTO `DM_svr`.`spamer` (`serial`, `muted`) VALUES ('" .. getPlayerSerial(source) .. "', 'true')") elseif action == "ban" then --outputChatBox("Mas ban..") end end end) addCommandHandler("testing", function(player) outputChatBox(tostring(isPlayerMuted(player))) end) addEventHandler("onPlayerJoin", getRootElement(), function () local result = mysql_query(handle,"SELECT * FROM spamer WHERE serial='"..getPlayerSerial(source).."'") --if mysql_result(result,1,1)==login then for i,v in mysql_rows(result) do if (v[1] == getPlayerSerial(source)) and not (v[2] == "false") then setPlayerMuted(source, true) outputChatBox("[!] #FF6F6F" .. string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") .. " #FE4141has been automatically muted!", getRootElement(), 255,0,0,true) end end --end mysql_free_result(result) end) function unmutePlayers () players = getElementsByType("player") for _, player in ipairs(players) do --outputDebugString("unmutePlayers spusteno") local serial = getPlayerSerial(player) if isPlayerMuted(player) then result = mysql_query(handle, "SELECT * FROM spamer WHERE spamer.serial = '" .. serial .. "'") for i,v in mysql_rows(result) do if (v[1] == getPlayerSerial(player)) and (v[2] == "false") then setPlayerMuted(player, false) mysql_query(handle, "DELETE FROM spamer WHERE spamer.serial = '" .. serial .. "'") outputChatBox("#41FE5B[!]#84F994 " .. string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") .. " #41FE5Bhas been automatically unmuted!",getRootElement(), 255,0,0,true) end end end end end setTimer(unmutePlayers, 30000, 0) voice = true function adminChangeVoice (player, cmd) if hasObjectPermissionTo ( player, "command.toggleVoice", false ) then if voice then voice = false outputChatBox("#FE4141[!] Administrator #FF6F6F" .. string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") .. " #FE4141has disabled voice chat!", getRootElement(), 255, 0,0,true) else voice = true outputChatBox("#41FE5B[!] Administrator #84F994" .. string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") .. " #41FE5B has enabled voice chat!", getRootElement(), 255, 0,0,true) end end end addCommandHandler("voice", adminChangeVoice) addEventHandler("onPlayerVoiceStart", getRootElement(), function () if not voice then cancelEvent() return end for i,player in ipairs(getElementsByType("player")) do if tonumber(getElementData(player, "adminlvl")) > 1 then outputChatBox("Player " .. string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") .. " start voice!", player) end end end) function countThat (msg, type) if type == 0 then if string.find(msg, "!count") then setTimer(outputChatBox, 100, 1, "#8ED2FF* " .. getPlayerCount(), root, 255, 0, 0, true) end end end addEventHandler("onPlayerChat", getRootElement(), countThat) Link to comment
GTX Posted March 26, 2013 Share Posted March 26, 2013 Where are the variables of mysql_connect? Also check if it connects; handle = mysql_connect(MYSQL_SERVER,MYSQL_USERNAME,MYSQL_PASSWORD,MYSQL_DB) if handle then outputChatBox"Connected" else outputChatBox"Couldn't connect" end Also, do you have a module installed? Link to comment
ixjf Posted March 26, 2013 Share Posted March 26, 2013 GTX said: Where are the variables of mysql_connect?Also check if it connects; handle = mysql_connect(MYSQL_SERVER,MYSQL_USERNAME,MYSQL_PASSWORD,MYSQL_DB) if handle then outputChatBox"Connected" else outputChatBox"Couldn't connect" end Also, do you have a module installed? It clearly doesn't connect if it's giving error. And obviously he has the module installed otherwise it would throw the error "attempt to call global 'mysql_connect' (a nil value)", unless he has custom MySQL functions (but I doubt it). Link to comment
Recommended Posts