xeon17 Posted May 28, 2014 Share Posted May 28, 2014 I got a problem in my script , i'm tried to create a script who check is the player in event and if he is , then with a command script will take all his weapons.. setElementData ( thePlayer, "Evento" , nil) function getWeapons ( thePlayer ) local accountname = getAccountName (getPlayerAccount(thePlayer)) if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "Admin" ) )) then local players = getElementType ( thePlayer ) == "player" for _, events in ipairs(players) do local isPlayerInEvento = getElementData( events, "Evento" ) if ( isPlayerInEvento) then takeAllWeapons (events) outputChatBox("#FFF000[EVENTO]#FFFFFF Weapons Deleted !",events, 255, 255, 255, true) end end end end addCommandHandler ("takeweapons",getWeapons) Bug: [2014-05-28 10:09:53] ERROR: event\iaan.lua:86: bad argument #1 to 'ipairs' (table expected, got boolean) Link to comment
Twisted Posted May 28, 2014 Share Posted May 28, 2014 function getWeapons ( thePlayer ) local accountname = getAccountName (getPlayerAccount(thePlayer)) if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "Admin" ) )) then for _, events in ipairs(getElementsByType("player")) do local isPlayerInEvento = getElementData( events, "Evento" ) if ( isPlayerInEvento) then takeAllWeapons (events) outputChatBox("#FFF000[EVENTO]#FFFFFF Weapons Deleted !",events, 255, 255, 255, true) end end end end addCommandHandler ("takeweapons",getWeapons) Try that instead. Link to comment
xeon17 Posted May 28, 2014 Author Share Posted May 28, 2014 No work nothing in debug. Link to comment
TAPL Posted May 28, 2014 Share Posted May 28, 2014 No work nothing in debug. How about the chat? Link to comment
xeon17 Posted May 28, 2014 Author Share Posted May 28, 2014 Nope.. here the full script on = "nao" function event (thePlayer) local accountname = getAccountName (getPlayerAccount(thePlayer)) if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "Admin" ) )) then if(on == "sim")then outputChatBox("#FFF000[sERVER#FFFFFF Evento created, use #FF0000/devent#FFFFFF to close the Event!",thePlayer,255,255,255,true) else outputChatBox("#FFF000[sERVER]#FFFFFF Administator #FF0000"..getPlayerName(thePlayer).."#FFFFFF created a event, write #FF0000/irevento#FFFFFF to participate!",root,255,255,255,true) local x,y,z = getElementPosition(thePlayer) coisa = createMarker(x,y,z-1,"cylinder",2,0,255,0) dimen =getElementDimension(thePlayer) inte = getElementInterior(thePlayer) if(inte)then setElementInterior(coisa,inte) end if(dimen)then setElementDimension(coisa,dimen) end on = "sim" end else outputChatBox("#FFF000[sERVER]#FFFFFF You aren't a admin to create a event!",thePlayer,255,255,255,true) end end addCommandHandler("cevent",event) function destruir (thePlayer) local accountname = getAccountName (getPlayerAccount(thePlayer)) if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "Admin" ) )) then if(on == "nao")then outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event, use #FF0000/cevent #FFFFFF to create a event!",thePlayer,255,255,255,true) else destroyElement(coisa) outputChatBox("#FFF000[sERVER]#FFFFFF Administator #FF0000"..getPlayerName(thePlayer).." #FFFFFF Closed the event!",root,255,255,255,true) on = "nao" end else outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin to destroy a event!",thePlayer,255,255,255,true) end end addCommandHandler("devent",destruir) function irevento(thePlayer,cmd) takeAllWeapons ( thePlayer ) setElementData ( thePlayer, "Evento" , nil) setElementHealth ( thePlayer, 100 ) setPedArmor ( thePlayer, 100 ) local x,y,z = getElementPosition(coisa) if(on == "sim")then if(getPedOccupiedVehicle (thePlayer))then outputChatBox("#FFF000[sERVER]#FFFFFF Leave your vehicle to enter the event",thePlayer,255,255,255,true) else if(setElementPosition(thePlayer,x,y,z))then setElementDimension(thePlayer,getElementDimension(coisa)) setElementInterior(thePlayer,inte) outputChatBox("#FFF000[sERVER]#FFFFFF Welcome in the Event!",thePlayer,255,255,255,true) za,ze,zi = getElementPosition(thePlayer) else outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event created!",source,255,255,255,true) end if(za == x and ze == y and zi == z) then setElementPosition(thePlayer,za,ze,zi+1) end end else outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event created!",source,255,255,255,true) end end addCommandHandler("irevento",irevento) function Infor(thePlayer) local accountname = getAccountName (getPlayerAccount(thePlayer)) if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "Admin" ) )) then outputChatBox("#FFF000[sERVER]#FFFFFF - Commands for Event ",source, 255, 255, 255, true) outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/cevent#FFFFFF - To create a event [Administators]!",source, 255, 255, 255, true) outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/devent #FFFFFF- To close the event [Administators]!",source, 255, 255, 255, true) outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/irevento #FFFFFF- To enter the event [Players]!",source, 255, 255, 255, true) else outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin to use this command",source,255,255,255,true) end end addCommandHandler ("event",Infor) function getWeapons ( thePlayer ) local accountname = getAccountName (getPlayerAccount(thePlayer)) if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "Admin" ) )) then for _, events in ipairs(getElementsByType("player")) do local isPlayerInEvento = getElementData( events, "Evento" , nil ) if ( isPlayerInEvento) then takeAllWeapons (events) outputChatBox("#FFF000[EVENTO]#FFFFFF Weapons Deleted !",events, 255, 255, 255, true) end end end end addCommandHandler ("takeweapons",getWeapons) Link to comment
xeon17 Posted May 30, 2014 Author Share Posted May 30, 2014 Is here anyone who can help me ? Link to comment
xeon17 Posted May 30, 2014 Author Share Posted May 30, 2014 Is here anyone who can help me ? Link to comment
xeon17 Posted May 30, 2014 Author Share Posted May 30, 2014 Is here anyone who can help me ? Link to comment
Mr_Moose Posted May 30, 2014 Share Posted May 30, 2014 The one who waits for something good never waits too long Being patient is a good idea, anyway on line 86 in your script you got this: for _, events in ipairs(getElementsByType("player")) do For some reason your script are unable to list the players in your server which seems pretty weird. Are you sure that's the right script? Link to comment
xeon17 Posted May 30, 2014 Author Share Posted May 30, 2014 I give players a element data when they join event , after i want check all players on server and who have the element data , i can take his weapons. I really no know why it dosen't work. Link to comment
xeon17 Posted May 31, 2014 Author Share Posted May 31, 2014 Problem solved , a moderator close the topic please. 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