AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Player Trail (https://forums.alliedmods.net/showthread.php?t=172114)

Pattinho 11-15-2011 15:17

[Help] Player Trail
 
Hey guys,

i hope someone can help me. Is it possible to make a player trail that never ends till i say it?
For example: trail on and he follows me all the time and hold it till i say trail off. Is it possible ? When yes how ?
I know how to do a trail behind the player but he ends after a time of seconds.

Would be nice if someone can help me :)

mrhellish 11-15-2011 16:09

Re: [Help] Player Trail
 
Try with PreThink, if player's speed is 0, in next move (speed !=0) set trail...
edit: sth like that
PHP Code:

public PreThink(id) {
    
    static 
Float:vel[3], bool:settrail[33];
    
    
pev(idpev_velocityvel);
    if (
vel[0] == 0.0 && vel[0] == 0.0 && vel[0] == 0.0settrail[id] = true;
    else if (
settrail[id]) {
        
        
//message_begin(......
        
settrail[id] = false;
    }



Pattinho 11-15-2011 16:37

Re: [Help] Player Trail
 
Thanks for the fast answer.

I don't have a problem with on and off, my problem is just the trail ends after a time and i will to hold the trail because i wanna see the way which i did. At the moment he just do it for 1 sec and then its off.

PHP Code:

trail(id) {
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    
write_byte(22); // TE_BEAMFOLLOW
    
write_short(id);
    
write_short(beamspr); // laserbeam
    
write_byte(10); // life
    
write_byte(5); // width
    
write_byte(250); // R
    
write_byte(80); // G
    
write_byte(10); // B
    
write_byte(175); // brightness
    
message_end();



Pattinho 11-16-2011 04:25

Re: [Help] Player Trail
 
In other words, life is reponsible for the time, example : 50 life = 5 sec , the max i can do is 255. But i want without time is it possible ?

mrhellish 11-16-2011 04:30

Re: [Help] Player Trail
 
Quote:

Originally Posted by Pattinho (Post 1597298)
In other words, life is reponsible for the time, example : 50 life = 5 sec , the max i can do is 255. But i want without time is it possible ?

Have you tried with zero? Or maybe with task?

Pattinho 11-16-2011 04:35

Re: [Help] Player Trail
 
Yeah with zero will be no trail and no but i will test it :D

Edit*
okay no way, the same problem

mrhellish 11-16-2011 04:53

Re: [Help] Player Trail
 
Quote:

Originally Posted by Pattinho (Post 1597304)
Yeah with zero will be no trail and no but i will test it :D

Edit*
okay no way, the same problem

Hmm, try with set_task?
i think it will be sth like that:
PHP Code:

#define SOME_TASK 90218
public PreThink(id) {
    
    static 
Float:vel[3], bool:settrail[33];
    
    
    
pev(idpev_velocityvel);
    if (
vel[0] == 0.0 && vel[0] == 0.0 && vel[0] == 0.0) {
        
settrail[id] = true;
        if (
task_exists(SOME_TASK+id)) remove_task(SOME_TASK+id);
    else if (
settrail[id]) {
        
set_task(255.0*0.1"task_set_trail"SOME_TASK+id);
        
settrail[id] = false;
    }

public 
task_set_trail(id) {
    
id-=SOME_TASK;
    if (
is_user_alive(id)) trail(id);
}
public 
client_disconnect(id) if (task_exists(SOME_TASK+id)) remove_task(SOME_TASK+id); 

and make life 255

Pattinho 11-16-2011 05:30

Re: [Help] Player Trail
 
It doesn't work, but i think i have an idea how to do it. I will save the user origin and try to do the trail between the origin and that i do it every 255 sec so when the trail is over, he do it again with the saved origin.

*Edit1: I tested it now and it works good, who wants to know, should ask me.

joshknifer 11-16-2011 11:54

Re: [Help] Player Trail
 
Quote:

Originally Posted by Pattinho (Post 1597319)
It doesn't work, but i think i have an idea how to do it. I will save the user origin and try to do the trail between the origin and that i do it every 255 sec so when the trail is over, he do it again with the saved origin.

*Edit1: I tested it now and it works good, who wants to know, should ask me.

You should just post so people can find it later.


All times are GMT -4. The time now is 08:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.