Jump to content

Why not working this script? What wrong?


Turbe$Z

Recommended Posts

function addToGroup( group )  
    group = aclGetGroup( group )
    if group == false or group == nil then
        error( "The value of the 'group' is nil or false !" )
    end
    account = getPlayerAccount( source )
    if not isGuestAccount( account ) then
        local name = getAccountName( account )
        local add = aclGroupAddObject( group, "user."..name )
		if getPlayerMoney(source) >= 2500 then
        elseif add then
            outputChatBox( "Színesen írsz, amíg turbesz el nem veszi.", root, 0, 255, 0, true )
            triggerClientEvent( source, "hideall", source )
			takePlayerMoney ( source, 2000 )
		else
			outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
		end
    else
        outputChatBox( "Regisztrálj, és jelentkezz be.", source, 255, 0, 0, true )
    end
end
addEvent( "addToGroup", true )
addEventHandler( "addToGroup", root, addToGroup )

 

  • Like 1
Link to comment

I didn't understand that language, so i made a little help on the 'Syntax'

function addToGroup( group )  
    group = aclGetGroup( group )
    if group == false or group == nil then
        error( "The value of the 'group' is nil or false !" )
    end
    account = getPlayerAccount( source )
    if not isGuestAccount( account ) then
        local name = getAccountName( account )
        local add = aclGroupAddObject( group, "user."..name )
		if getPlayerMoney(source) >= 2500 then
			if add then
				outputChatBox( "Színesen írsz, amíg turbesz el nem veszi.", root, 0, 255, 0, true )
				triggerClientEvent( source, "hideall", source )
				takePlayerMoney ( source, 2000 )
			else
				-- error on add to group
			end
		else
			outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
		end
    else
        outputChatBox( "Regisztrálj, és jelentkezz be.", source, 255, 0, 0, true )
    end
end
addEvent( "addToGroup", true )
addEventHandler( "addToGroup", root, addToGroup )

make sure that the 'error' variable is declared.

Edited by 3NAD
Link to comment
5 minutes ago, 3NAD said:

I didn't understand that language, so i made a little help on the 'Syntax'


function addToGroup( group )  
    group = aclGetGroup( group )
    if group == false or group == nil then
        error( "The value of the 'group' is nil or false !" )
    end
    account = getPlayerAccount( source )
    if not isGuestAccount( account ) then
        local name = getAccountName( account )
        local add = aclGroupAddObject( group, "user."..name )
		if getPlayerMoney(source) >= 2500 then
			if add then
				outputChatBox( "Színesen írsz, amíg turbesz el nem veszi.", root, 0, 255, 0, true )
				triggerClientEvent( source, "hideall", source )
				takePlayerMoney ( source, 2000 )
			else
				-- error on add to group
			end
		else
			outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
		end
    else
        outputChatBox( "Regisztrálj, és jelentkezz be.", source, 255, 0, 0, true )
    end
end
addEvent( "addToGroup", true )
addEventHandler( "addToGroup", root, addToGroup )

make sure that the 'error' variable is declared.

i tried this, but outputchatbox is work fine, but add me to group, with 0$ :/

  • Like 1
Link to comment

what about this my friend;

function addToGroup( group )  
    group = aclGetGroup( group )
    if group == false or group == nil then
        error( "The value of the 'group' is nil or false !" )
    end
    account = getPlayerAccount( source )
    if not isGuestAccount( account ) then
        local name = getAccountName( account )
		if getPlayerMoney(source) >= 2500 then
			local add = aclGroupAddObject( group, "user."..name )
			if add then
				outputChatBox( "Színesen írsz, amíg turbesz el nem veszi.", root, 0, 255, 0, true )
				triggerClientEvent( source, "hideall", source )
				takePlayerMoney ( source, 2000 )
			else
				-- error on add to group
			end
		else
			outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
		end
    else
        outputChatBox( "Regisztrálj, és jelentkezz be.", source, 255, 0, 0, true )
    end
end
addEvent( "addToGroup", true )
addEventHandler( "addToGroup", root, addToGroup )

 

  • Like 2
Link to comment
9 minutes ago, 3NAD said:

what about this my friend;


function addToGroup( group )  
    group = aclGetGroup( group )
    if group == false or group == nil then
        error( "The value of the 'group' is nil or false !" )
    end
    account = getPlayerAccount( source )
    if not isGuestAccount( account ) then
        local name = getAccountName( account )
		if getPlayerMoney(source) >= 2500 then
			local add = aclGroupAddObject( group, "user."..name )
			if add then
				outputChatBox( "Színesen írsz, amíg turbesz el nem veszi.", root, 0, 255, 0, true )
				triggerClientEvent( source, "hideall", source )
				takePlayerMoney ( source, 2000 )
			else
				-- error on add to group
			end
		else
			outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
		end
    else
        outputChatBox( "Regisztrálj, és jelentkezz be.", source, 255, 0, 0, true )
    end
end
addEvent( "addToGroup", true )
addEventHandler( "addToGroup", root, addToGroup )

 

Working fine! Thanks :DD

 

  • Like 1
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...