Jump to content

bad player pointer


FuriouZ

Recommended Posts

Hey, i asking again what's the problem here..

I still can't figure it out :/

I hope that now i can get a solution, not like last time :roll:

I want that, if player joins deathmatch team, then he can see weapon and ammo, but radar hides away, and if player leaves from deathmatch then radar is visible and ammo and weapon are hitten ..

mta-screen_2013-12-27_13-28-25.png

Server side only :

function isDeathmatchTeam () 
    local gTeam = getPlayerTeam (source)   
    local dmTeam = getTeamFromName("Deathmatch Arena") 
    if ( gTeam ) then  
            if ( gTeam == dmTeam ) then 
        showPlayerHudComponent ( source, "ammo", true ) 
        showPlayerHudComponent ( source, "weapon", true )   
        showPlayerHudComponent ( source, "radar", false )  
    else 
        showPlayerHudComponent ( source, "ammo", false) 
        showPlayerHudComponent ( source, "weapon", false ) 
        showPlayerHudComponent ( source, "radar", true ) 
    end 
end 
end 
addEventHandler("onResourceStart", getRootElement(), isDeathmatchTeam) 

--Teams are created in another resource (server-side too,works perfectly and no errors)

function createTeams () 
    -- 
    -- 
    Deathmatch = createTeam ("Deathmatch Arena", 255, 255, 255) 
    --  
    -- 
end 
addEventHandler("onResourceStart", resourceRoot, createTeams) 

Edited by Guest
Link to comment

CLIENT SIDE

function isDeathmatchTeam () 
    local gTeam = getPlayerTeam (localPlayer)   
    local dmTeam = getTeamFromName("Deathmatch Arena") 
    if ( gTeam and dmTeam ) then 
            if ( gTeam == dmTeam ) then 
        showPlayerHudComponent ( "ammo", true ) 
        showPlayerHudComponent (  "weapon", true )   
        showPlayerHudComponent ( "radar", false ) 
    else 
        showPlayerHudComponent ( "ammo", false) 
        showPlayerHudComponent (  "weapon", false ) 
        showPlayerHudComponent ( "radar", true ) 
    end 
end 
end 
addEventHandler("OnClientResourceStart", getRootElement(), isDeathmatchTeam) 

Link to comment
CLIENT SIDE
function isDeathmatchTeam () 
    local gTeam = getPlayerTeam (localPlayer)   
    local dmTeam = getTeamFromName("Deathmatch Arena") 
    if ( gTeam and dmTeam ) then 
            if ( gTeam == dmTeam ) then 
        showPlayerHudComponent ( "ammo", true ) 
        showPlayerHudComponent (  "weapon", true )   
        showPlayerHudComponent ( "radar", false ) 
    else 
        showPlayerHudComponent ( "ammo", false) 
        showPlayerHudComponent (  "weapon", false ) 
        showPlayerHudComponent ( "radar", true ) 
    end 
end 
end 
addEventHandler("OnClientResourceStart", getRootElement(), isDeathmatchTeam) 

No errors, but if i enter to the deathmatch team, i still can't see "ammo" and "weapon"

Link to comment
OnClientResourceStart > onClientResourceStart.

Still can't see hud, but anyways .. i did another way

Triggered from my lobby window, pretty stupid way, but atleast works fine and no errors.

lobby.lua

addEventHandler("onClientGUIClick", root,  
function() 
    if source == FreeroamRoomButton then         
        closeLobby() 
        guiSetEnabled (LobbyRoomButton,true) 
            triggerServerEvent ( "onPlayerFreeroamEnter", gLocalMe ) 
            triggerEvent ( "disableHud", root, source)  --Triggered 
    elseif source == DeathmatchRoomButton then 
        closeLobby()                 
        guiSetEnabled (LobbyRoomButton,true) 
            triggerServerEvent ( "onPlayerDeathmatchEnter", gLocalMe )   
            triggerEvent ( "enableHud", root, source) --Triggered       

c_dm.lua

function enableHud() 
    showPlayerHudComponent (  "weapon", true )   
    showPlayerHudComponent (  "ammo", true )     
    showPlayerHudComponent ( "radar", false ) 
end 
  
function disableHud() 
    showPlayerHudComponent (  "weapon", false )   
    showPlayerHudComponent (  "ammo", false )    
    showPlayerHudComponent ( "radar", true ) 
end 
  
addEvent("enableHud", true)  
addEventHandler ( "enableHud", root, enableHud ) 
  
addEvent("disableHud", true)  
addEventHandler ( "disableHud", root, disableHud ) 

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