Raised This Month: $ Target: $400
 0% 

[Help] Player Trail


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pattinho
Member
Join Date: Dec 2007
Old 11-15-2011 , 15:17   [Help] Player Trail
Reply With Quote #1

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

Last edited by Pattinho; 11-15-2011 at 15:17.
Pattinho is offline
mrhellish
Junior Member
Join Date: Jun 2010
Old 11-15-2011 , 16:09   Re: [Help] Player Trail
Reply With Quote #2

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;
    }


Last edited by mrhellish; 11-15-2011 at 16:16.
mrhellish is offline
Pattinho
Member
Join Date: Dec 2007
Old 11-15-2011 , 16:37   Re: [Help] Player Trail
Reply With Quote #3

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();


Last edited by Pattinho; 11-15-2011 at 16:38.
Pattinho is offline
Pattinho
Member
Join Date: Dec 2007
Old 11-16-2011 , 04:25   Re: [Help] Player Trail
Reply With Quote #4

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 ?
Pattinho is offline
mrhellish
Junior Member
Join Date: Jun 2010
Old 11-16-2011 , 04:30   Re: [Help] Player Trail
Reply With Quote #5

Quote:
Originally Posted by Pattinho View Post
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?
mrhellish is offline
Pattinho
Member
Join Date: Dec 2007
Old 11-16-2011 , 04:35   Re: [Help] Player Trail
Reply With Quote #6

Yeah with zero will be no trail and no but i will test it

Edit*
okay no way, the same problem

Last edited by Pattinho; 11-16-2011 at 04:42.
Pattinho is offline
mrhellish
Junior Member
Join Date: Jun 2010
Old 11-16-2011 , 04:53   Re: [Help] Player Trail
Reply With Quote #7

Quote:
Originally Posted by Pattinho View Post
Yeah with zero will be no trail and no but i will test it

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
mrhellish is offline
Pattinho
Member
Join Date: Dec 2007
Old 11-16-2011 , 05:30   Re: [Help] Player Trail
Reply With Quote #8

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.

Last edited by Pattinho; 11-16-2011 at 09:31.
Pattinho is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 11-16-2011 , 11:54   Re: [Help] Player Trail
Reply With Quote #9

Quote:
Originally Posted by Pattinho View Post
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.
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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