[code]//
// Created: 05.09.06
// Aurthor: Iain Gilbert
//
#if defined _base_included
#endinput
#endif
#define _base_included
#pragma library base
#include <a_samp>
#include <core>
#include <float>
#include "utils\dini"
#define VERSION "v0.8.0"
#define debug 0
#define MAX_STRING 255
#define MAX_NAME 40 // number of char's a name/password/misc_word can be
#define INACTIVE_PLAYER_ID 255
#define INVALID_QUEST_ID 0
#define MAX_QUESTS 255
#define MAX_WIN 900000 // Maximum gambling win
#define MAX_SPAWNPOINTS 50
#define MAX_COUNTDOWN 5
#define MAX_PING 500
#define TimerTick 1000 // used for how often timer function is called
#define COLOUR_GREY 0xAFAFAFAA // grey
#define COLOUR_GREEN 0x33AA33AA // green
#define COLOUR_LIGHTGREEN 0x9ACD32AA //lightgreen
#define COLOUR_RED 0xAA3333AA // red
#define COLOUR_LIGHTRED 0xFF6347AA // lightred
#define COLOUR_YELLOW 0xFFFF00AA // yellow
#define COLOUR_WHITE 0xFFFFFFAA // white
#define COLOUR_BLUE 0x33AAFFAA // blue
#define COLOUR_LIGHTBLUE 0x33CCFFAA // LightBlue
#define COLOUR_ORANGE 0xFF9900AA //orange
#define COLOUR_PURPLE 0xC2A2DAAA //purple
#define COLOUR_CRIMSON 0xDC143CAA
#define COLOUR_LIMEGREEN 0x32CD32AA
#define COLOUR_AQUA 0x00FFFFAA
#define COLOUR_FLBLUE 0x6495EDAA
#define COLOUR_MAGENTA 0xFF00FFFF
#define COLOUR_GOLD 0xB8860BAA
#define COLOUR_PINK 0xFFC0CBAA
// TODO: more colours
#define COLOUR_MISC 0xAFAFAFAA // Grey - Misc
#define COLOUR_CHAT 0xFFFFFFAA // White - Chat
#define COLOUR_PLAYER 0xAAAAAAAA // White - Player
#define COLOUR_XP_GOOD 0x00C7FFAA // Blue - XP
#define COLOUR_XP_BAD 0x00008BAA // Blue - XP
#define COLOUR_COMBAT_GOOD 0xAA3333AA // Red - Combat
#define COLOUR_COMBAT_BAD 0xBB3333AA // Red - Combat
#define COLOUR_MONEY_GOOD 0xFFFF00AA // Yellow - Money
#define COLOUR_MONEY_BAD 0xDAA520AA // Yellow - Money
#define COLOUR_RACE 0x005407AA // green - dark
#define COLOUR_RACE_BAD 0x545407AA // yellow-green-dark
#define COLOUR_GANG 0xFF8C00AA // orange
#define COLOUR_GANG_CHAT 0xFFA500AA // orange
#define COLOUR_DM 0xFF0066AA // red - purple
#define COLOUR_DM_BAD 0xFF0066AA // red - purple
#define MIN_HEALTH 20
#define MAX_HEALTH 200
#define NUMVALUES 4
#define SOUND_MUSIC_CLASSSELECT 1185
#define SOUND_MUSIC_RACEFINISH 1183
#define SOUND_MUSIC_RACERECORD 1097
#define SOUND_MUSIC_MISSIONCOMPLETE 1185
#define SOUND_OFF 1184
#define SOUND_BLIP1 1056
#define SOUND_BLIP2 1057
#define SOUND_EXPLOSION 1159
#define SOUND_PURCHASE 1149
#define SOUND_CHECKPOINT 1058
#define SOUND_DEATH 1057
#define SOUND_DMKILL 1056
#define SOUND_DMDEATH 1057
#define OUTPUTLEVEL 0 // Amount of imformation outputted to console
// 0 - off, no output
// 1 - + Minimal output
// 2 - + DB saves, etc
// 3 - + XP/Level/Money changes output
#define DBTYPE 0 // Database type (olny flat file ATM)
// 0 - dini - flat file
// 1 - TODO: SQL
new ConfigDB[MAX_STRING] = "GTO/Config/GTO.Config.Base.txt";
new LevelDB[MAX_STRING] = "GTO/Config/GTO.Config.Levels.txt";
new VerboseSave=-1; // do we save extra un-needed db info like weapons, races, vehicels, deathmatches, etc
new RealTime=0;
new ForceOverwrite = 0;
// xyz coord info
enum CoordInfo {
Float:Coord_X,
Float:Coord_Y,
Float:Coord_Z
}
new KickList[MAX_PLAYERS];
new WorldTime;
new DBSeperator= 124; // seperate db fields.atm for db writing im just sending a string, which is written to a file.
new nullstr[MAX_STRING];
enum LevelInfo {
level_xp,
level_name[MAX_NAME]
}
#define MAX_LEVEL 101
#define MAX_XP 15000000000
#define MAX_LVLXP 10000000000
// level rank names by Baby Face / Cool
new LevelList[MAX_LEVEL+1][LevelInfo] = { // experience required for each level
{ 0, "lvl 0" },
{ 50000, "lvl 1" },
{ 100000, "lvl 2" },
{ 150000, "lvl 3" },
{ 200000, "lvl 4" },
{ 250000, "lvl 5" },
{ 300000, "lvl 6" },
{ 350000, "lvl 7" },
{ 400000, "lvl 8" },
{ 450000, "lvl 9" },
{ 500000, "lvl 10" },
{ 600000, "lvl 11" },
{ 700000, "lvl 12" },
{ 800000, "lvl 13" },
{ 900000, "lvl 14" },
{ 1000000, "lvl 15" },
{ 1100000, "lvl 16" },
{ 1200000, "lvl 17" },
{ 1300000, "lvl 18" },
{ 1400000, "lvl 19" },
{ 1500000, "lvl 20" },
{ 2000000, "lvl 21" },
{ 2500000, "lvl 22" },
{ 3000000, "lvl 23" },
{ 4000000, "lvl 24" },
{ 5000000, "lvl 25" },
{ 6000000, "lvl 26" },
{ 7000000, "lvl 27" },
{ 8000000, "lvl 28" },
{ 9000000, "lvl 29" },
{ 10000000, "lvl 30" },
{ 15000000, "lvl 31" },
{ 20000000, "lvl 32" },
{ 25000000, "lvl 33" },
{ 30000000, "lvl 34" },
{ 35000000, "lvl 35" },
{ 40000000, "lvl 36" },
{ 45000000, "lvl 37" },
{ 50000000, "lvl 38" },
{ 55000000, "lvl 39" },
{ 60000000, "lvl 40" },
{ 61000000, "lvl 41" },
{ 62000000, "lvl 42" },
{ 63000000, "lvl 43" },
{ 64000000, "lvl 44" },
{ 65000000, "lvl 45" },
{ 66000000, "lvl 46" },
{ 67000000, "lvl 47" },
{ 68000000, "lvl 48" },
{ 69000000, "lvl 49" },
{ 70000000, "lvl 50" },
{ 75000000, "lvl 51" },
{ 80000000, "lvl 52" },
{ 85000000, "lvl 53" },
{ 90000000, "lvl 54" },
{ 95000000, "lvl 55" },
{ 100000000, "lvl 56" },
{ 110000000, "lvl 57" },
{ 120000000, "lvl 58" },
{ 130000000, "lvl 59" },
{ 140000000, "lvl 60" },
{ 150000000, "lvl 61" },
{ 160000000, "lvl 62" },
{ 170000000, "lvl 63" },
{ 180000000, "lvl 64" },
{ 190000000, "lvl 65" },
{ 200000000, "lvl 66" },
{ 250000000, "lvl 67" },
{ 300000000, "lvl 68" },
{ 350000000, "lvl 69" },
{ 400000000, "lvl 70" },
{ 450000000, "lvl 71" },
{ 500000000, "lvl 72" },
{ 550000000, "lvl 73" },
{ 600000000, "lvl 74" },
{ 650000000, "lvl 75" },
{ 700000000, "lvl 76" },
{ 750000000, "lvl 77" },
{ 800000000, "lvl 78" },
{ 850000000, "lvl 79" },
{ 900000000, "lvl 80" },
{ 1000000000, "lvl 81" },
{ 1100000000, "lvl 82" },
{ 1200000000, "lvl 83" },
{ 1300000000, "lvl 84" },
{ 1400000000, "lvl 85" },
{ 1500000000, "lvl 86" },
{ 1600000000, "lvl 87" },
{ 1700000000, "lvl 88" },
{ 1800000000, "lvl 89" },
{ 1900000000, "lvl 90" },
{ 2000000000, "lvl 91" },
{ 2500000000, "lvl 92" },
{ 3000000000, "lvl 93" },
{ 4000000000, "lvl 94" },
{ 4500000000, "lvl 95" },
{ 5000000000, "lvl 96" },
{ 5500000000, "lvl 97" },
{ 7000000000, "lvl 98" },
{ 8500000000, "lvl 99" },
{ 10000000000, "lvl 100" },
{ 15000000000, "lvl 101" }
};
BaseLoadConfig()
{
if (ForceOverwrite) return;
new temp[MAX_STRING];
if (!dini_Exists(ConfigDB))
{
dini_Create(ConfigDB);
}
set(temp,dini_Get(ConfigDB,"Level_DB"));
if (strlen(temp) > 0) set(LevelDB,temp);
set(temp,dini_Get(ConfigDB,"Verbose_Save"));
if (strlen(temp) > 0) VerboseSave = strval(temp);
set(temp,dini_Get(ConfigDB,"Real_Time"));
if (strlen(temp) > 0) RealTime = strval(temp);
if (!dini_Exists(LevelDB))
{
BaseSaveConfig();
}
for (new i=0;i<=MAX_LEVEL;i++)
{
new tempname[MAX_STRING];
format(tempname,sizeof(tempname),"Level%d_Rankname",i);
set(temp,dini_Get(LevelDB,tempname));
if (strlen(temp) > 0) set(LevelList[i][level_name],temp);
format(tempname,sizeof(tempname),"Level%d_Experience",i);
set(temp,dini_Get(LevelDB,tempname));
if (strlen(temp) > 0) LevelList[i][level_xp] = strval(temp);
}
return;
}
BaseSaveConfig()
{
new temp[MAX_STRING];
if (dini_Exists(ConfigDB))
{
dini_Set(ConfigDB,"Level_DB",LevelDB);
valstr(temp,VerboseSave);
dini_Set(ConfigDB,"Verbose_Save",temp);
valstr(temp,RealTime);
dini_Set(ConfigDB,"Real_Time",temp);
}
if (!dini_Exists(LevelDB))
{
dini_Create(LevelDB);
}
for (new i=0;i<=MAX_LEVEL;i++)
{
new tempname[MAX_STRING];
format(tempname,sizeof(tempname),"Level%d_Rankname",i);
dini_Set(LevelDB,tempname,LevelList[i][level_name]);
format(tempname,sizeof(tempname),"Level%d_Experience",i);
valstr(temp,LevelList[i][level_xp]);
dini_Set(LevelDB,tempname,temp);
}
return;
}
GetLevelName(level)
{
new name[MAX_NAME];
if ((level < 0) || (level > MAX_LEVEL+1)) return name;
set(name,LevelList[level][level_name]);
return name;
}
[code]