1LoL1 Posted November 15, 2015 Share Posted November 15, 2015 Hello, i created script but when i use /markerr so marker is created but if i again use /markerr so marker is created again. How i can when marker is created and i want to again so outputChatBox("Marker is created") function www (source) w = createMarker( -2805.87890625,1318.779296875,7.1015625, "cylinder", 1.5, 255, 255, 0, 170 ) if w then else cancelEvent() outputChatBox("Marker is created", source, 255, 255, 255, true) end end addCommandHandler("markerr", www) Link to comment
Saml1er Posted November 16, 2015 Share Posted November 16, 2015 local markersCreated = 0 function www (source) local w = createMarker( -2805.87890625,1318.779296875,7.1015625, "cylinder", 1.5, 255, 255, 0, 170 ) if not w then return -- stop the function by returning nothing end if markersCreated > 1 then outputChatBox("Marker is created", source, 255, 255, 255, true) else markersCreated = markersCreated + 1 end end addCommandHandler("markerr", www) cancelEvent() is used to cancel events not command handlers. Link to comment
1LoL1 Posted November 16, 2015 Author Share Posted November 16, 2015 Not work 0 errors. 0 warnings. Link to comment
Saml1er Posted November 17, 2015 Share Posted November 17, 2015 Can you explain what are you trying to do? Link to comment
Rockyz Posted November 18, 2015 Share Posted November 18, 2015 local Makedd = false; addCommandHandler ( "markerr", function ( plr ) if ( getElementType ( plr ) == "player" ) then if ( Makedd ~= true ) then w = createMarker ( -2805.87890625,1318.779296875,7.1015625, "cylinder", 1.5, 255, 255, 0, 170 ); Makedd = true; else outputChatBox ( "Marker is created", plr, 255, 0, 0, true ); end end end ); Link to comment
1LoL1 Posted November 18, 2015 Author Share Posted November 18, 2015 local Makedd = false; addCommandHandler ( "markerr", function ( plr ) if ( getElementType ( plr ) == "player" ) then if ( Makedd ~= true ) then w = createMarker ( -2805.87890625,1318.779296875,7.1015625, "cylinder", 1.5, 255, 255, 0, 170 ); Makedd = true; else outputChatBox ( "Marker is created", plr, 255, 0, 0, true ); end end end ); Thanks. Works. Link to comment
Rockyz Posted November 19, 2015 Share Posted November 19, 2015 Thanks. Works. You're Welcome ^ 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