jkub Posted December 22, 2008 Share Posted December 22, 2008 I am working on a real simple arrest script for the police team. anyway my problem is I would not like it to say "you will be realesed in 15 seconds" in the chatbox, i would like it to say that thru an image I made, like a gui static image that pops up and says it instead. but In order to do that I would have to make an "onPlayerArrest" event to trigger that image to pop up on the screen of the criminal. I have no idea how to define the custom event... function arrest ( thePlayer ) setElementPosition ( thePlayer, 198.8221, 162.0566, 1003.0299 ) setElementInterior ( thePlayer, 3 ) toggleAllControls ( thePlayer, false ) --disable the criminals controls ( basicly freezing him ) takeAllWeapons ( thePlayer ) --remove all of the players weapons setTimer ( toggleAllControls, 15000, 1, thePlayer, true ) setTimer ( setElementPosition, 15000, 1, thePlayer, 2335.9614, 2454.5168, 14.9687 ) setTimer ( setElementInterior, 15000, 1, thePlayer, 0 ) outputChatBox ( "You will be released in 15 seconds", thePlayer, 0, 100, 255 ) end addCommandHandler ( "arrestme", arrest ) addEvent ( "onPlayerArrest" ) function setPlayerArrest ( thePlayer ) if isControlEnabled ( thePlayer, "forwards" ) then triggerEvent ( "onPlayerArrest", thePlayer ) end end function releasemessage ( thePlayer ) guiCreateStaticImage( 20, 200, 100, 100, "image.png", false ) end addEventHandler ( "onPlayerArrest", getRootElement(), releasemessage ) Link to comment
Buffalo Posted December 23, 2008 Share Posted December 23, 2008 ServerSide: function arrest ( thePlayer ) setElementPosition ( thePlayer, 198.8221, 162.0566, 1003.0299 ) setElementInterior ( thePlayer, 3 ) toggleAllControls ( thePlayer, false ) --disable the criminals controls ( basicly freezing him ) takeAllWeapons ( thePlayer ) --remove all of the players weapons setTimer ( toggleAllControls, 15000, 1, thePlayer, true ) setTimer ( setElementPosition, 15000, 1, thePlayer, 2335.9614, 2454.5168, 14.9687 ) setTimer ( setElementInterior, 15000, 1, thePlayer, 0 ) outputChatBox ( "You will be released in 15 seconds", thePlayer, 0, 100, 255 ) triggerClientEvent(thePlayer,"onPlayerArrest",thePlayer) end addCommandHandler ( "arrestme", arrest ) ClientSide: local msgPng = nil function releasemessage ( ) msgPng = guiCreateStaticImage( 20, 200, 100, 100, "image.png", false ) setTimer(hideRMsg,7000,1) end addEvent ( "onPlayerArrest" ,true) addEventHandler ( "onPlayerArrest", getRootElement(), releasemessage ) function hideRMsg() if(msgPng) then destroyElement(msgPng) end end Link to comment
jkub Posted December 23, 2008 Author Share Posted December 23, 2008 Ive tryed that but it returned somthin like this in debug " onPlayerArrest not added clientside"? Link to comment
[DKR]silverfang Posted December 24, 2008 Share Posted December 24, 2008 Ive tryed that but it returned somthin like this in debug " onPlayerArrest not added clientside"? Have you done the addEvent("onPlayerArrest", true) bit yet?? Link to comment
jkub Posted December 24, 2008 Author Share Posted December 24, 2008 yes its in the client script 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