Jump to content

commandhandler to add/remove words?


Recommended Posts

  • 1 month later...
I would like to know i its possible to add multiple words in "1" line

for example it will add "Hello world" on the table (so if i do /addword Hello World it will add " hello world" due fact it will only add "hello" now)

try this

function showits(player,cmd,...) 
     message = table.concat({...}," ") 
    triggerClientEvent(player,"showit",player,message) 
end 
addCommandHandler("showit",showits) 
Link to comment

Obviously, because you're iterating through string (which you can't).

function showits(player) 
    if isElement(player) then 
        triggerClientEvent(player,"showit",player,Table) 
    end 
end 
addCommandHandler("showit",showits) 

function addWordToGridList(Table) 
    guiSetVisible(window1,true) 
    for i=1, #Table do 
    local row = guiGridListAddRow(gridlist1)   
    guiGridListSetItemText (gridlist1, row, collumn1,tostring(Table[i]),false, false) 
    end 
end 
addEvent("showit",true) 
addEventHandler("showit",root,addWordToGridList) 

Link to comment

Client:

  
    window1 = guiCreateWindow(471, 219, 200, 210, "Words in randomizer", false) 
    guiWindowSetSizable(window1, false) 
    gridlist1 = guiCreateGridList(16, 50, 167, 146, false, window1) 
    local collumn1 = guiGridListAddColumn(gridlist1, "Name", 0.4)     
    local collumn2 = guiGridListAddColumn(gridlist1, "Words", 0.9)     
  
  
 function addWordToGridList(text) 
    guiWindowSetSizable(window1, false) 
    local row = guiGridListAddRow(gridlist1) 
    guiGridListSetItemText(gridlist1, row,collumn1,getPlayerName(source),false, false) 
    guiGridListSetItemText(gridlist1, row,collumn2,tostring(text),false, false) 
end 
addEvent("showit",true) 
addEventHandler("showit",root,addWordToGridList) 
  

Server:

function showits(player,cmd,...) 
     local ve = {...} 
    if #ve > 0 then 
     message = table.concat(ve," ") 
    triggerClientEvent(player,"showit",player,message) 
    end 
end 
addCommandHandler("showit",showits) 
  

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...