Clydian Posted July 24, 2015 Share Posted July 24, 2015 function removeOOC(text) return text:gsub("%s*%(%(([^)]+)%)%)%s*","") end debugscript3 says that that line return text:gsub("%s*%(%(([^)]+)%)%)%s*","") is the error, why? Link to comment
GTX Posted July 24, 2015 Share Posted July 24, 2015 Looks alright to me. Maybe you didn't pass "text" as string? function removeOOC(text) return tostring(text):gsub("%s*%(%(([^)]+)%)%)%s*","") end Link to comment
novo Posted July 24, 2015 Share Posted July 24, 2015 Looks alright to me. Maybe you didn't pass "text" as string? Indeed, it is in fact working fine here. So yeah, perhaps it is not a string. What is the debug error either way? Link to comment
Clydian Posted July 24, 2015 Author Share Posted July 24, 2015 Looks alright to me. Maybe you didn't pass "text" as string? function removeOOC(text) return tostring(text):gsub("%s*%(%(([^)]+)%)%)%s*","") end Thank you so so much.. oh and theres another problem, posted it yesterday noone helped me.. maybe you have any ideas? function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false) Link to comment
GTX Posted July 24, 2015 Share Posted July 24, 2015 What's the problem? Any error in debugscript? Link to comment
Clydian Posted July 24, 2015 Author Share Posted July 24, 2015 What's the problem? Any error in debugscript? No errors, just simpley dont work, dont know why. Link to comment
GTX Posted July 24, 2015 Share Posted July 24, 2015 That's because the badge number you entered either does not exist or your factions aren't configured correctly. (Is this from Valhalla?) Show me badges table. Also tell me what it outputs: function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then outputChatBox("Badge number does not exist!", thePlayer, 255, 0, 0) return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false) Link to comment
Clydian Posted July 24, 2015 Author Share Posted July 24, 2015 That's because the badge number you entered either does not exist or your factions aren't configured correctly. (Is this from Valhalla?) Show me badges table. Also tell me what it outputs: function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then outputChatBox("Badge number does not exist!", thePlayer, 255, 0, 0) return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false) It outputs nothing, and where should i fint this badge table? Link to comment
GTX Posted July 24, 2015 Share Posted July 24, 2015 It should output something in any case... Any errors in debugscript? Are you sure you're entering the right command? Is resource even started? I need more informations, not just "doesn't work". This should output "test", if it doesn't, then I've no idea. function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) outputChatBox"test" local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then outputChatBox("Badge number does not exist!", thePlayer, 255, 0, 0) return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false) Link to comment
Clydian Posted July 24, 2015 Author Share Posted July 24, 2015 It should output something in any case... Any errors in debugscript? Are you sure you're entering the right command? Is resource even started? I need more informations, not just "doesn't work".This should output "test", if it doesn't, then I've no idea. function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) outputChatBox"test" local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then outputChatBox("Badge number does not exist!", thePlayer, 255, 0, 0) return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false) Well you know what it outputs Link to comment
GTX Posted July 24, 2015 Share Posted July 24, 2015 Your factions aren't configured correctly. Go into your item-system then open g_items.lua. You'll see something like this: { "LSPD badge", "a LSPD badge", {[1] = true}, {0,100,255}, 2} Change that number in "[1] = true" to faction ID you are in. To check in which faction ID you're, do /crun getElementData(getPlayerTeam(localPlayer), "id"). Link to comment
Clydian Posted July 24, 2015 Author Share Posted July 24, 2015 Your factions aren't configured correctly. Go into your item-system then open g_items.lua. You'll see something like this: { "LSPD badge", "a LSPD badge", {[1] = true}, {0,100,255}, 2} Change that number in "[1] = true" to faction ID you are in. To check in which faction ID you're, do /crun getElementData(getPlayerTeam(localPlayer), "id"). OMG THANK YOU!!!!!!! Love you (not in that way). Link to comment
GTX Posted July 24, 2015 Share Posted July 24, 2015 You're welcome Although, some people might say "We do not give support for leaked scripts" but Valhalla is past already... Developers of original Valhalla do not care anymore (or do they?) Link to comment
Clydian Posted July 24, 2015 Author Share Posted July 24, 2015 You're welcome Although, some people might say "We do not give support for leaked scripts" but Valhalla is past already... Developers of original Valhalla do not care anymore (or do they?) Dont think they do, cause i think a looot of peaps use it. They haven't sad any words. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now