Weapon stats system help

Started by Kid_Buu, May 05, 2018, 01:58 AM

Previous topic - Next topic

Kid_Buu

Hello, for more than I try to create this system, I can not create it well because I need more experience here.

Can someone give me at least one example of the wstats system?
What I most need is the function of when you die raise the number of those killed with that weapon.

umar4911

I am gamer, programmer and hacker. Try to find me!
xD

Kid_Buu


umar4911

Going to give you an example

make a new function like this.
function addwepstats(player, wep)
{
local q = QuerySQL(DB, "SELECT * FROM wepstats WHERE name = '"+escapeSQLString(player.Name)+"'");
if(q)
{
switch (wep)
{
case 0:
{
local a = GetSQLColumnData(q, 1).tointeger()+1;
QuerySQL(DB, "UPDATE wepstats SET fist = '"+a+"' WHERE name = '"+escapeSQLString(player.Name)+"'");
}
case 1:
{
local a = GetSQLColumnData(q, 2).tointeger()+1;
QuerySQL(DB, "UPDATE wepstats SET brass = '"+a+"' WHERE name = '"+escapeSQLString(player.Name)+"'");
}
}
}
}
The constants of the weps with their numbers are:
[spoiler]WEP_FIST 0
WEP_BRASSKNUCKLES 1
WEP_SCREWDRIVER 2
WEP_GOLFCLUB 3
WEP_NIGHTSTICK 4
WEP_KNIFE 5
WEP_BASEBALLBAT 6
WEP_HAMMER 7
WEP_MEATCLEAVER 8
WEP_MACHETE 9
WEP_KATANA 10
WEP_CHAINSAW 11
WEP_GRENADE 12
WEP_REMOTE 13
WEP_TEARGAS 14
WEP_MOLOTOV 15
WEP_ROCKET 16
WEP_COLT 17
WEP_COLT45 17
WEP_PYTHON 18
WEP_SHOTGUN 19
WEP_SPAZ 20
WEP_SPAS12 20
WEP_STUBBY 21
WEP_TEC9 22
WEP_UZI 23
WEP_INGRAM 24
WEP_MP5 25
WEP_M4 26
WEP_RUGER 27
WEP_SNIPER 28
WEP_LASERSCOPE 29
WEP_ROCKETLAUNCHER 30
WEP_RPG 30
WEP_FLAMETHROWER 31
WEP_M60 32
WEP_MINIGUN 33

WEP_BOMB 34
WEP_HELICANNON 35
WEP_CAMERA 36
WEP_VEHICLE 39
WEP_DRIVEBY 42
WEP_DROWNED 43
WEP_FALL 44
WEP_SUICIDE 70
[/spoiler]

Make a new database and player entry automatically created when a player registers. Next add this function on playerkill
function onPlayerKill( player, killer, reason, bodypart )
{
 addwepstats(killer, reason);
}

and when player does /wepstats, it gets the entry of the player. Hope you get it.
I am gamer, programmer and hacker. Try to find me!
xD