joao1234 Posted February 15, 2013 Share Posted February 15, 2013 Hey im trying to make an event system, but when i type /event (the command to create the event marker) it executes the else part.. function marker ( thePlayer, commandName ) if ( getElementType(thePlayer) == "player" ) then if ( getPlayerTeam (thePlayer) == "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 outputChatBox ( "Event cannot be created :/", thePlayer ) end end end addCommandHandler ( "event", marker ) Link to comment
Vision Posted February 15, 2013 Share Posted February 15, 2013 function marker ( thePlayer, commandName ) if ( getElementType(thePlayer) == "player" ) then if ( getPlayerTeam (thePlayer) == getTeamFromName ( "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 outputChatBox ( "Event cannot be created :/", thePlayer ) end end end addCommandHandler ( "event", marker ) Link to comment
joao1234 Posted February 15, 2013 Author Share Posted February 15, 2013 It says the same Link to comment
iPrestege Posted February 15, 2013 Share Posted February 15, 2013 == Server Side == 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 outputChatBox ( "Event cannot be created :/", thePlayer ) end end end addCommandHandler ( "event", marker ) Link to comment
albers14 Posted February 15, 2013 Share Posted February 15, 2013 (edited) Nvm tested it on my private server and it worked fine, theres no probs with the post, posted above mine Edited February 15, 2013 by Guest Link to comment
Anderl Posted February 15, 2013 Share Posted February 15, 2013 Both last answers are the same as Castro's code. Link to comment
PaiN^ Posted February 15, 2013 Share Posted February 15, 2013 Both last answers are the same as Castro's code. They'rlittle bit different if ( getPlayerTeam (thePlayer) == getTeamFromName ( "Staff" ) ) then local team = getPlayerTeam (thePlayer) if ( team and getTeamName ( team ) == "Staff" ) then Link to comment
Anderl Posted February 15, 2013 Share Posted February 15, 2013 That is exactly the same. Link to comment
PaiN^ Posted February 15, 2013 Share Posted February 15, 2013 LoooL I didn't know that, i thought that's different Link to comment
Anderl Posted February 15, 2013 Share Posted February 15, 2013 Yes, actually they're different but they both are going to do the same. Link to comment
PaiN^ Posted February 15, 2013 Share Posted February 15, 2013 OK thanx But one more request, Can you fix the code please = ) Link to comment
Anderl Posted February 15, 2013 Share Posted February 15, 2013 Mr.Pres[T]ege's code should work fine, unless there's something I didn't see. Link to comment
iPrestege Posted February 15, 2013 Share Posted February 15, 2013 Mr.Pres[T]ege's code should work fine, unless there's something I didn't see. Yes I try it and it works! Link to comment
joao1234 Posted February 15, 2013 Author Share Posted February 15, 2013 oh thx guys <3 u helped me so much :3 Link to comment
joao1234 Posted February 15, 2013 Author Share Posted February 15, 2013 but.. i tested now and it just do the else part Link to comment
joao1234 Posted February 15, 2013 Author Share Posted February 15, 2013 and there are no errors Link to comment
iPrestege Posted February 15, 2013 Share Posted February 15, 2013 and there are no errors it works with me and create marker and blip ! show you,re meta.xml Link to comment
Vision Posted February 15, 2013 Share Posted February 15, 2013 Are you sure that you are in "Staff" team? Link to comment
joao1234 Posted February 15, 2013 Author Share Posted February 15, 2013 Oh ye now it works fine :3 i forgot to join to the team, my fault Link to comment
joao1234 Posted February 15, 2013 Author Share Posted February 15, 2013 Well after that i made more code.. but when i try to create the marker it executes the first 2 functions at the same time 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 outputChatBox ( "Event cannot be created Maybe u aren't a Staff or is another error.", thePlayer ) end end end addCommandHandler ( "event", marker ) function markerON () 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 addCommandHandler ( "event", markerON ) 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 ) 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