function GetStats( player )
{
local stats = null;
local Kills = stats[ player.ID ].Kills;
local Deaths = stats[ player.ID ].Deaths;
{
if ( ( Kills < 0 ) && ( Deaths < 0 ) )
{
local ratio = format( "%.2f", Kills.tofloat() / Deaths.tofloat() );
stats = "Kills: " + Kills + ", Deaths: " + Deaths + ", Ratio: " + ratio + ", Joins: " + Joins + ".";
}
else
{
stats = "Kills: " + Kills + ", Deaths: " + Deaths + ", Joins: " + Joins + ".";
}
}
return stats;
}
the index " 0 " not exist
I only expect that from you!
function GetStats( player )
{
local stats = null;
local Kills = stats[ player.ID ].Kills;
local Deaths = stats[ player.ID ].Deaths;
if ( ( Kills > 0 ) )
{
local ratio = format( "%.2f", Kills.tofloat() / Deaths.tofloat() );
stats = "Kills: " + Kills + ", Deaths: " + Deaths + ", Ratio: " + ratio + ", Joins: " + Joins + ".";
}
else stats = "Kills: " + Kills + ", Deaths: " + Deaths + ", Joins: " + Joins + ".";
return stats;
}
Your next error: the index Joins doesn't exist, fix that yourself
lol KAKAN
Quote from: wilber32 on Dec 06, 2015, 05:45 PMlol KAKAN
Why the f*ck are you saying it to me? You may say it to yourself.
Try that code and fix the Joins() error. I won't help you for that shit
It is that I am new scripts
look what I've done and still the error
else if ( cmd == "stats" )
{
if ( !text ) Message( ">> " + player.Name + "'s Stats: " + GetStats( player ) );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "[Error] - Invalid Player Nick/ID!", player );
else MessagePlayer( plr.Name + "'s Stats: " + GetStats( player ), player );
}
}
functions
function ExecStats()
{
local id, q;
for(local i = 0; i < GetMaxPlayers(); i++)
{
local plr = FindPlayer( i ),q;
if ( plr )
{
id = plr.ID
q = QuerySQL( db, "UPDATE Accounts SET Kills='" + status[ id ].Kills + "', Deaths='" + status[ id ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "' , Joins='" + status[ id ].Joins + "' WHERE Name='" + plr.Name.tolower() + "'" );
FreeSQLQuery( q );
}
}
}
function SaveStats( player )
{
try{
local id = player.ID;
if ( status[ p.ID ].IsReg == true )
{
QuerySQL( db, "UPDATE Accounts SET Kills='" + status[ id ].Kills + "', Deaths='" + status[ player.ID ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "', Joins='" + status[id].Joins + "' WHERE Name='" + player.Name.tolower() + "'" );
print( "Saved Stats of Player " + player.Name + "[" + player.ID + "]" );
status[ id ] = null;
}
}
catch(e) print( "Save Stats Error: " + e );
}
function GetStats( player )
{
local stats = null;
local Kills = stats[ player.ID ].Kills;
local Deaths = stats[ player.ID ].Deaths;
if ( ( Kills > 0 ) )
{
local ratio = format( "%.2f", Kills.tofloat() / Deaths.tofloat() );
stats = "Kills: " + Kills + ", Deaths: " + Deaths + ", Ratio: " + ratio + ", Joins: " + Joins + ".";
}
else stats = "Kills: " + Kills + ", Deaths: " + Deaths + ", Joins: " + Joins + ".";
return stats;
}
I've already seen 3,000 times and nothing
Care to say what's the problem?
Do you have this actually:- stats[ player.ID ].Kills?
yes
try removing
local stats = null;
At one point you're doing status[ player.ID ], and another stats[ player.ID ]. Make up your damn mind.
Because you know guionar not mean you badmouth the idiots.
What?
Quote from: wilber32 on Dec 07, 2015, 12:55 AMBecause you know guionar not mean you badmouth the idiots.
Then we're not robots too. So we won't help you, simple as that.
HUMANS are not like ROBOTS!
No more post it here -.-!