Jump to content

Info Marker Script


Recommended Posts

Well I Made This Info Marker Script So When You Enter The Pickup It Tells You What Message Has Been Put Into The Pickup But It Doesnt Work And I Get Bad Argument @ createPickup Line 20 When i do /createinfo Hi But When I Do /createinfo It makes the pickup but no text

infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) 
-- ServerSide! 
function info (thePlayer) 
    outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) 
    cancelEvent() 
end 
addEventHandler ( "onPickupHit", infopoint, info ) 
  
function createinfo(thePlayer, commandName, info) 
    if (exports.global:isPlayerAdmin(thePlayer)) then 
    if not (info) then 
    outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer, 255, 194, 14) 
     
    local x,y,z = getElementPosition(thePlayer) 
    local infopointpickup = createPickup(x, y, z, 3, 1239) 
    local message = table.concat({info}, " ") 
    
    else 
     
    createPickup(x, y, z, 3, 1239) 
    end 
end 
end 
addCommandHandler("createinfo", createinfo) 
  
function infohit(thePlayer, info) 
    local message = table.concat({info}, " ") 
    outputChatBox("" .. message .."",thePlayer) 
    cancelEvent() 
end 
addEventHandler("onPickupHit", getRootElement(), infohit) 

Link to comment
infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) 
    -- ServerSide! 
    function info (thePlayer) 
        outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) 
    end 
    addEventHandler ( "onPickupHit", infopoint, info ) 
      
    function createinfo(thePlayer, commandName, info) 
        if (exports.global:isPlayerAdmin(thePlayer)) then 
        if not (info) then 
        outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer, 255, 194, 14) 
        
        local x,y,z = getElementPosition(thePlayer) 
        local message = table.concat({info}, " ") 
        infopointpickup = createPickup(x, y, z, 3, 1239, 0) 
        setElementData( infopointpickup,"Message", message ) 
        addEventHandler("onPickupHit", infopointpickup, infohit) 
        else 
        createPickup(x, y, z, 3, 1239) 
        end 
    end 
    end 
    addCommandHandler("createinfo", createinfo) 
      
    function infohit(thePlayer) 
        getElementData( infopointpickup,"Message") 
        outputChatBox("" .. message .."",thePlayer) 
    end 

something like that. I didn't test the code. it might have some bugs.

Link to comment
infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) 
    -- ServerSide! 
    function info (thePlayer) 
        outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) 
    end 
    addEventHandler ( "onPickupHit", infopoint, info ) 
      
    function createinfo(thePlayer, commandName, info) 
        if (exports.global:isPlayerAdmin(thePlayer)) then 
        if not (info) then 
        outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer, 255, 194, 14) 
        
        local x,y,z = getElementPosition(thePlayer) 
        local message = table.concat({info}, " ") 
        infopointpickup = createPickup(x, y, z, 3, 1239, 0) 
        setElementData( infopointpickup,"Message", message ) 
        addEventHandler("onPickupHit", infopointpickup, infohit) 
        else 
        createPickup(x, y, z, 3, 1239) 
        end 
    end 
    end 
    addCommandHandler("createinfo", createinfo) 
      
    function infohit(thePlayer) 
        getElementData( infopointpickup,"Message") 
        outputChatBox("" .. message .."",thePlayer) 
    end 

something like that. I didn't test the code. it might have some bugs.

Same Error As I Had Bad Argument Line 19 @ createPickup And The Pickup Doesnt Create, when you do /createinfo Hi but when you do /createinfo it makes the blip and you get unable to concatenate message a nil value because you havent set the message as i did /createinfo

Thanks

Edited by Guest
Link to comment
infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) 
    -- ServerSide! 
    function info (thePlayer) 
        outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) 
    end 
    addEventHandler ( "onPickupHit", infopoint, info ) 
      
    function createinfo(thePlayer, commandName, ...) 
        if info then 
        if (exports.global:isPlayerAdmin(thePlayer)) then 
        local x,y,z = getElementPosition(thePlayer) 
        local message = table.concat({...}, " ") 
        infopointpickup = createPickup(x, y, z, 3, 1239, 1) 
        setElementData( infopointpickup,"Message", message ) 
        addEventHandler("onPickupHit", infopointpickup, infohit) 
        end 
        else 
        outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer) 
        end 
    end 
    addCommandHandler("createinfo", createinfo) 
      
    function infohit(thePlayer) 
        message = getElementData( infopointpickup,"Message") 
        outputChatBox("" .. message .."",thePlayer) 
    end 

Fixed and tested

Link to comment

Thanks Now I Must Find A Way So All The Infopoints I Create Dont Say The Same Text i Guess That Would Be Saving The Text Right?

Would It Be Possible To Do it In A XML Instead Of MYSQL Because Im not The Best At MySQL Scripting, Could I Do it With Functions Like fileCreate, fileOpen And fileWrite

Link to comment
infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) 
    -- ServerSide! 
    function info (thePlayer) 
        outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) 
    end 
    addEventHandler ( "onPickupHit", infopoint, info ) 
      
    function createinfo(thePlayer, commandName, ...) 
        if info then 
        if (exports.global:isPlayerAdmin(thePlayer)) then 
        local x,y,z = getElementPosition(thePlayer) 
        local message = table.concat({...}, " ") 
        infopointpickup = createPickup(x, y, z, 3, 1239, 1) 
        setElementData( infopointpickup,"Message", message ) 
        addEventHandler("onPickupHit", infopointpickup, infohit) 
        end 
        else 
        outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer) 
        end 
    end 
    addCommandHandler("createinfo", createinfo) 
      
    function infohit(thePlayer) 
        message = getElementData( infopointpickup,"Message") 
        outputChatBox("" .. message .."",thePlayer) 
    end 

Fixed and tested

Would This Work?

infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) 
    -- ServerSide! 
    function info (thePlayer) 
        outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) 
        cancelEvent() 
    end 
    addEventHandler ( "onPickupHit", infopoint, info ) 
      
    function createinfo(thePlayer, commandName, ...) 
        if info then 
        if (exports.global:isPlayerAdmin(thePlayer)) then 
        local x,y,z = getElementPosition(thePlayer) 
        local message = table.concat({...}, " ") 
        infopointpickup = createPickup(x, y, z, 3, 1239, 0.1) 
        setElementData( infopointpickup,"Message", message ) 
        addEventHandler("onPickupHit", infopointpickup, infohit) 
        end 
        else 
        outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer) 
        end 
    end 
    addCommandHandler("createinfo", createinfo) 
      
    function infohit(thePlayer) 
        message = getElementData( infopointpickup,"Message") 
        outputChatBox("" .. message .."",thePlayer) 
    end 
    
   function saveinfo() 
   message = getElementData( infopointpickup,"Message") 
       local checksaveinfo = fileCreate("infopoints.xml") 
    if checksaveinfo then 
    fileWrite(checksaveinfo,"Pos=" .. x, y, z .. "Msg=" .. message ..) 
    end 
end 
     

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...