AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error printing green chat messages (https://forums.alliedmods.net/showthread.php?t=57570)

mateo10 07-07-2007 06:33

Error printing green chat messages
 
What is wrong with this code?
I know I'm missing something obvious, but I can't find it.
Code:
public print_green(id, const msg[], {Float,Sql,Result_}:...) {     static message[256];     message[0] = 0x04;     vformat(message[1], 251, msg, 4);     message[192] = '^0';     new index, msg_type;     if(!id)     {         index = FindPlayer();         msg_type = MSG_ALL;     }     else     {         index = id;         msg_type = MSG_ONE     }     emessage_begin(msg_type, get_user_msgid("SayText"), _, index);     ewrite_byte(index);     ewrite_string(message);     emessage_end(); } FindPlayer() {     new i = -1;     while(i <= 31)     {         if(is_user_connected(++i))         {             return i;         }     }     return -1; }

AlMod 07-07-2007 12:08

Re: Error printing green chat messages
 
in FindPlayer u don't increase "i"
add i++ in while cycle

mateo10 07-07-2007 12:18

Re: Error printing green chat messages
 
I increase it in if(is_user_connected(++i))

teame06 07-07-2007 13:38

Re: Error printing green chat messages
 
Code:
vformat(message[1], 251, msg, 4); //to vformat(message[1], 251, msg, 3); while(i <= 31) //to while(i <= 32)


All times are GMT -4. The time now is 21:32.

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