Raised This Month: $ Target: $400
 0% 

Whats with index out of bounds in my array!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-05-2005 , 14:47   Whats with index out of bounds in my array!
Reply With Quote #1

I don't get it... its like impossible for this line of code to be out of bounds...
fakecivorigin[0] = fakecivX[npcid];

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> new Float:fakecivX[14] = {2959.0,2753.0,2129.0,2129.0,2129.0,2006.0,1064.0,65.0,65.0,-1633.0,-1633.0,-2256.0,-2221.0,-1568.0} new Float:fakecivY[14] = {-515.0,72.0,120.0,120.0,120.0,-1849.0,-2220.0,-1655.0,-1655.0,-89.0,-89.0,-1577.0,-2036.0,-1431.0} new Float:fakecivZ[14] = {-284.0,-264.0,-252.0,-252.0,-252.0,-172.0,-252.0,-284.0,-284.0,-268.0,-268.0,-292.0,-236.0,-284.0} new fakecivvoice[14] = {1,1,1,2,2,1,2,1,2,2,2,1,1,1} new fakecivnames[14] new npcid = 0 //new usedcivs[14] //new nextusedciv = 0 public plugin_init() {     register_plugin("FakeCiv","0.1","-Snort- Leader")     register_clcmd("spawnthemmofos","spawnfakecivs")     } public spawnfakecivs(id) {           format(fakecivnames[0],16,"Bob Thompson")     format(fakecivnames[1],16,"Paul O Connor")     format(fakecivnames[2],16,"Big Smoke")     format(fakecivnames[3],16,"Snoop Dogg")     format(fakecivnames[4],16,"Mr. Woot")     format(fakecivnames[5],16,"Sonni")     format(fakecivnames[6],16,"Dan Ackroid")     format(fakecivnames[7],16,"Fomerly Known as Prince")     format(fakecivnames[8],16,"Cesar Hernadez")     format(fakecivnames[9],16,"Howard Stern")     format(fakecivnames[10],16,"Jack Black")     format(fakecivnames[11],16,"Tom Clancy")     format(fakecivnames[12],16,"Ben Dover")     format(fakecivnames[13],16,"Inspector Gadget")           if ( npcid == 14 ) {         client_print(id,print_chat,"OMG OMG OMG npcid == 14")             return PLUGIN_HANDLED         }     new fakecivcreateent[14]         //new randomnumber         //randomnumber = (random_num(0,14))         new Float:fakecivorigin[3];         fakecivorigin[0] = fakecivX[npcid];         fakecivorigin[1] = fakecivY[npcid];         fakecivorigin[2] = fakecivZ[npcid];         new entclassname[18]         format(entclassname[npcid],17,"fake_civilian%i",npcid)         fakecivcreateent[npcid] = create_entity("info_target")         entity_set_string(fakecivcreateent[npcid],EV_SZ_classname,entclassname[npcid]);         entity_set_model(fakecivcreateent[npcid],"models/barry.mdl");         entity_set_origin(fakecivcreateent[npcid],fakecivorigin)         DispatchSpawn(fakecivcreateent[npcid])         client_print(id,print_chat,"Civlian %s has been spawned!",fakecivnames[npcid])         npcid = npcid + 1           return PLUGIN_HANDLED } public pfn_touch(ptr,ptd) {     new i     if(ptr < 1 || ptd < 1 || ptd > 32 || !is_user_alive(ptd) || !is_user_connected(ptd)) {         return PLUGIN_CONTINUE;           }      new classname[33];      entity_get_string(ptr,EV_SZ_classname,classname,32);         for (i=0; i<sizeof(fakecivX); i++ ) {             new entclassname[18]             format(entclassname[i],16,"fake_civilian%i",i)                 if(equal(classname,entclassname[i]) == 1) {                     new fakecivphrase[14]                         if (fakecivvoice[i] == 1) {                             format(fakecivphrase[i],64,"%s says, ^"Stop breathing on me!^"",fakecivnames[i])                             client_print(ptd,print_chat,"%s",fakecivphrase)                             client_cmd(ptd,"speak fakeciv/stopbreathingonme.wav")                             return PLUGIN_HANDLED                         }                         if (fakecivvoice[i] == 2) {                             format(fakecivphrase[i],64,"%s says, ^"Back off homie!^"",fakecivnames[i])                             client_print(ptd,print_chat,"%s",fakecivphrase)                             client_cmd(ptd,"speak fakeciv/backhomie.wav")                             return PLUGIN_HANDLED                         }                     }                 }             return PLUGIN_CONTINUE         }                           public plugin_precache() {     precache_sound("fakeciv/backhomie.wav")     precache_sound("fakeciv/stopbreathingonme.wav")     precache_model("models/barry.mdl") }
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
 



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 19:27.


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