Jump to content

Team System


Amine#TN

Recommended Posts

Hi, 

I Have Problem In Team System !!! The Idea is to set ElementData by Panel... And when the Player have that  ElementData he can join the Team .. Can anyone help me ?? PLease :\ 

This Is the Code 

------------------------------------------------
function Invitar (player)
	local Vipteam = getTeamFromName("F.B.I")
	local thePlayer = getPlayerFromName(source) 
	if (Vipteam) then 
	setElementData ( source,"F.B.I",true)
	outputChatBox ( "#00FF00To Join #2EFF9A*F.B.I* #FF0000/accept",source, 0, 255, 0, true )
	else
	cancelEvent()
	end
end


addEvent( "FBI", true)
addEventHandler( "FBI", getRootElement(), Invitar )

-------------------------------------------------------------
addCommandHandler( "accept",
function(player) 
	if getElementData(player,"Player") and getElementData(player,"F.B.I") == true then 
	setPlayerTeam(player, Vipteam)
	triggerClientEvent (source, "lainvitacion", source)
else 
cancelEvent()
outputChatBox ( "#FF0000You Are Not Invited To Any Clan !!",source, 0, 255, 0, true )
end
end
) 

And This the Errors that i got :\ 

WARNING: TeamSystem\server.lua:54: Bad argument @ 'getPlayerFromName' [Expected string at argument 1, got player]
WARNING: TeamSystem\server.lua:89: Bad argument @ 'getPlayerFromName' [Expected string at argument 1, got nil]
WARNING :TeamSystem\server.lua:90: Bad argument @ 'getElementData' [Expected element at argument 1, got nil]

 Thanks :D:)^_^

Link to comment

try this

------------------------------------------------
function Invitar (player)
    if (getTeamFromName("F.B.I")) then 
        setElementData ( source,"F.B.I",true)
        outputChatBox ( "#00FF00To Join #2EFF9A*F.B.I* #FF0000/accept",source, 0, 255, 0, true )
    end
end


addEvent( "FBI", true)
addEventHandler( "FBI", getRootElement(), Invitar )

-------------------------------------------------------------
addCommandHandler( "accept",
function(player) 
    if getElementData(player,"Player") and getElementData(player,"F.B.I") then 
        setPlayerTeam(player, getTeamFromName("F.B.I"))
        triggerClientEvent (player, "lainvitacion", player)
    else 
        outputChatBox ( "#FF0000You Are Not Invited To Any Clan !!",player, 0, 255, 0, true )
    end
end) 

 

  • Like 1
Link to comment

Thanks :D Working ;) 

13 minutes ago, 'SimpleArtS . . said:

try this


------------------------------------------------
function Invitar (player)
    if (getTeamFromName("F.B.I")) then 
        setElementData ( source,"F.B.I",true)
        outputChatBox ( "#00FF00To Join #2EFF9A*F.B.I* #FF0000/accept",source, 0, 255, 0, true )
    end
end


addEvent( "FBI", true)
addEventHandler( "FBI", getRootElement(), Invitar )

-------------------------------------------------------------
addCommandHandler( "accept",
function(player) 
    if getElementData(player,"Player") and getElementData(player,"F.B.I") then 
        setPlayerTeam(player, getTeamFromName("F.B.I"))
        triggerClientEvent (player, "lainvitacion", player)
    else 
        outputChatBox ( "#FF0000You Are Not Invited To Any Clan !!",player, 0, 255, 0, true )
    end
end) 

 

 

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