KD with Criminal Rank

Started by [VSS]Shawn, Jul 22, 2015, 07:04 AM

Previous topic - Next topic

[VSS]Shawn

Hello Guys Today I am releasing Criminal Rank system with KD ( kills and death ) system for database

I have seen many players using used scripts so this is for player who start scripting from blank server
Just Add this

function OnScriptLoad()
{
CreateKD();
}
function onPlayerKill( killer, killed, weapon, bodypart ) // always check killed or player
{
SetKills(killer,GetKills(killer)+1);
SetDeaths(killed,GetDeaths(killed)+1);
}
function onPlayerTeamKill( killer, killed, weapon, bodypart )
{
onPlayerKill( killer, killed, weapon, bodypart );
}
function onPlayerDeath( player, reason )
{
SetDeaths(player,GetDeaths(player)+1);
}


this on Functions.nut

function CreateKD()
{
QuerySQL( db, "CREATE TABLE IF NOT EXISTS KD( Name VARCHAR(32),Kills INT(15) ,Deaths INT(15) )" );
}

function SetKills( player, amount )
{
      QuerySQL(db, "UPDATE KD SET Kills='" +  amount + "' WHERE Name='" + player.Name + "'");   
}

function SetDeaths( player, amount )
{
      QuerySQL(db, "UPDATE KD SET Deaths='" +  amount + "' WHERE Name='" + player.Name + "'");   
}

function GetKills( player )
{
   local kille =  GetSQLColumnData( QuerySQL( db, "SELECT Kills FROM KD WHERE Name='" + player.Name+"'" ), 0 );
   if ( kille ) return kille;
   else return 0;
}

function GetDeaths( player )
{
   local deaths =  GetSQLColumnData( QuerySQL( db, "SELECT Deaths FROM KD WHERE Name='" + player.Name+"'" ), 0 );
   if ( deaths ) return deaths;
   else return 0;
}

function Register( player, password )
{
QuerySQL( db, "INSERT INTO KD ( Name,Kills,Deaths) VALUES ( '" + player.Name +"','0','0' )" );
}

Now Criminal System

function GetCriminalRank( player )
{
local Criminalskillz=GetKills(player),a;
if(Criminalskillz<=10)
{
a="Newbie";
return a;
}
else if(Criminalskillz<=30)
{
a="Junior One";
return a;
}
else if(Criminalskillz<=60)
{
a="Medium One";
return a;
}
else if(Criminalskillz<=200)
{
a="Vandal";
return a;
}
else if(Criminalskillz<=300)
{
a="Full Member";
return a;
}
else if(Criminalskillz<360)
{
a="Hero Member";
return a;
}
else if(Criminalskillz<=400)
{
a="Dmear";
return a;
}
else if(Criminalskillz<=499)
{
a="Hustler";
return a;
}
else if(Criminalskillz<=600)
{
a="Assasin";
return a;
}
else if(Criminalskillz<=650)
{
a="PRO";
return a;
}
else if(Criminalskillz<=700)
{
a="Master";
return a;
}
else if(Criminalskillz<800)
{
a="Slavest";
return a;
}
else if(Criminalskillz<=900)
{
a="Boss";
return a;
}
else if(Criminalskillz<=1000)
{
a="Don";
return a;
}
else if(Criminalskillz<=1350)
{
a="Godfather";
return a;
}

return 0;
}
Now Work on Commands

Make Stats Command Your self

else if ( cmd == "rank" )
{
ClientMessage ( player.Name + "'s criminal rank is: " +GetCriminalRank(player)+ "." ,player,255,255,0);
}

Thijn

Wow this script is horrible. 2 queries just to increase someone's kills. And another 2 for someone's death.
That's 4 queries on every kill. Ouch.

No freeing of queries, no error checking, unneeded usage of variables.
And when someone joins the server and get's killed while not being registered it will throw an error.

Well done, you can probably use this to populate a piece of paper to light your fireplace. Nothing else, really.

Stormeus

#2
Thread cleaned. Again.

http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=2955.msg20278#msg20278
http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=2882.0

It's just an adapted version of other scripts lying around in the community, but poorly ported from hashes to SQLite. I would've been perfectly fine if someone had actually done the cursory Google searches to find these threads, but since no one gave even a semblance of evidence actually backing their plagiarism claims up, I'm perfectly fine with removing those replies with impunity.

So there's your proof. Next time I won't be bothered to waste my time with the petty drama that some of the replies here tried to start, and I will gladly revoke the posting privileges of anyone who can't be bothered to raise their concerns in a manner that isn't so careless.

Thread locked.