Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Kid_Buu on Jan 20, 2018, 07:05 AM

Title: any solution for this error?
Post by: Kid_Buu on Jan 20, 2018, 07:05 AM
Hello, I wanted to know if someone could tell me what to do in this command

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

Here the command:

else if ( cmd == "clanstats" )
{
(text) ? text = text : text = GetTag( plr.Name );
( plr ) ? text = GetTag( plr.Name ) : text = text;
if ( !text ) E_MSG( "Usted no tiene un tag", player );
else
{
local Tag = GetTok( text, " ", 1 );
if ( IsClanRegister( text ) )
{
if ( plr )
{
Kills <- ClanKills( GetTag( plr.Name ) ); Deaths <- ClanDeaths( GetTag( plr.Name ) ); Deads <- ClanDeads( GetTag( plr.Name ) ); Ratio <- GetRatio( Kills, Deaths, Deads ); ( Ratio ) ? All( GetTag( plr.Name ) + "'s Stats - Kills " + Kills + " Deaths " + Deaths + " Deads " + Deads + " Ratio K/DD: " + Ratio ): All( GetTag( plr.Name ) + "' Stats - Kills " + Kills + " Deaths " + Deaths + " Deads " + Deads );
}
else if ( text )
{
local q = QuerySQL( db, "SELECT Clan, Kills, Deaths, Deads FROM ClanStats WHERE Clan='" + Tag + "' COLLATE NOCASE" );   
local PKills = GetSQLColumnData( q, 1 ), PDeaths = GetSQLColumnData( q, 2 ), PDeads = GetSQLColumnData( q, 3 ), Ratio = GetRatio( PKills, PDeaths, PDeads );
( Ratio ) ? All( text + "'s Stats - Kills " + PKills + " Deaths " + PDeaths + " Deads " + PDeads + " Ratio K/DD: " + Ratio ): All( text + "' Stats - Kills " + PKills + " Deaths " + PDeaths + " Deads " + PDeads );
}
}
else E_MSG( "El clan: " + text + " no esta registrado.", player );
}
}
Title: Re: any solution for this error?
Post by: Retard on Jan 20, 2018, 07:08 AM
Add This in Your Script local plr = FindPlayer( player );
Title: Re: any solution for this error?
Post by: Kid_Buu on Jan 20, 2018, 07:13 AM
I will experiment with this :)
Title: Re: any solution for this error?
Post by: Kid_Buu on Jan 20, 2018, 07:16 AM
[Unexpected argument in FindPlayer: must be integer or string]
Title: Re: any solution for this error?
Post by: umar4911 on Jan 20, 2018, 02:24 PM
try using this
else if ( cmd == "clanstats" )
{
(text) ? text = text : text = GetTag( player.Name );
( player ) ? text = GetTag( player.Name ) : text = text;
if ( !text ) E_MSG( "Usted no tiene un tag", player );
else
{
local Tag = GetTok( text, " ", 1 );
if ( IsClanRegister( text ) )
{
if ( player )
{
Kills <- ClanKills( GetTag( player.Name ) ); Deaths <- ClanDeaths( GetTag( player.Name ) ); Deads <- ClanDeads( GetTag( player.Name ) ); Ratio <- GetRatio( Kills, Deaths, Deads ); ( Ratio ) ? All( GetTag( player.Name ) + "'s Stats - Kills " + Kills + " Deaths " + Deaths + " Deads " + Deads + " Ratio K/DD: " + Ratio ): All( GetTag( player.Name ) + "' Stats - Kills " + Kills + " Deaths " + Deaths + " Deads " + Deads );
}
else if ( text )
{
local q = QuerySQL( db, "SELECT Clan, Kills, Deaths, Deads FROM ClanStats WHERE Clan='" + Tag + "' COLLATE NOCASE" );   
local PKills = GetSQLColumnData( q, 1 ), PDeaths = GetSQLColumnData( q, 2 ), PDeads = GetSQLColumnData( q, 3 ), Ratio = GetRatio( PKills, PDeaths, PDeads );
( Ratio ) ? All( text + "'s Stats - Kills " + PKills + " Deaths " + PDeaths + " Deads " + PDeads + " Ratio K/DD: " + Ratio ): All( text + "' Stats - Kills " + PKills + " Deaths " + PDeaths + " Deads " + PDeads );
}
}
else E_MSG( "El clan: " + text + " no esta registrado.", player );
}
}
Title: Re: any solution for this error?
Post by: Kid_Buu on Jan 20, 2018, 08:31 PM
Thanks