Jump to content

SetGroupData


Anubhav

Recommended Posts

Uhmm.. I realy need help now.

The problem is this:

  
setGroupData ( group, "TurfColor", table.concat ( { tostring ( r ), tostring ( g ), tostring ( b ) }, ", " ) ) 
  

When I create a group it works perfect and set it to 255,255,255 but here is its not setting it AT ALL!

Link to comment
  
function changeTurfColor ( r, g, b, group ) 
 if ( not tonumber ( r ) or not tonumber ( g ) or not tonumber ( b ) or not group ) then 
  outputChatBox ( "Invalid input - r"..tostring(r).." | g:"..tostring(g).." | b:"..tostring ( b ).." | group: "..tostring ( group ), source, 255, 0, 0 ) 
 else 
  outputChatBox ( "You have changed the turf color sucessfully!", source, 0, 255, 0 ) 
  setGroupData ( group, "TurfColor", table.concat ( { tostring ( r ), tostring ( g ), tostring ( b ) }, ", " ) ) 
  refreshData(source) 
  return true 
 end  
 return false 
end  
addEvent ( "onClientPlayerChangeTurfColor", true ) 
addEventHandler ( "onClientPlayerChangeTurfColor", root, changeTurfColor ) 
  
  

Link to comment
  
function FILESet(what,to) 
    if what and to then 
        local file = FILEGetFile(what) 
        if file then 
            if fileExists("Data/"..what..".data") then fileClose(file) fileDelete("Data/"..what..".data") end 
            local file = FILEGetFile(what) 
            if file then 
                fileWrite(file,to) 
                fileFlush(file) 
                fileClose(file) 
            end 
        end 
    end 
end 
  

Link to comment
  
function FILEGet(what) 
    if what then 
        local file = FILEGetFile(what) 
        if file then 
            local data 
            while not fileIsEOF(file) do 
                if data then  
                    data = data..fileRead(file, 500) 
                else 
                    data = fileRead(file, 500) 
                end 
            end 
            fileClose(file) 
            -- 
            return data or false  
        end 
    end 
end 
  
  

Link to comment
Checked or it returned the data?

Also, maybe it's better to just to get the file size with fileGetSize and then fileRead.

What do you mean by checked or returned data?

The data doesn't get setted, idk why. When I create the group I use same everything with everything defined! Here still it doesn't work. When I create the group it works PERFECT!

Link to comment

The last script you posted, put an 'outputChatBox' a line before 'return' and check what 'data' output's. If that isn't the problem, then go to the next part until you find what doesn't work properly. It's what I always do, and it always works.

Or someone else have to see what's wrong :roll:

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