error end of statment expected if or ;
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menufunction AccInfo( player )
{
try{
EchoMessage( ICOL_ORANGE + "** [" + player.ID + "] " + player.Name + " Joined the Server." );
if ( CheckBan( player ) == 1 ) Kick( player, "Server", "Banned From Server" );
status[ player.ID ] = PlayerStats();
local id = player.ID;
local ip = player.IP;
if ( GetLevel( player ) > 0 )
{
if ( ip != GetIP( player ) )
{
ePrivMessage( "Welcome to the Server " + player.Name + "!", player );
ePrivMessage( "You're not Logged-In. Please login by /login <password>", player );
status[ player.ID ].IsReg = true;
status[ player.ID ].IsLogged = false;
}
else if ( ip == GetIP( player ) )
{
local q = QuerySQL( db, "SELECT * FROM Account WHERE Name='" + player.Name.tolower() + "'" );
if ( GetSQLColumnData( q, 0 ) != null )
{
status[ player.ID ].Kills = GetSQLColumnData( q, 4 );
status[ player.ID ].Deaths = GetSQLColumnData( q, 5 );
status[ player.ID ].Cash = GetSQLColumnData( q, 6 );
status[ player.ID ].Bank = GetSQLColumnData( q, 7 );
status[ player.ID ].Level = GetSQLColumnData( q, 2 );
}
FreeSQLQuery( q );
ePrivMessage( "Welcome to the Server " + player.Name + "!", player );
ePrivMessage( "You've auto-logged in onto the server!", player );
status[ player.ID ].IsReg = true;
status[ player.ID ].IsLogged = true;
EchoMessage( ICOL_BROWN + ">> " + player.Name + " Auto-Logged In." );
}
}
else
{
ePrivMessage( "Welcome to the Server " + player.Name + "!", player );
ePrivMessage( "You're not registered with us. Register by /register <password>", player );
}
WriteIniString( "Files/ServData.ini", "IP", player.Name, player.IP );
}
catch(e) print( "AccInfo Error: " + e );
}
OnPlAyerspawnfunction onPlayerSpawn( player )
{
Message( ">> " + player.Name + " has spawned." );
if ( ( status[ player.ID ].IsReg == true ) && ( status[ player.ID ].IsLogged == false ) )
{
Announce( "/Login", player );
ePrivMessage("Login First To Access Services",player);
player.Kick();
}
if ( status[ player.ID ].IsReg == false )
{
Announce( "/ register", player );
ePrivMessage("Register First To Access Services",player);
player.Kick();
}
if ( ( status[ player.ID ].IsReg ) && ( status[ player.ID ].IsLogged ) )
{
player.Cash = status[ player.ID ].Cash;
}
}
if ( status[ player.ID ].IsReg == false )
and classed i added function onPlayerSpawn( player )
{
Message( ">> " + player.Name + " has spawned." );
if ( ( status[ player.ID ].IsReg == true ) && ( status[ player.ID ].IsLogged == false ) )
{
Kick( player, "Server", "Failed To Login!" );
}
if ( status[ player.ID ].IsReg == false )
{
Announce( "/c register", player );
ePrivMessage("Register First To Access Services",player);
cKick(player);
}
if ( ( status[ player.ID ].IsReg ) && ( status[ player.ID ].IsLogged ) )
{
player.Cash = status[ player.ID ].Cash;
}
}
function AccInfo( player )
{
try{
EchoMessage( ICOL_ORANGE + "** [" + player.ID + "] " + player.Name + " Joined the Server." );
if ( CheckBan( player ) == 1 ) Kick( player, "Server", "Banned From Server" );
status[ player.ID ] = PlayerStats();
local id = player.ID;
local ip = player.IP;
if ( GetLevel( player ) > 0 )
{
if ( ip != GetIP( player ) )
{
ePrivMessage( "Welcome to the Server " + player.Name + "!", player );
ePrivMessage( "You're not Logged-In. Please login by /login <password>", player );
status[ player.ID ].IsReg = true;
status[ player.ID ].IsLogged = false;
}
else if ( ip == GetIP( player ) )
{
local q = QuerySQL( db, "SELECT * FROM Account WHERE Name='" + player.Name.tolower() + "'" );
if ( GetSQLColumnData( q, 0 ) != null )
{
status[ player.ID ].Kills = GetSQLColumnData( q, 4 );
status[ player.ID ].Deaths = GetSQLColumnData( q, 5 );
status[ player.ID ].Cash = GetSQLColumnData( q, 6 );
status[ player.ID ].Bank = GetSQLColumnData( q, 7 );
status[ player.ID ].Level = GetSQLColumnData( q, 2 );
}
GetSQLNextRow( q );
ePrivMessage( "Welcome to the Server " + player.Name + "!", player );
ePrivMessage( "You've auto-logged in onto the server!", player );
status[ player.ID ].IsReg = true;
status[ player.ID ].IsLogged = true;
EchoMessage( ICOL_BROWN + ">> " + player.Name + " Auto-Logged In." );
}
}
else
{
ePrivMessage( "Welcome to the Server " + player.Name + "!", player );
ePrivMessage( "You're not registered with us. Register by /register <password>", player );
}
WriteIniString( "Files/ServData.ini", "IP", player.Name, player.IP );
}
catch(e) print( "AccInfo Error: " + e );
}
function GetStats( p )
{
try{
local stats = null;
if ( status[ p.ID ].IsReg == true )
{
local id = p.ID;
local kills = status[ id ].Kills, deaths = status[ id ].Deaths;
if ( ( kills > 0 ) && ( deaths > 0 ) )
{
local ratio = format( "%.2f", kills.tofloat() / deaths.tofloat() );
stats = "Kills: " + kills + ", Deaths: " + deaths + ", Ratio: " + ratio + ".";
}
else
{
stats = "Kills: " + status[id].Kills + ", Deaths: " + status[id].Deaths + ".";
}
}
else
{
stats = "This Nick-Name is not registered!";
}
return stats;
}
catch(e) print( "GetStats Error: " + e );
}
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 Account SET Kills='" + status[ id ].Kills + "', Deaths='" + status[ id ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "' WHERE Name='" + plr.Name.tolower() + "'" );
FreeSQLQuery( q );
}
}
}
function Login( player, pass )
{
local q = QuerySQL( db, "SELECT * FROM Account WHERE Name='" + player.Name + "'" );
if ( GetSQLColumnData( q, 0 ) != null )
{
status[ player.ID ].Kills = GetSQLColumnData( q, 4 );
status[ player.ID ].Deaths = GetSQLColumnData( q, 5 );
status[ player.ID ].Cash = GetSQLColumnData( q, 6 );
status[ player.ID ].Bank = GetSQLColumnData( q, 7 );
}
GetSQLNextRow( q );
MessagePlayer( GREEN+">> You've Successfully Logged-In!", player );
MessagePlayer(YELLOW+">> Name : [ " + player.Name + " ]"+GREEN+" Level : [ " + GetLevel(player) + " ] State : [ " + GetLevelTag(player) + ""+GREEN+" ]",player);
status[ player.ID ].IsLogged = true;
QuerySQL(db, "UPDATE Account SET IP='" + player.IP + "' WHERE Name='" + player.Name + "'");
Message(GREEN+"--> [ "+ player.Name + " ] Logged-In Successfully." );
FreeSQLQuery( q );
}
function Register( player, pass )
{
try{
local password = e(pass);
QuerySQL( db, "REPLACE INTO Account ( Name, IP, Level, Pass, Kills, Deaths, Cash, Bank ) VALUES ( '" + player.Name.tolower() + "', '" + player.IP + "', 1, '" + password + "', 0, 0, 0, 0 )" );
QuerySQL( db, "REPLACE INTO Bstats ( Name, User, Body, Torso, LeftArm, RightArm, LeftLeg, RightLeg, Head ) VALUES ( '" + player.Name.tolower() + "', '" + player.Name + "', 0, 0, 0, 0, 0, 0, 0 )" );
QuerySQL( db, "REPLACE INTO Wstats ( Name, User, Fist, BrassKnuckle, ScrewDriver, GolfClub, NightStick, Knife, BaseballBat, Hammer, Cleaver, Machete, Katana, Chainsaw, Grenade, RemoteGrenade, TearGas, Molotov, Missile, Colt45, Python, Shotgun, Spaz , Stubby, Tec9, Uzi, Ingrams, MP5, M4, Ruger, SniperRifle, LaserScope, RocketLauncher, FlameThrower, M60 ) VALUES ( '" + player.Name.tolower() + "', '" + player.Name + "', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )" );
player.Cash = 2000;
status[ player.ID ].IsLogged = true;
status[ player.ID ].IsReg = true;
ePrivMessage( "You've Registered!", player );
ePrivMessage( "Nick:[ " + player.Name + " ] Password:[ " + pass + " ]", player );
EMessage( ">> " + player.Name + " is a Registered Nick-Name Now!" );
}
catch(e) print( "Reg Function Error: " + e );
}
function SaveStats( player )
{
try{
local id = player.ID;
if ( status[ id ].IsReg == true )
{
QuerySQL( db, "UPDATE Account SET Kills='" + status[ id ].Kills + "', Deaths='" + status[ player.ID ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "' WHERE Name='" + player.Name + "'" );
print( "Saved Stats of Player " + player.Name + "[" + player.ID + "]" );
status[ id ] = null;
}
}
catch(e) print( "Save Stats Error: " + e );
}
else if ( cmd == "stats" )
{
try
{
if ( status[ player.ID ].IsReg == false ) ePrivMessage( "[Error] - You're not registered.", player );
else
{
if ( !text ) EMessage( ">> " + player.Name + "'s Stats: " + GetStats( player ) );
else if ( text )
{
local plr = GetPlayer( text );
if ( !plr ) ePrivMessage( "Invalid Player Nick/ID!", player );
else PrivMessage( plr.Name + "'s Stats: " + GetStats( plr ), player );
}
}
}
catch(e) print( "Stats Cmd Error: " + e );
}