The code:
PHP Code:
public plugin_init() {
register_touch("trigger_once", "player", "FwdPlayerTouchTriggerOnce");
}
public FwdPlayerTouchTriggerOnce(ent, id)
{
if(is_user_alive(id))
{
return PLUGIN_HANDLED;
}
new PlayerName[32]
static targetName[32]
static msg[100]
get_user_name(id, PlayerName, 31)
entity_get_string(entity, EV_SZ_targetname, targetName, charsmax(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(playerid, colorid, msg[])
{
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.