Jump to content

Help me some Script


Evil-Cod3r

Recommended Posts

Posted

Hi all

i have idea i want Make a resource that

show the Players Name and there Health Only and get the Players team

example if iam team 1 and team 1 got Players can see the Name of there frinds and there Health

and team 2 the same

every team see there frinds info only

can any one give me the functions and events so i can start Make it ?

:D

Posted

is this right ?

local name = getPlayerName(getLocalPlayer()) 
local team = getPlayerTeam ( source ) 
local dm = getElementHealth ( getLocalPlayer() ) 
function hp () 
label1 = guiCreateLabel(1240,585,125,17,"Health :",false) 
guiLabelSetColor(label1,255,255,0) 
guiSetFont(label1,"clear-normal") 
guiSetText ( label1, dm, team ) 
setTimer ( hp, 2000, 1) 
end 
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), hp ) 

Posted

No.

First, a label gets created every time the local player spawns.. If he spawns 30 times, the screen will have 30 labels and the handle element for each will be lost

Secondly, you're using guiSetText with 3 arguments when it only has 2 and the second one should be a STRING.

Thirdly, guiSetText syntax aside, it is simply wrong because 'team' and 'dm' never really change. They are only called once when the script loads up.

Fourthly, but not least, the setTimer screws everything up even more.. (function called multiple times, see first, second and third points above)

Posted
label1 = guiCreateLabel(1240,585,125,17,"Health :",false) 
  
guiLabelSetColor(label1,255,255,0) 
guiSetFont(label1,"clear-normal") 
function hp () 
if getLocalPlayer()==source then 
local name = getPlayerName(getLocalPlayer()) 
local team = getPlayerTeam ( source ) 
team=getTeamName(team) 
local dm = getElementHealth ( getLocalPlayer() ) 
  
guiSetText ( label1,"Your name:  "..name.."  Your Team:  "..team.."  Your Health:  "..dm ) 
setTimer ( hp, 2000, 1) 
end 
end 
addEventHandler ( "onClientPlayerSpawn", getRootElement(), hp ) 

Posted
not i dont want he see his info i want the Players see the info of there frinds just the Name and Health :)

Sure you're not happy with him giving you a ready-script (tbh a bit bugged with the setTimer, but at least it's a start), but you also want the code to have MORE features :o

Posted

he give me the source info only

for exmaple if BinSlayer1 and me and bandi94 are team 1 then

the label name = BinSlayer1 Helath : ....

bandi94 Health : ....

Evil-Cod3r Health : ...

like this you get it ?

Posted

yeah but we can't make the full script for you..

use getPlayersInTeam() and make it with dxDrawText because it's easier than label.

make each line of dxDrawText add 5 or 10 pixels to the screenHeight, this way the texts shouldn't go on top of each other

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