Raised This Month: $ Target: $400
 0% 

Error Array dimensions !!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kakarotto
Senior Member
Join Date: Apr 2014
Old 01-11-2015 , 15:49   Error Array dimensions !!
Reply With Quote #1

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

__________________
BANNED !!
Kakarotto is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 01-11-2015 , 17:31   Re: Error Array dimensions !!
Reply With Quote #2

Code:
new g_ip[33][33]

Code:
new g_ip[33];
------------------
Code:
g_ip[id][0]=0

Code:
g_ip[id] = 0
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-12-2015 , 07:18   Re: Error Array dimensions !!
Reply With Quote #3

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...

Last edited by Natsheh; 01-12-2015 at 07:24.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 01-12-2015 , 08:08   Re: Error Array dimensions !!
Reply With Quote #4

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.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Reply



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 02:08.


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