AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What's wrong with this? (https://forums.alliedmods.net/showthread.php?t=19605)

v3x 10-20-2005 21:42

What's wrong with this?
 
I can't seem to find the problem.. People have been saying they've been getting "bad loads" with it:
Code:
#include <amxmodx> #define PLUGIN  "Connect Announce" #define VERSION "0.2b" #define AUTHOR  "v3x" new g_iMsgSayText, g_szSoundFile[] = "buttons/blip1.wav"; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_cvar("announce_mode","3");     register_cvar("announce_sound","1");     g_iMsgSayText = get_user_msgid("SayText"); } /* announce_mode <0|1|2|3> 0 - Off 1 - Connect announce only 2 - Disconnect announce only 3 - Both announce_sound <0|1> 0 - No sound 1 - Sound */ public plugin_precache() {     precache_sound(g_szSoundFile); } public client_authorized(id) {     new iMode = get_cvar_num("announce_mode");         if(is_user_bot(id) || iMode == 0 || iMode == 2)         return PLUGIN_CONTINUE;     new szUserName[33];     get_user_name(id, szUserName, 32);     new iPlayers[32], iNum, i;     get_players(iPlayers, iNum);     for(i = 0; i <= iNum; i++)     {         new x = iPlayers[i];         if(!is_user_connected(x) || is_user_bot(x)) continue;         if(get_cvar_num("announce_sound") == 1)             client_cmd(x, "spk %s", g_szSoundFile);         new szMessage[164];         format(szMessage, 163, "^x04%s connected", szUserName);         message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );         write_byte  ( x );         write_string( szMessage );         message_end ();     }     return PLUGIN_CONTINUE; } public client_disconnect(id) {     new iMode = get_cvar_num("announce_mode");         if(is_user_bot(id) || iMode == 0 || iMode == 1)         return PLUGIN_CONTINUE;     new szUserName[33];     get_user_name(id, szUserName, 32);     new iPlayers[32], iNum, i;     get_players(iPlayers, iNum);     for(i = 0; i <= iNum; i++)     {         new x = iPlayers[i];         if(!is_user_connected(x) || is_user_bot(x)) continue;         if(get_cvar_num("connect_sound") == 1)             client_cmd(x, "spk %s", g_szSoundFile);         new szMessage[164];         format(szMessage, 163, "^x04%s disconnected", szUserName);         message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );         write_byte  ( x );         write_string( szMessage );         message_end ();     }     return PLUGIN_CONTINUE; }
v0.1 is in the Approved Plugins section if you need to see it.

knekter 10-20-2005 23:05

well I think it occurs here:
Code:
message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x ); write_byte  ( x ); write_string( szMessage ); message_end ();
write_byte(x) isn't meant for player ID. Destination can be 1=notify, 2=console, 3=chat, or 4=center...

v3x 10-22-2005 02:18

Ok, but it still gives a bad load..

Freecode 10-22-2005 03:06

SayTex - byte, string, string, string
1: Destination,
2: Predefined String
3: Unknown,
4: Text said

Destination can be 1=notify, 2=console, 3=chat, or 4=center
Some values of the predifined string: #Cstrike_Chat_AllDead, #Cstrike_Chat_All

v3x 10-22-2005 03:26

Ok, so what exactly should I put? As of now I have this:
Code:
new szMessage[164]; format(szMessage, 163, "^x04%s connected", szUserName); message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x ); write_byte  ( 3 ); write_string( szMessage ); message_end ();

Brad 10-22-2005 08:14

Re: What's wrong with this?
 
Quote:

Originally Posted by v3x
I can't seem to find the problem.. People have been saying they've been getting "bad loads" with it:

Have any of them placed "debug" after the plugin name and then given you the additional information it provides?

v3x 10-23-2005 00:05

I don't believe so.

v3x 10-23-2005 22:27

Anyone? o.O

Freecode 10-23-2005 22:52

comment out the message see if it still gives you bad load.

XxAvalanchexX 10-23-2005 22:55

Why are you using the saytext message and not simply client_print?


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

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