joao1234 Posted February 15, 2013 Author Posted February 15, 2013 No.. the function markerON its to prevent the player of create more than 1 event at the same time so when he type /event and another marker is created he cant create another marker..
joao1234 Posted February 16, 2013 Author Posted February 16, 2013 (edited) Well i joined the two functions but now there are no errors and nothing happens function marker ( thePlayer, commandName ) if ( getElementType(thePlayer) == "player" ) then local team = getPlayerTeam (thePlayer) if ( team and getTeamName ( team ) == "Staff" ) then local x, y, z = getElementPosition ( thePlayer ) markerevento = createMarker ( x + 2, y + 2, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) blip = createBlipAttachedTo ( markerevento, 49, 1 ) dim = getElementDimension ( thePlayer ) int = getElementInterior( thePlayer ) setElementDimension ( markerevento, dim ) setElementInterior ( markerevento, int ) outputChatBox ( "#00FF00An event has just been created use #FF0000/eventwarp #00FF00now!", getRootElement(), 255, 255, 255, true ) else if ( markerevento ) then if isElement( markerevento ) then outputChatBox ( "An event is created, you can't create another one..", thePlayer, 255, 255, 255, true ) end end end end end addCommandHandler ( "event", marker ) function markerOFF () if ( markerevento ) then if isElement( markerevento ) then destroyElement( markerevento ) markerevento = nil end if isElement(blip) then destroyElement(blip) blip = nil end outputChatBox ( "Event is closed.", thePlayer, 255, 255, 255, true ) end end addCommandHandler ( "eventclose", markerOFF ) Edited February 16, 2013 by Guest
Vision Posted February 16, 2013 Posted February 16, 2013 Try this function marker ( thePlayer, commandName ) if ( getElementType(thePlayer) == "player" ) then local team = getPlayerTeam (thePlayer) if ( team and getTeamName ( team ) == "Staff" ) then if isElement ( markerevento ) then outputChatBox ( "An event is created, you can't create another one..", thePlayer, 255, 255, 255, true ) else local x, y, z = getElementPosition ( thePlayer ) markerevento = createMarker ( x + 2, y + 2, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) blip = createBlipAttachedTo ( markerevento, 49, 1 ) dim = getElementDimension ( thePlayer ) int = getElementInterior( thePlayer ) setElementDimension ( markerevento, dim ) setElementInterior ( markerevento, int ) outputChatBox ( "#00FF00An event has just been created use #FF0000/eventwarp #00FF00now!", getRootElement(), 255, 255, 255, true ) end end end end addCommandHandler ( "event", marker ) function markerOFF () if ( markerevento ) then if isElement( markerevento ) then destroyElement( markerevento ) markerevento = nil end if isElement(blip) then destroyElement(blip) blip = nil end outputChatBox ( "Event is closed.", thePlayer, 255, 255, 255, true ) end end addCommandHandler ( "eventclose", markerOFF )
TAPL Posted February 16, 2013 Posted February 16, 2013 oh i didn't know that a vehicle or object or even an marker can type the command if ( getElementType(thePlayer) == "player" ) then
joao1234 Posted February 16, 2013 Author Posted February 16, 2013 oh ye it works fine :3 thx more 1 time
iPrestege Posted February 16, 2013 Posted February 16, 2013 Jus Try It Don,t Say It,s Not Work And You Didn,t Test It .
joao1234 Posted February 16, 2013 Author Posted February 16, 2013 Is there any way to set the limit of players that can go into a marker? cuz i want to make the /event command have another argument /event [limitOFplayersINevent]
Castillo Posted February 16, 2013 Posted February 16, 2013 Create a variable, then change the value when you use the command "event" to the value you set. Then you should have a table with all the players in the event, everytime someone joins, check if the limit has been reached.
joao1234 Posted February 16, 2013 Author Posted February 16, 2013 (edited) but how to do that variable? its: --################### --## Variables --################### local limit = tonumber(limit) --################### --## Event create... --################### function marker ( thePlayer, commandName ) if ( getElementType(thePlayer) == "player" ) then local team = getPlayerTeam (thePlayer) if ( team and getTeamName ( team ) == "Staff" ) then if isElement ( markerevento ) then outputChatBox ( "An event is created, you can't create another one..", thePlayer, 255, 255, 255, true ) else local x, y, z = getElementPosition ( thePlayer ) markerevento = createMarker ( x + 2, y + 2, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) blip = createBlipAttachedTo ( markerevento, 49, 1 ) dim = getElementDimension ( thePlayer ) int = getElementInterior( thePlayer ) setElementDimension ( markerevento, dim ) setElementInterior ( markerevento, int ) outputChatBox ( "#00FF00An event has just been created, type /eventwarp to be warped to the event ( limit:" ..limit.. " )", getRootElement(), 255, 255, 255, true ) end end end end addCommandHandler ( "event", marker ) Edited February 16, 2013 by Guest
Castillo Posted February 16, 2013 Posted February 16, 2013 Yes, then you add an argument to the function that is executed by "/event".
joao1234 Posted February 16, 2013 Author Posted February 16, 2013 addCommandHandler ( "event", marker, limit ) see the code above.. i updated it
Anderl Posted February 16, 2013 Posted February 16, 2013 No, that does not make sense ( both last code and this one ).
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