Raised This Month: $ Target: $400
 0% 

Code help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
poiuy_qwert
Junior Member
Join Date: Mar 2004
Old 09-29-2004 , 08:37   Code help
Reply With Quote #1

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 }
__________________
[p_q]poiuy_qwert[z_p]
poiuy_qwert is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 09-29-2004 , 09:11  
Reply With Quote #2

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.
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 09-29-2004 , 11:47  
Reply With Quote #3

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?
__________________
twistedeuphoria is offline
poiuy_qwert
Junior Member
Join Date: Mar 2004
Old 09-29-2004 , 12:24  
Reply With Quote #4

Perfectly correct.
__________________
[p_q]poiuy_qwert[z_p]
poiuy_qwert is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:01.


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