WB Coding get info by chat message?

Currently Viewing (Users: 0, Guests: 1)

Kosolov325

Recruit
WB
Best answers
1
Its possbile to take information by client chat? (I'm using WSE)
(i'm creating a door/house owner system)

I'm trying to get a message sent by the player and save in a string to check if that "text" has a player name (Otherwise i will create a menu, but i don't like this idea, because i dont know how to do it only by server-side)

Code:
            (else_try),
             (str_contains, s0, "@/setkeys {s22} {s23}"),
             (str_contains, s22, ":other_agent_id"),
             (gt, ":player_is_closer", 0),
             (player_set_slot, s22, slot_player_door_key, s23),
             (multiplayer_send_string_to_player, s22, server_event_script_message, "@Admin {s1} gived you the keys of {s22} door"),
 

Pitch

Sergeant at Arms
WBNWVCM&BWF&S
Best answers
8
This script listens for chat messages.
Python:
#script_wse_chat_message_received
# Called each time a chat message is received (both for servers and clients)
# INPUT
# script param 1 = sender player no
# script param 2 = chat type (0 = global, 1 = team)
# s0 = message
# OUTPUT
# trigger result = anything non-zero suppresses default chat behavior. Server will not even broadcast messages to clients.
# result string = changes message text for default chat behavior (if not suppressed).
("wse_chat_message_received", [
    (store_script_param, ":player_no", 1),
    (store_script_param, ":chat_type", 2),
]),
Everytime someone sends a chat message, you have to make loop throught players on the server to check is s0 (message content) is equal to player username.