Hello, i'm completly noob at coding bug i tried to do it just to learn a little.
But i got many errors, and i can't find what i did wrong :s since i followed at start a tutorial for storing info and tried to do the rest alone with what i learned.
can someone help me with this ??? And explain to me what i did wrong ?
here's the timer plugin and library (by alongub) :
https://forums.alliedmods.net/showthread.php?p=1747459
Sorry for my bad english :s !
Code:
#include <sourcemod>
#include <sdktools>
#include <smlib/arrays>
#include <timer>
static String:KVPath[PLATFORM_MAX_PATH];
new handle:h_pointsmap;
new handle:h_pointdifficulteasy;
new handle:h_pointdifficultnormal;
new handle:h_pointdifficulthard;
public Plugin:myinfo =
{
name = "[Timer] Ranking",
author = "Black Lagoon",
description = "Rank players with points when they finish a map",
version = 1.0,
url = "http://commu-lagoon.com/forum/"
};
public OnPluginStart()
{
h_pointsmap = CreateConVar("sm_pointmapdifficulty", "1", "Set difficulty of the map, 1 is easy, 2 is normal, 3 is hard", FCVAR_NOTIFY, true, 1.0, true, 3.0);
h_pointdifficulteasy = CreateConVar("sm_pointeasy", "10", "Set point win for easy difficulty def is 10 point", FCVAR_NOTIFY);
h_pointdifficultnormal = CreateConVar("sm_pointnormal", "50", "Set point win for normal difficulty def is 50 point", FCVAR_NOTIFY);
h_pointdifficulthard = CreateConVar("sm_pointhard", "100", "Set point win for hard difficulty def is 100 point", FCVAR_NOTIFY);
AutoExecConfig(true, "timerrank");
CreateDirectory("addons/sourcemod/data/TimerRanking 3);
BuildPath(Path_SM, KVPath, sizeof(KVPath), "data/TimerRanking/playerinfo.txt");
};
public OnFinishRound(client)
{
SavePlayerInfo(client);
};
public SavePlayerInfo(client)
{
new Handle:DB = CreateKeyValues("PlayersInfo");
FileToKeyValues(DB, KVPath);
new String:SteamID[32];
GetClientAuthString(client, SteamId, sizeof(SteamId));
if(KvJumpToKey(DB, SteamId, true))
{
new String:name[MAX_NAME_LENGHT],new String:temp_name[MAX_NAME_LENGHT];
GetClientName(client, name, sizeof(name));
KvGetString(DB, "name", temp_name, sizeof(temp_name), "NULL");
if(GetConVarInt(h_pointsmap) == 1)
{
GetConVarInt(h_pointsdifficulteasy);
h_pointsdifficulteasy = KvGetNum(DB, "points");
KvGetNum(
}
if(GetConVarInt(h_pointsmap) == 2)
{
GetConVarInt(h_pointsdifficultnormal);
h_pointsdifficultnormal = KvGetNum(DB, "points");
}
if(GetConVarInt(h_pointsmap) == 3)
{
GetConVarInt(h_pointsdifficulthard);
h_pointsdifficulthard = KvGetNum(DB, "points");
}
new Finishedmaps = KvGetNum(DB, "Finishedmaps");
if(StrEqual(temp_name, "NULL" && points == 0 && Finishedmaps == 0)
{
PrintToChatAll("[Lagoon] %s est un nouveau joueur", name);
}
else
{
PrintToChatAll("[Lagoon] %s dernière connexion sous le pseudo %s./n Et il a %d points, il a fini %d maps.", name, temp_name, points, Finishedmaps);
}
points++;
Finishedmaps++;
KvGetNum(DB, "points", points);
KvGetNum(DB, "Finishedmaps", Finishedmaps);
KvRewind(DB);
CloseHandle();
}
}