Other error :p (sorry for the spam)

Started by Kid_Buu, Jan 13, 2018, 06:17 AM

Previous topic - Next topic

Kid_Buu

sorry for the spam, but I do not understand this

Error: [the index '3' does not exist]

The command that causes the error:

else if ( cmd == "addclanmanager" )
{
if ( status[ player.ID ].Level < 9 ) E_MSG( "Usted no tiene acceso a este comando.", player );
else if ( !text ) S_MSG( "Use /addmanager <[Tag]Lider> <[Tag]Manager> <[Tag]Manager> <Clan sin simbolo>", player );
else
{
local params = split( text, " " );
if( params.len() < 1 ) MessagePlayer("Wrong no. of parameters.", player);
{
if ( !IsClanRegister( params[ 3 ].tolower() ) ) E_MSG( "El clan: " + params[ 3 ] + " no esta registrado!", player );
else
{
local Owner = params[ 0 ], Manager1 = params[ 1 ], Manager2 = params[ 2 ], Clan = params[ 3 ];
if ( !GetTag( Owner ) ) E_MSG( "El lider no esta en el clan!!", player );
else if ( !GetTag( Manager1 ) ) E_MSG( "El manager1 no esta en el clan!!", player );
else if ( !GetTag( Manager2 ) ) E_MSG( "El manager2 no esta en el clan!!", player );
QuerySQL( db, format( "UPDATE ClanStats SET Leaders='%s' WHERE Clan='" + Clan + "' COLLATE NOCASE", "" + Owner + ", " + Manager1 + ", " + Manager2 + "" ) );
S_MSG( "Simplemente nesesitas poner /addclanmanager <El jugador de tu clan> Por ejemplo: Hector", player );
local dos = QuerySQL( db, "SELECT Users FROM ClanUsers WHERE Clans='" + Clan.tolower() + "' COLLATE NOCASE" ), Users = GetSQLColumnData( dos, 0 );
if ( Users ) QuerySQL( db, format( "UPDATE ClanUsers SET Users='%s' WHERE Clans='" + Clan + "' COLLATE NOCASE", ""+Users+" " + TruncateClan( Owner ) + " " + TruncateClan( Manager1 ) + " " + TruncateClan( Manager2 ) + "" ) );
else QuerySQL( db, format( "UPDATE ClanUsers SET Users='%s' WHERE Clans='" + Clan + "' COLLATE NOCASE", "DFAX0067XLPKDW " + TruncateClan( Owner ) + " " + TruncateClan( Manager1 ) + " " + TruncateClan( Manager2 ) + "" ) );
}
}
}
}

umar4911

RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Xmair

Change
if( params.len() < 1 ) MessagePlayer("Wrong no. of parameters.", player);
toif( params.len() < 4 ) return MessagePlayer("Wrong no. of parameters.", player);

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD