AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Eh help array prob :( (https://forums.alliedmods.net/showthread.php?t=30051)

vbSteve 06-21-2006 07:41

Eh help array prob :(
 
Eh? How do I make this array to work?
(I'm used to Visual Basic language) :shock:


Code:
#include <amxmodx> #include <amxmod> #include <amxmisc> #include <engine> #include <fun> #define PLUGIN "HP Mod" #define VERSION "1.23" #define AUTHOR "mCoDev Systems" #define MAX_PLAYERS 33 new portusCoords[MAX_PLAYERS][3]; // Portus coordinates TO public plugin_init() {     register_clcmd("say /setportus", "setPortus")// Set teleport TO origins     register_clcmd("hpmod_setportus", "setPortus"); // Set teleport TO origins     register_clcmd("say /goportus", "goPortus");    // Teleport the user     register_clcmd("hpmod_goportus", "goPortus");   // Teleport the user } public setPortus(id){     if(is_user_alive(id)){         // Set coordinates TELEPORT_EXIT         get_user_origin(id, portusCoords[id]);         client_print(id, print_chat, "[HP Mod] Set portus to (%i, %i, %i)", portusCoords[id][1], portusCoords[id][2], portusCoords[id][3]);     }         return PLUGIN_HANDLED; } public goPortus(id){     if(is_user_alive(id)){         // Go to teleport coords:         set_user_origin(id, portusCoords[id]);     }     return PLUGIN_HANDLED; }

Code:

C:\Small Compiler>compile amxx_wizard.cpp
Small compiler 2.6.0            Copyright (c) 1997-2004, ITB CompuPhase

amxx_wizard.cpp(233) : error 032: array index out of bounds (variable "portusCoo
rds")

1 Error.


Cheap_Suit 06-21-2006 07:45

Where is that line?

Is MAX_PLAYERS = 33?

Xanimos 06-21-2006 07:47

You need to have the line
#define MAX_PLAYERS 33

after you includes.

[edit] Nope not whole plugin....

vbSteve 06-21-2006 07:47

yeh, 33
sorry didn't inlude the whole code.

> #defile MAX_PLAYERS 33

Xanimos 06-21-2006 07:49

well show us the line where it messes up
its line 233. also show the function around that line.

vbSteve 06-21-2006 07:53

Code:
...
lol dunno if that helps you :)

Xanimos 06-21-2006 07:57

Doh!

CheapSuit, we missed the mistake in the first post.

Code:
        client_print(id, print_chat, "[HP Mod] Set portus to (%i, %i, %i)", portusCoords[id][1], portusCoords[id][2], portusCoords[id][3]);
should be
Code:
        client_print(id, print_chat, "[HP Mod] Set portus to (%i, %i, %i)", portusCoords[id][0], portusCoords[id][1], portusCoords[id][2]);

Cheap_Suit 06-21-2006 08:00

Here's your problem

Code:
 client_print(id, print_chat, "[HP Mod] Set portus to (%i, %i, %i)", portusCoords[id][1], portusCoords[id][2], portusCoords[id][3]); Should be portusCoords[id][0], portusCoords[id][1], portusCoords[id][2]

Cheap_Suit 06-21-2006 08:00

bah u beat me

vbSteve 06-21-2006 08:02

Eh! :P Thanks! :oops:


All times are GMT -4. The time now is 08:00.

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