AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Array must be indexed (https://forums.alliedmods.net/showthread.php?t=87464)

nmk 03-12-2009 09:57

Array must be indexed
 
Hello, I'm trying to edit basebans.sp file, because I have a big problem with cracked server bans :) New crack changes pending id to steam_0:0:0 so I can ban players only in rcon with sm_banip command.

Compiler error:
basebans.sp(240) : error 033: array must be indexed (variable "authid")
basebans.sp(281) : error 033: array must be indexed (variable "arg")

Script:

Quote:

if (strncmp(authid, "STEAM_0:", 8) != 0 || authid == "STEAM_0:0:0")
{
ReplyToCommand(client, "[SM] %t", "Invalid SteamID specified");
return Plugin_Handled;
}

and line 281:

if (strncmp(arg, "STEAM_0:", 8) == 0 || arg != "STEAM_0:0:0")
{
ban_flags |= BANFLAG_AUTHID;
}
else
{
ban_flags |= BANFLAG_IP;
}
I dont understand where is problem, because I worked only wih php, and dont know what is this programming language.

Please help :)

BOYSplayCS 03-12-2009 09:58

Re: Array must be indexed
 
This section is not for SourceMod Scripting Help.

nmk 03-12-2009 09:59

Re: Array must be indexed
 
oh, sorry...

I don't want to flood by creating new topic's please help ;/

Sn!ff3r 03-12-2009 10:02

Re: Array must be indexed
 
Scripting is like PAWN.
PHP Code:

if (StringList[0] == "Hello")       //INVALID
if (StringList[0][0] == "Hello")    //INVALID
if (equali(StringList[0], "Hello")) //Valid 

Change equali to sourcemod string comparsion function.

nmk 03-12-2009 10:05

Re: Array must be indexed
 
hm, it don't understand how to change my script...

YamiKaitou 03-12-2009 10:08

Re: Array must be indexed
 
You can't use != on a string, you have to use StrEqual

Also, moved to SM section

nmk 03-12-2009 10:11

Re: Array must be indexed
 
Ok, I understand.

StrEqual() is !=

And how to use == ?

YamiKaitou 03-12-2009 10:15

Re: Array must be indexed
 
No, !StrEqual() is basically the same as !=. StrEqual() is basically the same as ==.

If you read what the function returns, you should have been able to figure this out yourself.
Quote:

Return:
True if equal, false otherwise.

nmk 03-12-2009 10:17

Re: Array must be indexed
 
Thanks, +REP

Lebson506th 03-12-2009 11:01

Re: Array must be indexed
 
Quote:

cracked server bans
No steam, no support


All times are GMT -4. The time now is 16:48.

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