Jump to content

onColShapeLeave doesen't work, or i'm stupid


DrifteR

Recommended Posts

1st: I'm stupid

2nd: help with this code:

local onlocation = false 
location = createMarker (  -1180, 75.7, 17, "cylinder", 3) 
local ticket = false 
gatecol = createColCircle ( -1180, 75.7, 17, 3 ) 
  
function onlocationchange() 
onlocation = true 
outputChatBox ( "How can i help you(/ticket)" ,thePlayer) 
end 
addEventHandler( "onColShapeHit", gatecol, onlocationchange ) 
  
function leaveloc () 
onlocation = false 
outputChatBox ( "Good Bye!" ,thePlayer) 
end 
addEventHandler( "onColShapeLeave", gatecol, leaveloc ) 
  
function buyticket () 
local money = getPlayerMoney(thePlayer) 
if money-100<=0 then 
 outputChatBox ( "You Dont Have enough money" ,thePlayer) 
else 
 if onlocation == true then 
 setPlayerMoney(thePlayer,money-100) 
 end 
end 
end 
addCommandHandler ("ticket",buyticket) 

When i enter/exti the marker/ColShape i don't get the messages...help

Edited by Guest
Link to comment

createColCircle takes 3 arguments, you gave 4 (but this shouldnt be a problem).

is this server side?

also giving tickets like you probably want it to do will cause EVERY player to have it.

also read about takePlayerMoney (much easier) and isElementWithinColshape (no need to handle hit/leave just to set variable (but if you want to leave that messages - its nesseceary, but you can remove variables anyway)

Link to comment
  • Discord Moderators
No... is on the client side :|

What is the point in this for example then?

outputChatBox ( "How can i help you(/ticket)" ,thePlayer) 

As far as I know, clientside cannot output messages to someone else's chat :P

clientside outputChatBox

outputChatBox ( string text [, int r=255, int g=255, int b=255, bool colorCoded=false ] ) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...