First of all is PlayerName an array that begins with entyr 1 or 0. It's most common to start them with 0 in C++. It could crash if you access some bad memory, but it's also likely to go on.
Second of all the way you handle strings is awful. First of all you are using the unsafe versions of strcat and sprintf, where you don't even pass the lenght of the string. That's bound to give buffer overruns if you pass too long playernames and other strings, or if there are too many players. The safe (but slower) way to do is this finding out how long the string should be, allocating the string dynamically using the new char[] operator, and then delete[] the string. You could also make the static string long enough, but that's also stupid, if you made it longer than required, you are wasting memory, and esspecially if you do it on stack memory, that's just a plain waste of resources. The good news is that I don't see any mistakes in the way you execute the command once you have done it. Oh and next time, be sure to include all the variable declarations so we know the type of them and the size of them, esspecially the strings. ----- Original Message ----- From: "Ashvin Dookun" <[email protected]> To: "Discussion of Half-Life Programming" <[email protected]> Sent: Thursday, June 04, 2009 4:00 AM Subject: [hlcoders] Player Menu + Other Questions > Hi, I'm currently making a source plug-in however, a menu used to kick > players isn't working. Well it works sometimes then randomly doesn't :S. > If anyone could solve this it would be much appreciate, I'm open to change > the method in which menu is created. > > complies but crashes server. > for(int i = 1; i <= active_players; i++) > { > sprintf(menulinetext,"%i %s \n", i, PlayerName[i]); > strcat(menustring,menulinetext); > } > strcat(menustring,"0. Exit \n"); > UTIL_SendMenu(pEntity, 10, menustring); > > > > ___________________________________________________ > > Also is there a way to check what other plug-ins are LOADED? > The code which i currently use checks to see if the plug-in file exists, > however i don't like this method as it doesn't verify the plug-in has been > loaded. > > Another question is there away to find if Source TV is currently > recording? > perhaps there is a file with sourcetv functions? > > Any help is much appreciated :D. > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

