Raised This Month: $ Target: $400
 0% 

first script in ages 4 errors left


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ErUs
Junior Member
Join Date: Jun 2004
Old 06-05-2004 , 12:54   first script in ages 4 errors left
Reply With Quote #1

Code:
#include <amxmodx> #include <cstrike> public getplayor() {   new x = 0   new playaz[64]   for ( x=1; 65; x = (x + 1) ) {     cs_reset_user_model(x);     if (cs_get_user_team(x) == 1) {       playaz[x] = 1     }     else if (cs_get_user_team(x) == 2) {       playaz[x] = 2     }     else playaz[x] = 0   } changeth(x) } public changeth(x) {        while( x < 65 ) {   x = random_num(1,64)   if (playaz[x] > 0) {     cs_set_user_model( x , "hostage01.mdl");     break     }     } } public plugin_init() {   register_plugin("Tomsmod","0.01","TOM aka ErUs")   register_event("ResetHUD", "getplayor", "be") }

Theres probly something i done stupidly wrplz correct for me
[/code]
__________________
ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS
ErUs is offline
Mugwump
Senior Member
Join Date: May 2004
Old 06-05-2004 , 14:12  
Reply With Quote #2

Did you intend for the condition portion of your loop to be just 65? Or did you mean something like this:

(for new x=1; x<65; x=x+1)

? I don't think you have a stopping condition in your loop, so I would revise that ...

Also, is it complaining about loose indentation, or is that just an effect from posting it here, as the indentation could cause problems if the indentation of the code doesn't follow the intended logic flow ...

Please post the error messages, that would help.

Mugwump
Mugwump is offline
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 06-05-2004 , 14:22  
Reply With Quote #3

change
"for ( x=1; 65; x = (x + 1) ) {"
to
"for ( x=1; x<=65; ++x) {"
and make
new playaz[64] a global variable

also playaz[64] dont need to be 64 cause there are only max 32 players
it should be changed to 33 and therefore also 65 to 32 at "for ( x=1; x<=65; ++x) {"
it should not be
Code:
   }     else playaz[x] = 0   } changeth(x) }
but
Code:
   }     else playaz[x] = 0   }   changeth(x) }
look at the position of changeth(x)

dont really understand what your plugin should do?
__________________
alias White Panther
karlos is offline
ErUs
Junior Member
Join Date: Jun 2004
Old 06-05-2004 , 14:31  
Reply With Quote #4

its ment to change a random players model at the start of each round
__________________
ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS ERUS
ErUs is offline
[FBX]
Senior Member
Join Date: May 2004
Old 06-05-2004 , 23:17  
Reply With Quote #5

interesting method, I would have simply used gotten the players, changed one's random model, and just left it at one function... but thats me. You do realize that playaz isnt a global variable and thus the function changeth couldn't possibly know that the two the same. You can either pass playaz to changeth or you could be lazy like the rest of us and make it global (by declaring it outside of a function, at the top of the script).
[FBX] is offline
T(+)rget
Senior Member
Join Date: Mar 2004
Old 06-06-2004 , 19:12  
Reply With Quote #6

This part is wrong:
Code:
new playaz[64] 
for ( x=1; 65; x = (x + 1) ) {
It should be:
Code:
new playaz[64] 
for (x=0; x < 64; x++) {
You can't have your arrays smaller than your range.
T(+)rget is offline
Reply


Thread Tools
Display Modes

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 14:51.


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