Raised This Month: $ Target: $400
 0% 

Run Time Error


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 03-10-2005 , 23:49   Run Time Error
Reply With Quote #1

Well I'm trying to make a command where any player in the server can open the console and type 'mslap <number of slaps >' and it will slap them according to the amount of slaps they output.

Code :
Code:
#include <amxmodx> #include <amxmisc> new pName[] = "Mult Self Slap" new pVersion[] = "v0.1" new pAuthor[] = "Nicholas Glistak" new msSlaps[33] = 0 public plugin_init ( ) {     register_plugin ( pName, pVersion, pAuthor )     register_clcmd ( "mslap", "MultSelfSlap", -0, " < Usage : mslap |Number Of Slaps| > " )         register_cvar ( "aios_msSlaps", "1" )     register_cvar ( "aios_msLimit", "2" )     register_event ( "ResetHUD", "msSlaps_Reset", "a" ) } public client_connect ( id ) {     msSlaps[id] = 0 } public msSlaps_Reset () {     new Players[32], iPlayers     get_players ( Players, iPlayers, "a" )     for ( new x = 0; x <= iPlayers; x++ )     {         msSlaps[x] = 0     } } public MultSelfSlap ( ids[] ) {     new id = ids[0]     new name[32]     get_user_name ( id, name, 31 )     new argv[32]     read_argv ( 1, argv, 31 )     new msNum     msNum = str_to_num ( argv )     if ( get_cvar_num ( "aios_msSlaps" ) != 1 ) {         client_print ( id, print_console, "[AIOS] Sorry this function is turned OFF" )         return PLUGIN_HANDLED     }     if ( msNum > 100 ) {         client_print ( id, print_console, "[AIOS] You cannot slap yourself more than 100 times" )         return PLUGIN_HANDLED     }     new MAX_SLAPS = get_cvar_num ( "aios_msLimit" )     if ( msSlaps[id] > MAX_SLAPS ) {         client_print ( id, print_console, "[AIOS] Sorry %s : You have used this function too many times this round", name )         return PLUGIN_HANDLED     } else {         new SlapDmg = get_cvar_num ( "aios_SlapDmg" )         for ( new i = 0; i < msNum; i++ )         {             user_slap ( id, SlapDmg )         }         msSlaps[id]++     }     new r = random ( 256 )     new g = random ( 256 )     new b = random ( 256 )         set_hudmessage ( r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1 )     show_hudmessage ( 0, "[AIOS] %s : Has slapped himself %d times", name, msNum )     console_print ( 0, "[AIOS] Client %s : Has slapped himself %d times", name, msNum )     return PLUGIN_HANDLED }

Compiles with no errors or warnings.
but I do get a run time error on this line :
Code:
if ( msSlaps[id] > MAX_SLAPS ) {
and the error is :
Code:
L 03/10/2005 - 20:42:19: [AMXX] Run time error 4 (index out of bounds) on line 59 (file "mult_self_slap.sma").
__________________
Nick is offline
Send a message via MSN to Nick
 



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 13:59.


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