Code:
#include <sourcemod>
#include <cstrike>
Database db;
new g_Credits[MAXPLAYERS+1];
public Plugin:myinfo =
{
name = "Very Basic Shop",
author = "Fmmymir",
description = "Test",
version = "1.0",
url = ""
};
public OnPluginStart()
{
HookEvent("player_death", playerDeath);
new String:error[256];
db = SQL_DefConnect(error, sizeof(error))
if(db == INVALID_HANDLE)
{
PrintToServer("Could not connect: %s", error)
}
}
public Action:playerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(attacker != 0 && attacker != client)
{
if(GetClientTeam(attacker) == CS_TEAM_T && GetClientTeam(client) == CS_TEAM_CT)
{
g_Credits[attacker] += 2;
PrintToChat(attacker, "You got 2 points!");
}
}
}
My small plugin, and im trying to make it save the points on database.