xXNemesiSXx Posted December 28, 2010 Posted December 28, 2010 Sorry for my bad english, i'm Italian but... which script i can use to set players healt ? i've a roleplay server, and i wanna make a reasource that when you go to an ospital there is a marker which give you the healt, but i don't know which command use to set players healt...
xXNemesiSXx Posted December 28, 2010 Author Posted December 28, 2010 (edited) setElementHealth so... this is my first script... the markers appear, but they don't give me the healt.. the script: --Markers degli ospedali-- local ospsf = createMarker( -2655.0173339844, 639.79187011719, 13.404554367065, 'cylinder', 1.5, 255, 0, 0, 150 ) local ospls = createMarker( 2025.3673095703, -1402.7464599609, 16.185314178467, 'cylinder', 1.5, 255, 0, 0, 150 ) local osplv = createMarker( 1610.2142333984, 1819.5577392578, 9.7780055999756, 'cylinder', 1.5, 255, 0, 0, 150 ) -------------------------- --Ripristino della salute a Los Santos-- function Salutels( hitPlayer ) local localPlayer = getLocalPlayer() setElementHealth ( localPlayer, 100 ) end addEventHandler( "onMarkerHit", ospls, Salutels ) ---------------------------------------- --Ripristino della salute a San Fierro-- function Salutesf( hitPlayer ) local localPlayer = getLocalPlayer() setElementHealth ( localPlayer, 100 ) end addEventHandler( "onMarkerHit", ospsf, Salutesf ) ---------------------------------------- --Ripristino della salute a Las Venturas-- function Salutelv( hitPlayer ) local localPlayer = getLocalPlayer() setElementHealth ( localPlayer, 100 ) end addEventHandler( "onMarkerHit", osplv, Salutelv ) ------------------------------------------ where I went wrong? sorry, i'm an italian noob... Edited December 28, 2010 by Guest
Aibo Posted December 28, 2010 Posted December 28, 2010 onMarkerHit — server-side event. getLocalPlayer() — client-side function. you can't use both in the same script, decide where you want it, client or server side.
xXNemesiSXx Posted December 28, 2010 Author Posted December 28, 2010 which is the client side equivalent of "onMarkerHit" ?
Aibo Posted December 28, 2010 Posted December 28, 2010 onClientMarkerHit and you need to check what element hit the marker, otherwise it will set local player's health every time any element hits the marker.
xXNemesiSXx Posted December 28, 2010 Author Posted December 28, 2010 (edited) thanks a lot... will it work now ? --Markers degli ospedali-- local ospsf = createMarker( -2655.0173339844, 639.79187011719, 13.404554367065, 'cylinder', 1.5, 255, 0, 0, 150 ) local ospls = createMarker( 2025.3673095703, -1402.7464599609, 16.185314178467, 'cylinder', 1.5, 255, 0, 0, 150 ) local osplv = createMarker( 1610.2142333984, 1819.5577392578, 9.7780055999756, 'cylinder', 1.5, 255, 0, 0, 150 ) -------------------------- --Ripristino della salute a Los Santos-- function Salutesf ( hitPlayer, matchingDimension ) local localPlayer = getLocalPlayer() setElementHealth ( localPlayer, 100 ) end addEventHandler( "onClientMarkerHit", ospls, Salutels ) ---------------------------------------- --Ripristino della salute a San Fierro-- function Salutesf ( hitPlayer, matchingDimension ) local localPlayer = getLocalPlayer() setElementHealth ( localPlayer, 100 ) end addEventHandler( "onClientMarkerHit", ospsf, Salutesf ) ---------------------------------------- --Ripristino della salute a Las Venturas-- function Salutelv ( hitPlayer, matchingDimension ) local localPlayer = getLocalPlayer() setElementHealth ( localPlayer, 100 ) end addEventHandler( "onClientMarkerHit", osplv, Salutelv ) ------------------------------------------ Edited December 28, 2010 by Guest
xXNemesiSXx Posted December 28, 2010 Author Posted December 28, 2010 !? to test ?! yes, i've tested it, and it wont work...
Aibo Posted December 28, 2010 Posted December 28, 2010 *sigh* have you added this script to meta.xml as client type? PS: you have 2 functions with the same name (Salutesf), and event handler with function Salutels, which doesnt exist. i suppose the first function should be called Salutels. you know you can fix your typos by yourself. use /debugscript 3 if you dont see them.
xXNemesiSXx Posted December 28, 2010 Author Posted December 28, 2010 *sigh* have you added this script to meta.xml as client type?PS: you have 2 functions with the same name (Salutesf), and event handler with function Salutels, which doesnt exist. i suppose the first function should be called Salutels. you know you can fix your typos by yourself. use /debugscript 3 if you dont see them. -.- -.- -.- !! i'm very stupid !! -.- -.- -.- now it works, you are the best !!
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