AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved] spectator change player (https://forums.alliedmods.net/showthread.php?t=92032)

Hunter-Digital 05-09-2009 08:11

[solved] spectator change player
 
Well, I found a code that can detect if a player spectates in a certain mode... but not if he switches the player in that mode, what's the best way to detect WHEN a spectator views another player than the old one in the same spec mode ?

the code I got 'till now:
PHP Code:

register_message(get_user_msgid("TextMsg"), "msg_textMsg")
//...
 
public msg_textMsg(msgiddestid)
{
    static 
msg[32]
    
get_msg_arg_string(2msg31)
 
    if(
equali(msg"#Spec_Mode4"))
        
client_print(0print_chat"[debug] %s spectating %s in %d mode"get_player_name(id), get_player_name(entity_get_int(idEV_INT_iuser2)), entity_get_int(idEV_INT_iuser1))
 
    return 
PLUGIN_CONTINUE


and I debugged the textmsg, doesn't trigger when I change a player...

Hunter-Digital 05-10-2009 12:10

Re: spectator change player
 
Well, I just maked a global thinking entity and checked every time the user's 1&2 if they are any different from the ones 0.05 seconds ago :}

If anyone has an alternative better way, I'm all... eyes :P

ConnorMcLeod 05-10-2009 12:20

Re: spectator change player
 
See admin_sep player, or joaquim pseudo wallhack plugin, both use 2 event to detect spectated player.

Hunter-Digital 05-10-2009 16:48

Re: spectator change player
 
oohhh, forgot about those xD... aaaaand found it, the event is StatusValue ... testing it out :P thx :crab:

edit: yep, works fine, StatusValue and SpecHealth2 to update the player and TextMsg with arg2 at Spec_Mode to update the mode... :}


All times are GMT -4. The time now is 01:35.

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