TrapLord Studios™ Posted July 13, 2013 Posted July 13, 2013 Can someone please help me in making an command , where when it is used, the syntax would be like [text]> , and when you use it, the "Info" Icon/Object is spawned infront of the player who uses the command, and the text would be dx drawn, right above the "Info" Icon/Object. Visit TrapLord Studios™
Moderators IIYAMA Posted July 13, 2013 Moderators Posted July 13, 2013 first code, then help... Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
TrapLord Studios™ Posted July 13, 2013 Author Posted July 13, 2013 Thats it I dont Know what to start with Visit TrapLord Studios™
iMr.3a[Z]eF Posted July 13, 2013 Posted July 13, 2013 So, give him the codes to use -,- addCommandHandler createObject setElementPosition dxDrawText And the rest codes for the above the object someone will help you i forget them. To Visit Us Press Here: mtasa://5.9.206.180:22002
TrapLord Studios™ Posted July 13, 2013 Author Posted July 13, 2013 mysql = exports.mysql local getPlayerName_ = getPlayerName getPlayerName = function( ... ) s = getPlayerName_( ... ) return s and s:gsub( "_", " " ) or s end --/MINFO function adminUncuff(thePlayer, commandName, targetPlayer) if (exports.global:isPlayerAdmin(thePlayer)) then if not (targetPlayer) then outputChatBox("SYNTAX: /" .. commandName .. " [info Text]", thePlayer, 255, 194, 14) end addCommandHandler("minfo", adminminfo, false, false) (Alright I dont know what to do from here ) Visit TrapLord Studios™
iMr.3a[Z]eF Posted July 13, 2013 Posted July 13, 2013 wtf try this local x,y,z = getElementPosition( source ) addCommandHandler( "info", function (thePlayer, commandName, id) if (tonumber(id)) then createObject(id, y, x, z - 1) end end ) To Visit Us Press Here: mtasa://5.9.206.180:22002
iPrestege Posted July 13, 2013 Posted July 13, 2013 wtf try this local x,y,z = getElementPosition( source ) addCommandHandler( "info", function (thePlayer, commandName, id) if (tonumber(id)) then createObject(id, y, x, z - 1) end end ) source is not defined .
iMr.3a[Z]eF Posted July 13, 2013 Posted July 13, 2013 wtf try this local x,y,z = getElementPosition( source ) addCommandHandler( "info", function (thePlayer, commandName, id) if (tonumber(id)) then createObject(id, y, x, z - 1) end end ) source is not defined . Thanks for warn, but are the rest right? local x,y,z = getElementPosition( thePlayer ) addCommandHandler( "info", function (thePlayer, commandName, id) if getElementType(thePlayer) == "player" then if (tonumber(id)) then createObject(id, y, x, z - 1) end end end ) To Visit Us Press Here: mtasa://5.9.206.180:22002
iPrestege Posted July 13, 2013 Posted July 13, 2013 wtf try this local x,y,z = getElementPosition( source ) addCommandHandler( "info", function (thePlayer, commandName, id) if (tonumber(id)) then createObject(id, y, x, z - 1) end end ) source is not defined . Thanks for warn, but are the rest right? local x,y,z = getElementPosition( thePlayer ) addCommandHandler( "info", function (thePlayer, commandName, id) if getElementType(thePlayer) == "player" then if (tonumber(id)) then createObject(id, y, x, z - 1) end end end ) No it's not .
iMr.3a[Z]eF Posted July 13, 2013 Posted July 13, 2013 so fix it To Visit Us Press Here: mtasa://5.9.206.180:22002
TrapLord Studios™ Posted July 22, 2013 Author Posted July 22, 2013 Whats wrong with this? function createinfop(thePlayer, commandName, id) if not dep then outputChatBox("SYNTAX: /" .. commandName .. " [TEXT]", thePlayer, 255, 194, 14) else if (exports.global:isPlayerLeadAdmin(thePlayer)) or exports.global:isPlayerScripter(thePlayer) then local dimension = getElementDimension(thePlayer) local interior = getElementInterior(thePlayer) local x, y, z = getElementPosition(thePlayer) local rotation = getPedRotation(thePlayer) local id = tonumber(id) z = z - 0.3 local id = mysql:query_insert_free("INSERT INTO infopoints SET x='" .. mysql:escape_string(x) .. "', y='" .. mysql:escape_string(y) .. "', z='" .. mysql:escape_string(z) .. "', dimension='" .. mysql:escape_string(dimension) .. "', interior='" .. mysql:escape_string(interior) .. "', rotation='" .. mysql:escape_string(rotation) .. "', `id`='" .. mysql:escape_string(limit) .."'") local x,y,z = getElementPosition( source ) addCommandHandler( "info", function (thePlayer, commandName, id) if (tonumber(id)) then createObject(id, y, x, z - 1) end end ) Visit TrapLord Studios™
Jaysds1 Posted July 22, 2013 Posted July 22, 2013 Things that's wrong or unknown to us: Variable "dep" isn't defined (Line 2) Variable "id" is already defined you can't localize it (Line 11 and Line 14) "source" isn't defined (Line 16) "id" needs to be converted into a number (Line 19) BTW, What are you trying to do in this script? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
TrapLord Studios™ Posted July 29, 2013 Author Posted July 29, 2013 When you use the command, It would spawn the Info Icon infront the player, with dxdrawn text above it Visit TrapLord Studios™
TrapLord Studios™ Posted July 29, 2013 Author Posted July 29, 2013 Note the text above each info icon spawned would be different, as the script would enable the user to input the desired text. Visit TrapLord Studios™
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