Jump to content

group sys


Recommended Posts

What exactly do you mean by "groups sys"?

Which is better in terms of lag ?

They are both using the registry.db (SQL) or internal.db (account data) to store the data. Since they are both using the SQLlite database engine there is no difference in terms of lag.

However SQL has a lot more possibilities to manage/sort the data.

Link to comment

Back Guys Can any one see what is the ERORE ?

  
--Client 
  
function findnamee() 
if source == GroupNameButton then 
    GroupName = guiGetText(GroupNameEdit) 
    triggerServerEvent("Make_Group", getLocalPlayer(), GroupName) 
    end 
end 
addEventHandler("onClientGUIClick", getRootElement(), findnamee) 

  
--server 
  
function createSQLOnStart () 
executeSQLCreateTable ( "Groups", "Name , Owner, Admin, Members") 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()),createSQLOnStart ) 
  
function addInfoToSQL(GroupName)     
    local sourcename = getAccountName(getPlayerAccount(source)) 
    local Members = {} 
    table.insert(Members, sourcename) 
    result = executeSQLSelect ( "Groups", "Name", "Name = '" .. GroupName .. "'" ) 
    if ( result == false ) then     
        outputChatBox ( "This is your first time here! Welcome " .. sourcename .. "!", source ) 
        executeSQLInsert ( "Groups", "'" .. GroupName .. "', '".. sourcename.."', 'none','Members'" ) 
    else 
        outputChatBox ( "Some One Use This Group Name !", source ,111,111,0 ) 
        outputChatBox (result, source) 
        outputChatBox (GroupName, source) 
    end 
end 
addEvent( "Make_Group", true ) 
addEventHandler ( "Make_Group", getRootElement(), addInfoToSQL ) 
  

It is just say Some One Use This Group Name !

and i try with 1 mel name But it is just say Some One Use this group name

any one help ?

Link to comment

Try this:

--server 
function createSQLOnStart ( ) 
executeSQLCreateTable ( "Groups", "Name STRING, Owner STRING, Admin STRING, Members INT") 
end 
addEventHandler ( "onResourceStart", resourceRoot, createSQLOnStart ) 
  
function addInfoToSQL ( GroupName ) 
    local sourcename = getAccountName ( getPlayerAccount ( source ) ) 
    local result = executeSQLSelect ( "Groups", "Name", "Name = '" .. GroupName .. "'" ) 
    if ( result == false ) then 
        outputChatBox ( "This is your first time here! Welcome ".. sourcename .."!", source ) 
        executeSQLInsert ( "Groups", "'".. GroupName .."', '".. sourcename .."', 'none','1'" ) 
    else 
        outputChatBox ( "Some One Use This Group Name !", source, 111, 111, 0 ) 
        outputChatBox ( tostring ( result ), source ) 
        outputChatBox ( GroupName, source ) 
    end 
end 
addEvent( "Make_Group", true ) 
addEventHandler ( "Make_Group", getRootElement(), addInfoToSQL ) 

Link to comment
outputChatBox ( tostring ( result ), source ) 

result is a table, you can't make it string.

i think the correct way is:

outputChatBox ( result[1].Owner, source ) 

you can change Owner to another one, if you want to get another value.

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