Jump to content

[resolved]Why not working setElementHealth and setPedArmor?


Turbesz

Recommended Posts

this is the code:

--client

outputChatBox("#52FF52Egyedi #ff0000élet#52ff52feltöltő panel: /elet !",0,255,255,true) 
  
local GUIEditor = { 
    window = {}, 
    button = {} 
} 
  
GUIEditor.window[1] = guiCreateWindow(502, 266, 514, 105, "Élet és életpajzs kérő panel | TELJESEN TURBESZ ÁLTAL", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF0000") 
GUIEditor.button[1] = guiCreateButton(10, 53, 234, 42, "ÉLET FELTÖLTÉSE MAXRA", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
GUIEditor.button[2] = guiCreateButton(267, 53, 237, 42, "ÉLETPAJZS FELTÖLTÉSE MAXRA", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF0023FE") 
GUIEditor.button[3] = guiCreateButton(433, 20, 71, 27, "x", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[3], "sa-header") 
guiSetVisible(GUIEditor.window[1], false) 
  
function OpenWin() 
    if guiGetVisible ( GUIEditor.window[1] ) == false then 
       guiSetVisible ( GUIEditor.window[1], true ) 
       showCursor(true) 
    end 
end 
addCommandHandler ( "elet", OpenWin) 
  
function Bezaras() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor ( false ) 
    
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[3], Bezaras) 
  
function health() 
    triggerServerEvent ("hp", root) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], health, false ) 
  
function health() 
    triggerServerEvent ("armor", root) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[2], health, false ) 

--server

addEvent( "hp", true ) 
addEventHandler( "hp", root, 
    function ( ) 
            setElementHealth(getLocalPlayer(), 100) 
        end 
) 
  
addEvent( "armor", true ) 
addEventHandler( "armor", root, 
    function ( ) 
            setPedArmor ( thePlayer, 100 ); 
        end 
) 

Edited by Guest
Link to comment

Try with this... You did not pass the player to the server side and the localPlayer is only client side.

--client

outputChatBox("#52FF52Egyedi #ff0000élet#52ff52feltöltő panel: /elet !",0,255,255,true) 
  
local GUIEditor = { 
    window = {}, 
    button = {} 
} 
  
GUIEditor.window[1] = guiCreateWindow(502, 266, 514, 105, "Élet és életpajzs kérő panel | TELJESEN TURBESZ ÁLTAL", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF0000") 
GUIEditor.button[1] = guiCreateButton(10, 53, 234, 42, "ÉLET FELTÖLTÉSE MAXRA", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
GUIEditor.button[2] = guiCreateButton(267, 53, 237, 42, "ÉLETPAJZS FELTÖLTÉSE MAXRA", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF0023FE") 
GUIEditor.button[3] = guiCreateButton(433, 20, 71, 27, "x", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[3], "sa-header") 
guiSetVisible(GUIEditor.window[1], false) 
  
function OpenWin() 
    if guiGetVisible ( GUIEditor.window[1] ) == false then 
       guiSetVisible ( GUIEditor.window[1], true ) 
       showCursor(true) 
    end 
end 
addCommandHandler ( "elet", OpenWin) 
  
function Bezaras() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor ( false ) 
    
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[3], Bezaras) 
  
function health() 
    triggerServerEvent ("hp", root, getLocalPlayer()) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], health, false ) 
  
function health() 
    triggerServerEvent ("armor", root, getLocalPlayer()) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[2], health, false ) 

--server

addEvent( "hp", true ) 
addEventHandler( "hp", root, 
    function (thePlayer) 
            setElementHealth( thePlayer, 100 ) 
        end 
) 
  
addEvent( "armor", true ) 
addEventHandler( "armor", root, 
    function (thePlayer) 
            setPedArmor ( thePlayer, 100 ); 
        end 
) 

Link to comment
Try with this... You did not pass the player to the server side and the localPlayer is only client side.

--client

outputChatBox("#52FF52Egyedi #ff0000élet#52ff52feltöltő panel: /elet !",0,255,255,true) 
  
local GUIEditor = { 
    window = {}, 
    button = {} 
} 
  
GUIEditor.window[1] = guiCreateWindow(502, 266, 514, 105, "Élet és életpajzs kérő panel | TELJESEN TURBESZ ÁLTAL", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF0000") 
GUIEditor.button[1] = guiCreateButton(10, 53, 234, 42, "ÉLET FELTÖLTÉSE MAXRA", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
GUIEditor.button[2] = guiCreateButton(267, 53, 237, 42, "ÉLETPAJZS FELTÖLTÉSE MAXRA", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF0023FE") 
GUIEditor.button[3] = guiCreateButton(433, 20, 71, 27, "x", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[3], "sa-header") 
guiSetVisible(GUIEditor.window[1], false) 
  
function OpenWin() 
    if guiGetVisible ( GUIEditor.window[1] ) == false then 
       guiSetVisible ( GUIEditor.window[1], true ) 
       showCursor(true) 
    end 
end 
addCommandHandler ( "elet", OpenWin) 
  
function Bezaras() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor ( false ) 
    
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[3], Bezaras) 
  
function health() 
    triggerServerEvent ("hp", root, getLocalPlayer()) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], health, false ) 
  
function health() 
    triggerServerEvent ("armor", root, getLocalPlayer()) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[2], health, false ) 

--server

addEvent( "hp", true ) 
addEventHandler( "hp", root, 
    function (thePlayer) 
            setElementHealth( thePlayer, 100 ) 
        end 
) 
  
addEvent( "armor", true ) 
addEventHandler( "armor", root, 
    function (thePlayer) 
            setPedArmor ( thePlayer, 100 ); 
        end 
) 

Many thanks...again :DDDDDD

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