AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   find_player() problem ... (https://forums.alliedmods.net/showthread.php?t=19487)

TheEagle 10-17-2005 21:14

find_player() problem ...
 
Ok I'm pretty new to this stuff (last time I wrote a plugin was for amx 0.9.7 :P ) ... but a friend asked me to write a little plugin and since it didn't seem SO hard to do, I gave it a try. All fine, cept I'm running against a wall using the find_player() function.

Code:

public catch_say(id)
{
        if (g_playermode[id]==0) return PLUGIN_CONTINUE
        new message[192]
        new playername[32]
        new param[32]
        new player = 0
        read_args(message, 191)
        strtok(message,playername,32,param,32,' ')
        player = find_player("bhl",playername)
                       
        if (!player)
        {
                server_cmd("say Couldn't find player with: %s", playername)
                g_playermode[id]=0
                return PLUGIN_CONTINUE
        }
 
...

This function is called when a player "says" something using "messagemode". I then try to extract a playername as first word in the messagetext. But find_player("bhl"...) doesn't return a player number. But in the following error message I see that "playername" has exactly the value I expect it to have (the part of the playername extracted from the message). I also tried with all other flags of "find_player()" ... it's simply not working. But if I hardcode a playername e.g.

Code:

find_player("a","TheEagle")
it works.

Any1 got an idea what I am doing wrong?

(Amxx version 1.60, Metamod 1.18, Windows)

TheEagle 10-22-2005 19:12

Solved.

The problem seems to be the read_args() function. It fills the string, I can use it for output for example. But the find_player() function obviously can't read the string. If I use read_argv() to get my string, everything is just fine. Possible bug in read_args? Or am I understanding something wrong here?


All times are GMT -4. The time now is 23:36.

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