Raised This Month: $ Target: $400
 0% 

Touch entity trigger_once doesn't work.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wicked95
Member
Join Date: Dec 2012
Old 07-29-2013 , 05:54   Touch entity trigger_once doesn't work.
Reply With Quote #1

The code:
PHP Code:
public plugin_init() {
     
register_touch("trigger_once""player""FwdPlayerTouchTriggerOnce");
}
 
public 
FwdPlayerTouchTriggerOnce(entid)
{
    if(
is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    }
     new 
PlayerName[32]
     static 
targetName[32]
     static 
msg[100]
     
get_user_name(idPlayerName31)
     
entity_get_string(entityEV_SZ_targetnametargetNamecharsmax(targetName));
     if(
equal(targetName"finishline"))
     {
          
format(msg,99,"^x04%s finished the map."PlayerName);
          
client_color(0,1,msg);
          
HasLife[id] = false;
          
user_kill(id);
     }
     return 
PLUGIN_HANDLED;
}
 
public 
client_color(playeridcoloridmsg[])
{
     
message_begin((playerid== 0) ? MSG_ALL MSG_ONE,gmsgSayText,_,playerid
     
write_byte(colorid)
     
write_string(msg)
     
message_end()

When i searched i found only this http://forums.alliedmods.net/showthread.php?p=1723370 . I've modified the code many times but no effect. I can't uderstand whats wrong with it. I created a map with an object trigger_once at the end of it with a name "finishline". It doesn't give any errors but it doesn't work too.

Last edited by wicked95; 07-29-2013 at 05:55.
wicked95 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-29-2013 , 06:00   Re: Touch entity trigger_once doesn't work.
Reply With Quote #2

Does your entity have a touchable size and a touchable solid (SOLID_TRIGGER or >) property ?
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-29-2013 at 06:00.
ConnorMcLeod is offline
wicked95
Member
Join Date: Dec 2012
Old 07-29-2013 , 06:12   Re: Touch entity trigger_once doesn't work.
Reply With Quote #3

I only created a cylinder object with class trigger_once and set it's name "finishline". Is there something else i have to do?

If by solid you mean "can the player touch it?" than yes it's solid

My english is not that good so i'ts hard for me to understand some words

This is the entity: http://s2.************/53irwbfzt/29_7_2013_13_18_16.png
The one in red. I want when a player steps on it to activate the functions in the code.

Last edited by wicked95; 07-29-2013 at 06:24.
wicked95 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-29-2013 , 06:36   Re: Touch entity trigger_once doesn't work.
Reply With Quote #4

What is the Z size of the entity ?
Oh, it is solid so player can't pass through it ?
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-29-2013 at 06:36.
ConnorMcLeod is offline
wicked95
Member
Join Date: Dec 2012
Old 07-29-2013 , 13:29   Re: Touch entity trigger_once doesn't work.
Reply With Quote #5

I'm sorry looks like the trigger_once entity wasn't solid. there was another object down of it that i forgot and i was steping on it rather than the trigger_once entity ;x

Problem solved ...

PHP Code:
if(is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    } 
-->
PHP Code:
if(!is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    } 

Last edited by wicked95; 07-30-2013 at 09:52.
wicked95 is offline
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 15:45.


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