Amine#TN Posted April 29, 2017 Share Posted April 29, 2017 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 Link to comment
NeXuS™ Posted April 29, 2017 Share Posted April 29, 2017 (edited) This script has more errors than the given debug error messages. Would you mind if I rewrite the whole thing? Edited April 29, 2017 by NeXuS™ 2 Link to comment
Simple. Posted April 29, 2017 Share Posted April 29, 2017 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) 1 Link to comment
Amine#TN Posted April 29, 2017 Author Share Posted April 29, 2017 Thanks 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now