-
Player HUD On Crosshair
ENG ;
Hi
where can I find a script:
when tracking the player is showing up his nickname because he wanted me to add to this rank money etc
If the council can not Find an access this script if anyone can share it?
sryy for bad english
PL :
Czesc
gdzie moge znaleźć skrypt :
gdy namierze na gracza to pokazuje sie jego nick bo chcial bym dodac do tego rank money itp
Jezeli nie da rady znalesc tego skryptu czy moze ktos go udostepnic ?
-
[PL] -> Spróbuj tego ,jeżeli coś nie będzie działać to wróc tutaj. ;)
[ENG] -> Try this, if something does not work to go back here. ;)
Ps. If anyone from staying here sees errors, please improvement script.. :p
PHP Code:
init()
{
thread waitforconnected();
}
waitforconnected()
{
while (true)
{
level waittill("connected", player);
player thread waitforspawn();
}
}
waitforspawn()
{
self endon("disconnect");
while (true)
{
self waittill("spawned_player");
self thread isLookingAtPlayer();
}
}
isLookingAtPlayer()
{
self endon("disconnect");
players = getentarray("player", "classname");
player = undefined;
for(i=0;i < players.size;i++)
{
if(self islookingat(players[i]))
{
player = players[i];
self.hud_looking = newClientHudElem(self);
self.hud_looking.x = 320;
self.hud_looking.y = 240;
self.hud_looking.alignX = "center";
self.hud_looking.alignY = "middle";
self.hud_looking.sort = 1;
self.hud_looking.alpha = 0;
self.hud_looking.fontScale = 1.2;
self.hud_looking setText(&"Rank: "+player.rank);
self.hud_looking fadeOverTime(0.2);
self.hud_looking.alpha = 1;
}
else
{
self.hud_looking.alpha = 0;
self.hud_looking = undefined;
}
}
}
Script show only rank ;)
-
settext with a non precached string... way to go...
.label and setvalue
-
Hope that would work:
PHP Code:
init()
{
precacheString(&"Rank: ");
thread waitforconnected();
}
self.hud_looking setText(&"Rank: ");
self.hud_looking setValue(player.rank);
The performance would be better with a bullettrace(..........to forward.........)["entity"]
-
-
You want when someone is spectating? Or if youre playing and look at the player?
Cause that script wouldnt work (in my opinion) cause it would check after respawn 1 time if u look at a player, if not it will wait for next respawn.
So you would need an while(self isLookingAt(players[i])).
I made this simple script (i know its not perfect but should work) but i dind't tested it yet.
I think it should work, it should show the player.rank in the middle of the screen if you look at a player.
Code:
init()
{
precacheString(&"^3Rank: ");
thread waitforconnected();
}
waitforconnected()
{
while (true)
{
level waittill("connected", player);
player thread waitforspawn();
}
}
waitforspawn()
{
self endon("disconnect");
self.hud_looking = newClientHudElem(self);
self.hud_looking.x = 320;
self.hud_looking.y = 240;
self.hud_looking.alignX = "center";
self.hud_looking.alignY = "middle";
self.hud_looking.sort = 1;
self.hud_looking.alpha = 0;
self.hud_looking.fontScale = 1.2;
self.hud_looking.label = &"^3Rank: ";
while (true)
{
self waittill("spawned_player");
self thread spawned();
}
}
//The following part is made by Earliboy
spawned()
{
self notify("show_rank_restart");
self endon("disconnect");
self endon("show_rank_restart");
if(!isAlive(self))
return;
while(isAlive(self))
{
//Wait 2, otherwise it may lagg the server with to much players
wait 2;
//Redefine the players (if someone new joined)
players = getEntArray("player","classname");
for(i = 0; i < players.size; i++)
{
if(!isDefined(players[i]))
continue;
if(!isAlive(players[i]))
continue;
player = players[i];
if(!self isLookingAt(player))
continue;
self.hud_looking setValue(player.rank);
self.hud_looking fadeOverTime(0.2);
self.hud_looking.alpha = .7;
while(self isLookingAt(player) && isAlive(self))
wait 2;
}
}
self.hud_looking.alpha = 0;
}
-
Earliboy
You script work but if you stop to aim the person still shows hud
pl :
Twoj skrypt dziala lecz jesli przestane celowac w osobe to nadal pokazuje hud
-
I can't find what's wrong but try this, I wrote it a long time ago anyway should work... (it's just part of code... make it useful)
Code:
PlayersStats()
{
while(isdefined(self))
{
trace = bullettrace(self geteye()+(0,0,20),self geteye()+(0,0,20)+maps\mp\_utility::vectorscale(anglestoforward(self getplayerangles()),99999),true,self);
if(isplayer(trace["entity"]))
{
if(!isdefined(self.info))
{
self.info = newClientHudElem(self);
self.info.alignx = "center";
self.info.aligny = "center";
self.info.x = 250;
self.info.y = 250;
self.info.fontscale = 0.8;
self.info.label = &"Name: ";
self.info setplayernamestring(trace["entity"]);
self.info.alpha = 0;
self.info fadeOverTime(0.4);
self.info.alpha = 1;
}
else
self.info setplayernamestring(trace["entity"]);
}
else if(!isplayer(trace["entity"]) && isdefined(self.info))
self.info destroy();
wait 0.05;
}
}
Precache:
Code:
precacheString(&"Name: ");
-
Jeplaa
You Srcipt dont work , who can repair Earliboy SCRIPT ?
-
PHP Code:
main()
{
level.rankstring = &"Rank: ";
precacheString(level.rankstring);
thread waitforconnect();
}
waitforconnect()
{
while(true)
{
level waittill("connecting", player);
player thread onconnect();
}
}
onconnect()
{
self.playerrankhud = newClientHudElem(self);
self.playerrankhud.label = level.rankstring;
self.playerrankhud.alpha = 0;
self.playerrankhud.horzAlign = "center_safearea";
self.playerrankhud.vertAlign = "center_safearea";
self.playerrankhud.alignx = "center";
self.playerrankhud.aligny = "middle";
self.playerrankhud.x = 0;
self.playerrankhud.y = 0;
self.playerrankhud.archived = false;
self.playerrankhud.foreground = false;
while(isdefined(self))
{
self waittill("spawned_player");
lookat = undefined;
while(isdefined(self) && isdefined(self.sessionstate) && self.sessionstate == "playing")
{
start = self geteye() + (0, 0, 20);
forward = anglestoforward(self getplayerangles());
end = start + maps\mp\_util::vectorScale(forward, 1000);
trace = bullettrace(start, end, true, self);
if(isdefined(trace["entity"]) && isplayer(trace["entity"]))
{
self.playerrankhud.alpha = 1;
self.playerrankhud setvalue(trace["entity"].rank);
}
else if(self.playerrankhud.alpha != 0)
{
self.playerrankhud fadeovertime(0.5);
self.playerrankhud.alpha = 0;
}
wait 0.05;
}
self.playerrankhud.alpha = 0;
}
}
I will explain this script some time..