AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error Array dimensions !! (https://forums.alliedmods.net/showthread.php?t=255174)

Kakarotto 01-11-2015 15:49

Error Array dimensions !!
 
Guys i am looking for someone to fix this plugin for me so when i compile it i get this error :
Error: Array dimensions do not match on line 21

can someone fix it plz !
PHP Code:

#include <amxmodx>

#define PLUGIN_NAME "One IP only"
#define PLUGIN_AUTHOR "IDK"
#define PLUGIN_VERSION "1.0"

#define MAXPLAYERS 32

new g_ip[33][33]

public 
plugin_init()
{
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
}
public 
client_connect(id)
{
new 
szIp[22]
get_user_ip(idszIpcharsmax(szIp),1)
for(new 
i;i<MAXPLAYERS;i++)
{
if(
equal(szIp,g_ip))
{
new 
userid get_user_userid(id)
server_cmd("kick #%d ^"Go away faggot^""userid)
}
}
get_user_ip(idg_ip[id], 33,1)
}
public 
client_disconnect(id)
{
g_ip[id][0]=0



Fuck For Fun 01-11-2015 17:31

Re: Error Array dimensions !!
 
Code:

new g_ip[33][33]
:arrow:
Code:

new g_ip[33];
------------------
Code:

g_ip[id][0]=0
:arrow:
Code:

g_ip[id] = 0

Natsheh 01-12-2015 07:18

Re: Error Array dimensions !!
 
Why do you need to loop exactly? @client connect?

& @Fuck for fun you'r code is wrong it must be like this g_ip[33][32] so you can format the users ip, & you changed it to this g_ip[33] so the ip cannot be saved as integer...

Flick3rR 01-12-2015 08:08

Re: Error Array dimensions !!
 
Better try with creating a trie where to save some valur for the player's IP (as a key). Do that on connect. And instead of looping all the players in the server and checking manually each one's IP, you can just check if the trie key exists and that'd be enough. You can use also some boolean to detect the actual player with the current IP and use it like an rxtra check on connect, just to be more sure. If you didn't get it at all, I can show some example when I get home.


All times are GMT -4. The time now is 15:30.

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