AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Touch entity trigger_once doesn't work. (https://forums.alliedmods.net/showthread.php?t=222025)

wicked95 07-29-2013 05:54

Touch entity trigger_once doesn't work.
 
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.

ConnorMcLeod 07-29-2013 06:00

Re: Touch entity trigger_once doesn't work.
 
Does your entity have a touchable size and a touchable solid (SOLID_TRIGGER or >) property ?

wicked95 07-29-2013 06:12

Re: Touch entity trigger_once doesn't work.
 
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 :D

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.

ConnorMcLeod 07-29-2013 06:36

Re: Touch entity trigger_once doesn't work.
 
What is the Z size of the entity ?
Oh, it is solid so player can't pass through it ?

wicked95 07-29-2013 13:29

Re: Touch entity trigger_once doesn't work.
 
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;
    } 

:D


All times are GMT -4. The time now is 15:45.

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