Jump to content

Please help me to set player healt


xXNemesiSXx

Recommended Posts

Posted

Sorry for my bad english, i'm Italian :D

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

Posted (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? :x

sorry, i'm an italian noob... :|

Edited by Guest
Posted

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.

Posted

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.

Posted (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 by Guest
Posted

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

Posted
*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 !! -.- -.- -.-

:lol::lol: now it works, you are the best !! :lol::lol:

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