Kód:
public Create_Table_Register(){
static Query[10048];
new Len;
Len += formatex(Query[Len], charsmax(Query), "CREATE TABLE IF NOT EXISTS `register_mentes`");
Len += formatex(Query[Len], charsmax(Query)-Len, "(`Nev` varchar(32) NOT NULL, ");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Felhasznalonev` varchar(32) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Jelszo` varchar(32) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Player_IP` varchar(35) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Player_SteamID` varchar(35) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Regisztralt` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY)");
SQL_ThreadQuery(g_SqlTuple, "createTableThread", Query);
}
public Create_Table_Others(){
static Query[10048];
new Len;
Len += formatex(Query[Len], charsmax(Query), "CREATE TABLE IF NOT EXISTS `cucos_mentes`");
Len += formatex(Query[Len], charsmax(Query)-Len, "(`Nev` varchar(32) NOT NULL, ");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Masodpercek` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`SMS` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Dollars` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Szint` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Oles` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`DropOles` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`vanprefix` int(11) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`prefixneve` varchar(32) NOT NULL,");
Len += formatex(Query[Len], charsmax(Query)-Len, "`Vip` int(11) NOT NULL,");
for(new i;i < MAX; i++)
Len += formatex(Query[Len], charsmax(Query)-Len, "`F%d` int(11) NOT NULL,", i);
for(new i;i < LADA; i++)
Len += formatex(Query[Len], charsmax(Query)-Len, "`L%d` int(11) NOT NULL,", i);
for(new i;i < 11; i++)
Len += formatex(Query[Len], charsmax(Query)-Len, "`S%d` int(11) NOT NULL,", i);
Len += formatex(Query[Len], charsmax(Query)-Len, "`Kulcs` int(11) NOT NULL, `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY)");
SQL_ThreadQuery(g_SqlTuple, "createTableThread", Query);
}
public Load(id) {
static Query[10048];
new Data[1], Name[32];
get_user_name(id, Name, 31);
Data[0] = id;
formatex(Query, charsmax(Query), "SELECT * FROM `cucos_mentes` WHERE Nev = ^"%s^";", name[id]);
SQL_ThreadQuery(g_SqlTuple, "QuerySelectData", Query, Data, 1);
}
public QuerySelectData(FailState, Handle:Query, Error[], Errcode, Data[], DataSize, Float:Queuetime) {
if(FailState == TQUERY_CONNECT_FAILED || FailState == TQUERY_QUERY_FAILED) {
log_amx("%s", Error);
return;
}
else {
new id = Data[0];
if(SQL_NumRows(Query) > 0) {
Rang[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Szint"));
Dollar[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Dollars"));
SMS[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "SMS"));
Oles[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Oles"));
D_Oles[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "DropOles"));
Vip[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Vip"));
Masodpercek[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Masodpercek"));
VanPrefix[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "vanprefix"));
SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "prefixneve"), Chat_Prefix[id], charsmax(Chat_Prefix[]));
for(new i;i < MAX; i++)
{
new String[64];
formatex(String, charsmax(String), "F%d", i);
OsszesSkin[i][id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, String));
}
for(new i;i < LADA; i++)
{
new String[64];
formatex(String, charsmax(String), "L%d", i);
Lada[i][id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, String));
}
for(new i;i < 11; i++)
{
new String[64];
formatex(String, charsmax(String), "S%d", i);
Skin[i][id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, String));
}
Kulcs[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Kulcs"));
g_id2[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "id"));
}
else
{
Save(id);
}
}
}
public Load_Register(id){
static Query[10048];
new Data[1], Name[32];
get_user_name(id, Name, 31);
Data[0] = id;
formatex(Query, charsmax(Query), "SELECT * FROM `register_mentes` WHERE Nev = ^"%s^";", name[id]);
SQL_ThreadQuery(g_SqlTuple, "QuerySelectDataRegister", Query, Data, 1);
}
public QuerySelectDataRegister(FailState, Handle:Query, Error[], Errcode, Data[], DataSize, Float:Queuetime) {
if(FailState == TQUERY_CONNECT_FAILED || FailState == TQUERY_QUERY_FAILED) {
log_amx("%s", Error);
return;
}
else {
new id = Data[0];
if(SQL_NumRows(Query) > 0) {
SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Felhasznalonev"), regFh[id], charsmax(regFh[]));
SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Jelszo"), regJelszo[id], charsmax(regJelszo[]));
Regisztralt[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "Regisztralt"));
}
else
{
Save_Register(id);
}
}
}
public Save(id){
static Query[256];
formatex(Query, charsmax(Query), "INSERT INTO `cucos_mentes` (`Nev`) VALUES (^"%s^");", name[id]);
SQL_ThreadQuery(g_SqlTuple, "QuerySetData", Query);
}
public Save_Register(id){
static Query[256];
new sPlayer_IP[35], sPlayer_SteamID[35];
get_user_ip(id, sPlayer_IP, charsmax(sPlayer_IP), 1);
get_user_authid(id, sPlayer_SteamID, charsmax(sPlayer_SteamID));
formatex(Query, charsmax(Query), "INSERT INTO `register_mentes` (`Nev`, `Player_IP`, `Player_SteamID` ) VALUES (^"%s^", ^"%s^", ^"%s^");", name[id], sPlayer_IP, sPlayer_SteamID);
SQL_ThreadQuery(g_SqlTuple, "QuerySetData", Query);
}
public SQL_Update_Reg(id){
static Query[10048];
new Len;
Len += formatex(Query[Len], charsmax(Query), "UPDATE `register_mentes` SET Felhasznalonev = ^"%s^", ", regFh[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "Jelszo = ^"%s^", ", regJelszo[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "Regisztralt = ^"%i^" WHERE Nev = ^"%s^";", Regisztralt[id], name[id]);
SQL_ThreadQuery(g_SqlTuple, "QuerySetData", Query);
}
public Update(id)
{
static Query[10048];
new Len;
Len += formatex(Query[Len], charsmax(Query), "UPDATE `cucos_mentes` SET Dollars = ^"%i^", ",Dollar[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "Szint = ^"%i^", ", Rang[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "Oles = ^"%i^", ", Oles[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "DropOles = ^"%i^", ", D_Oles[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "Masodpercek = ^"%i^", ", Masodpercek[id]+get_user_time(id));
Len += formatex(Query[Len], charsmax(Query)-Len, "SMS = ^"%i^", ", SMS[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "Vip = ^"%i^", ", Vip[id]-get_user_time(id));
Len += formatex(Query[Len], charsmax(Query)-Len, "vanprefix = ^"%i^", ", VanPrefix[id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "prefixneve = ^"%s^", ", Chat_Prefix[id]);
for(new i=0;i < MAX; i++)
Len += formatex(Query[Len], charsmax(Query)-Len, "F%d = ^"%i^", ", i, OsszesSkin[i][id]);
for(new i;i < LADA; i++)
Len += formatex(Query[Len], charsmax(Query)-Len, "L%d = ^"%i^", ", i, Lada[i][id]);
for(new i;i < 11; i++)
Len += formatex(Query[Len], charsmax(Query)-Len, "S%d = ^"%i^", ", i, Skin[i][id]);
Len += formatex(Query[Len], charsmax(Query)-Len, "Kulcs = ^"%i^" WHERE Nev = ^"%s^";", Kulcs[id], name[id]);
SQL_ThreadQuery(g_SqlTuple, "QuerySetData", Query);
}
Kód:
public InfoHud(id)
{
new Target = pev(id, pev_iuser1) == 4 ? pev(id, pev_iuser2) : id;
if(is_user_alive(id))
{
new iMasodperc, iPerc, iOra, Nev[32];
get_user_name(id, Nev, 31);
iMasodperc = Masodpercek[id] + get_user_time(id);
iPerc = iMasodperc / 60;
iOra = iPerc / 60;
iMasodperc = iMasodperc - iPerc * 60;
iPerc = iPerc - iOra * 60;
set_hudmessage(random(255), random(255), random(255), 0.01, 0.15, 0, 6.0, 1.1, 0.0, 0.0, -1);
show_hudmessage(id, "Üdv %s (id#%s)^n^nÖlés: [%d]^nDollár: [%d]^nRang: [%s]^nJátszott idő: [%d Óra %d Perc]^nParancsok: [/rangok]", Nev, g_id2[id], Oles[id], Dollar[id], Rangok[Rang[id]][Szint], iOra, iPerc);
}
else
{
new iMasodperc, iPerc, iOra, Nev[32];
get_user_name(Target, Nev, 31);
iMasodperc = Masodpercek[Target] + get_user_time(Target);
iPerc = iMasodperc / 60;
iOra = iPerc / 60;
iMasodperc = iMasodperc - iPerc * 60;
iPerc = iPerc - iOra * 60;
set_hudmessage(random(255), random(255), random(255), 0.01, 0.15, 0, 6.0, 1.1, 0.0, 0.0, -1);
show_hudmessage(id, "Üdv %s (id#%s)^n^nÖlés: [%d]^nDollár: [%d]^nRang: [%s]^nJátszott idő: [%d Óra %d Perc]^nParancsok: [/rangok]", Nev, g_id2[Target], Oles[Target], Dollar[Target], Rangok[Rang[Target]][Szint], iOra, iPerc);
}
}
És ezt másold be a modba ---> new g_id2[33];