Jump to content

outPutChatbox


Xwad

Recommended Posts

Hi i just want to ask that how can i make an outputchatbox in server side local? I mean if forexample a player hit a marker then the script will output a chatbox. And i want to make that only the player will see that chatbox who hit the marker. Becaouse i made a script like that and when the player hit the marker than everyone saw the chatbox. This is a pőart of my script

  
function markerHit6(hitElement, matchingDimension, player, thePlayer) 
if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "America" and isElement (GA6) then 
outputChatBox("Please,Stay 10 Secs in the area to capture it !",thePlayer,255,109 ,109 ) 
timer6 = setTimer ( captureAreaA6, 4000, 1 ) 
else 
cancelEvent() 
if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" and isElement (UA6) then 
outputChatBox("Please,Stay 10 Secs in the area to capture it !",thePlayer,255,109 ,109 ) 
timer6 = setTimer ( captureAreaG6, 4000, 1 ) 
end 
end 
end 
addEventHandler("onMarkerHit", marker6, markerHit6) 
  

Link to comment

Who's thePlayer?

onMarkerHit / onClientMarkerHit events are with two arguments the player who hit the marker and dimension

function markerHit6(hitElement, matchingDimension) 
if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "America" and isElement (GA6) then 
outputChatBox("Please,Stay 10 Secs in the area to capture it !",hitElement,255,109 ,109 ) 
timer6 = setTimer ( captureAreaA6, 4000, 1 ) 
else 
cancelEvent() 
if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" and isElement (UA6) then 
outputChatBox("Please,Stay 10 Secs in the area to capture it !",hitElement,255,109 ,109 ) 
timer6 = setTimer ( captureAreaG6, 4000, 1 ) 
end 
end 
end 
addEventHandler("onMarkerHit", marker6, markerHit6) 
  

Link to comment
Actually, the hitElement could be any element hitting the marker like a car, a tree or a lamppost flying into the marker, just make sure to use getElementType and check so that hitElement is a player element and nothing else.

He already did that

getElementType(hitElement) =="player" 

you can also use isPedInVehicle and isPedDead to check if the player who hit the marker is in the vehicle or not

isPedDead used to check if the player is dead or no in this case you can do something by lua like that

if not isPedDead ( hitElement) ) then 

Link to comment
Or get the vehicle occupant(s) if there's a vehicle hitting the marker, there are many possibilities for all of us with some creativity skills, just wanted to point that out even it was already in the code ;)

Yes i understand, he also must know what he do because as i see he is scripting but he don't know the meaning of some functions

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...