MrDante Posted August 17, 2015 Share Posted August 17, 2015 (edited) Well in the line 21 I have this: function show_wanted_players(plr) local c = 0 local cx,cy,cz = getElementPosition(plr) for k,v in pairs(getElementsByType("player")) do local x,y = getWl(v) local px,py,pz = getElementPosition(v) if x > 0 then local dist = getDistanceBetweenPoints3D(px,py,pz, cx,cy,cz) if getElementData(v, "Jailed") == "Yes" then outputChatBox(getPlayerName(v)..": Está com o nivel de procurado: "..round(x, 2).."e o tempo de Violência: ".. round(y, 2)..", Location: "..getZoneName(px,py,pz).." ("..getZoneName(px,py,pz,true)..") "..math.floor(dist).."m", plr, 0, 200, 0) elseif (tonumber(getElementData(v, "violent_seconds")) or 0) > 0 then outputChatBox(getPlayerName(v)..": Está com o nivel de procurado: "..round(x, 2).."e o tempo de Violência: "..round(y, 2)..", Location: " ..getZoneName(px,py,pz).." ("..getZoneName(px,py,pz,true)..") "..math.floor(dist).."m", plr, 200, 0, 0) else outputChatBox(getPlayerName(v)..": Está com o nivel de procurado: "..round(x, 2).."e o tempo de Violência: ".. round(y, 2)..", Visto Cometendo Crime Em: "..getZoneName(px,py,pz).." ("..getZoneName(px,py,pz,true)..") "..math.floor(dist).."m", plr, 255, 100, 0) if showWho ~= true then outputChatBox("#1E90FFVocê está revistando o Jogador #FF0000[ #FFFFFF"..getPlayerName(thePlayer).. outputChatBox(getPlayerName(source).."#1E90FFEstá revistando o jogador #FF0000[ #FFFFFF"..getPlayerName(thePlayer).. end end c = c + 1 end end if c == 0 then outputChatBox("Jogador Limpo!", plr, 255, 100, 0) end end addCommandHandler("revistar", show_wanted_players, setRootElement(), getPlayerFromPartialName) I am a beginner and is giving the error:Unexpected Symbol Near If someone can help me thank you very much Edited August 29, 2015 by Guest Link to comment
Jusonex Posted August 17, 2015 Share Posted August 17, 2015 Add another 'end' above line 306. Also, please use the [lua] BBCode in future instead of posting a screenshot, so that we are able to post an edited version. EDIT: The section for scripting problems can be found here: viewforum.php?f=91 Link to comment
MrDante Posted August 17, 2015 Author Share Posted August 17, 2015 Ok thank you more continues with this problem Link to comment
Jusonex Posted August 18, 2015 Share Posted August 18, 2015 There are several problems: 1.) addCommandHandler("revistar", show_wanted_players, setRootElement(), getPlayerFromPartialName) This line doesn't make sense as addCommandHandler expects the command name as first argument and the function as second argument. The other parameters are not relevant in this context. So it should be as follows: addCommandHandler("revistar", show_wanted_players) 2.) I'm not sure what you want to achieve exactly, but I guess plr should be the player element that was passed through the command. But plr is the player who typed the command here (see addCommandHandler's wiki page) function show_wanted_players(player, cmd, playerName) -- Get the player by partial name local plr = getPlayerFromPartialName(playerName) -- do all the other stuff here 3.) outputChatBox("#1E90FFVocê está revistando o Jogador #FF0000[ #FFFFFF"..getPlayerName(thePlayer).. .. is the string concatenation operator and expects a string at both the right and left. So probably something like this: outputChatBox("#1E90FFVocê está revistando o Jogador #FF0000[ #FFFFFF"..getPlayerName(thePlayer).."]") 4.) Missing ends. Indentation helps here. Fixed and correctly indented version: function show_wanted_players(player, cmd, playerName) local plr = getPlayerFromPartialName(playerName) local c = 0 local cx,cy,cz = getElementPosition(plr) for k,v in pairs(getElementsByType("player")) do local x,y = getWl(v) local px,py,pz = getElementPosition(v) if x > 0 then local dist = getDistanceBetweenPoints3D(px,py,pz, cx,cy,cz) if getElementData(v, "Jailed") == "Yes" then outputChatBox(getPlayerName(v)..": Está com o nivel de procurado: "..round(x, 2).."e o tempo de Violência: ".. round(y, 2)..", Location: "..getZoneName(px,py,pz).." ("..getZoneName(px,py,pz,true)..") "..math.floor(dist).."m", plr, 0, 200, 0) elseif (tonumber(getElementData(v, "violent_seconds")) or 0) > 0 then outputChatBox(getPlayerName(v)..": Está com o nivel de procurado: "..round(x, 2).."e o tempo de Violência: "..round(y, 2)..", Location: " ..getZoneName(px,py,pz).." ("..getZoneName(px,py,pz,true)..") "..math.floor(dist).."m", plr, 200, 0, 0) else outputChatBox(getPlayerName(v)..": Está com o nivel de procurado: "..round(x, 2).."e o tempo de Violência: ".. round(y, 2)..", Visto Cometendo Crime Em: "..getZoneName(px,py,pz).." ("..getZoneName(px,py,pz,true)..") "..math.floor(dist).."m", plr, 255, 100, 0) end if showWho ~= true then outputChatBox("#1E90FFVocê está revistando o Jogador #FF0000[ #FFFFFF"..getPlayerName(thePlayer).."]") outputChatBox(getPlayerName(source).."#1E90FFEstá revistando o jogador #FF0000[ #FFFFFF"..getPlayerName(thePlayer).."]") end end c = c + 1 end if c == 0 then outputChatBox("Jogador Limpo!", plr, 255, 100, 0) end end addCommandHandler("revistar", show_wanted_players) Link to comment
MrDante Posted August 19, 2015 Author Share Posted August 19, 2015 Oh... thank you, i am new to scripting, and did not realize it, finally forced 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