AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Code help (https://forums.alliedmods.net/showthread.php?t=6364)

poiuy_qwert 09-29-2004 08:37

Code help
 
Hi. I need some help with this script. When i added:

Code:
NoClip = random_num( 1, Maxpl) while (!is_user_connected( NoClip)) {     NoClip = random_num( 1, Maxpl) }

to the code, i couldn't compile. It woul give the error Internal Error. Im using amxx 0.20 RC2.

Heres the full code if you need it:

Code:
/* No Clip, v0.1 By poiuy_qwert */ #include <amxmodx> #include <fun> new NoClip new Killed new NoClipName[31] new Maxpl = get_maxplayers() public plugin_init() {     register_plugin("No Clip","0.1","poiuy_qwert")     register_event("DeathMsg","deathmsg","a")     register_logevent("roundstart",2,"0=World triggered","1=Round_Start")     register_event( "TextMsg", "mapstart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in" )     return PLUGIN_CONTINUE } public deathmsg() {     Killed = read_data(2)     if(Killed == NoClip) {         NoClip = read_data(1)         get_user_name( NoClip, NoClipName, 30)         client_print( 0, print_chat, "%s will be No Clipped Next Round!", NoClipName)     } } public roundstart() {     set_user_noclip( NoClip )     return PLUGIN_CONTINUE } public mapstart() {     NoClip = random_num( 1, Maxpl)     while (!is_user_connected( NoClip))     {         NoClip = random_num( 1, Maxpl)     }     get_user_name( NoClip, NoClipName, 30)     client_print( 0, print_chat, "%s is the first person to be No Clipped!", NoClipName)     return PLUGIN_CONTINUE }

Zor 09-29-2004 09:11

First off I would change the:

Code:

new Maxpl = get_maxplayers()
to something within the function instead. Lets say:

Code:

new Maxpl
In the global scope and:

Code:

Maxpl = get_playersnum()
Then do your random:

Code:

NoClip = random_num( 1, Maxpl)
if(is_user_connected(NoClip) && is_user_alive(NoClip))
{
      get_user_name( NoClip, NoClipName, 30)
      client_print( 0, print_chat, "%s is the first person to be No Clipped!", NoClipName)

}

Or some such. I can't really understand what you wish to accomplish with this. But this should lead you in the correct direction.

twistedeuphoria 09-29-2004 11:47

I think he's trying to randomly pick some one to be noclipped at the start of the map. Then when a person kills the noclipper, the killer becomes the noclipper. Correct?

poiuy_qwert 09-29-2004 12:24

Perfectly correct.


All times are GMT -4. The time now is 17:14.

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