Jump to content

SetGroupData


Anubhav

Recommended Posts

Posted

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!

Posted
  
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 ) 
  
  

Posted
Lol, are you serious??? There are 804 lines.... Do you think I'll post whole code? Answer is no, If I do also you'll leak them.

I have no need or want for your code as for I could make it myself.

If you're not willing to post your code, we can't help you.

Posted

Where should we know what is the syntax of setGroupData, etc without you posting them?

Don't wait for answers if you don't post the main function that you have the problem with.

Posted
  
function setGroupData(group,data,key) 
    if ( group and data and key ) then 
            return FILESet("MyGroup-##"..group.."-"..data,key) 
    end 
end 
  

Posted
  
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 
  

Posted

Becaude we néed to see this function as well: FILEGetFile(what) , but if we ask you for more then you might think that we're trying to leak... Pm me your code if you want help.

Posted
  
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 
  
  

Posted
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!

Posted

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:

Posted

Woah!

I din't find any error, I outputted whatever it setted. Dude, whatever it setted was right, :o!! That means something is wrong in label coloring or something. I'll surely see it, and reply. Thanks for this TIP, this helped me alot! :)

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