if((konekcijal = db_open("newrepublic.db")) == DB:0)
{
print("Nemoze da se konektira");
SendRconCommand("exit");
}
else
{
print("Uspesno se povrza so databazata!");
}
VcitiStatsi(playerid)
{
new string[500], DBResult:rezultat, soima[30]
format(string, sizeof(string), "SELECT * FROM `akaunti` WHERE `Ime`='%s'", ImeIgrac(playerid))
rezultat = db_query(konekcijal, string)
if(db_num_rows(rezultat))
{
db_get_field_assoc(rezultat, "Lozinka", PlayerInfo[playerid][pLozinka], 64)
db_get_field_assoc(rezultat, "IP", PlayerInfo[playerid][pIP], 50)
db_get_field_assoc(rezultat, "Email", PlayerInfo[playerid][pEmail], 100)
db_get_field_assoc(rezultat, "Panel", PlayerInfo[playerid][pPanel], 30)
db_get_field_assoc(rezultat, "ID", soima, 30)
PlayerInfo[playerid][pID] = strval(soima)
db_get_field_assoc(rezultat, "Admin", soima, 30)
PlayerInfo[playerid][pAdmin] = strval(soima)
db_get_field_assoc(rezultat, "Level", soima, 30)
PlayerInfo[playerid][pLevel] = strval(soima)
db_get_field_assoc(rezultat, "Exp", soima, 30)
PlayerInfo[playerid][pExp] = strval(soima)
db_get_field_assoc(rezultat, "Drzava", soima, 30)
PlayerInfo[playerid][pDrzava] = strval(soima)
db_get_field_assoc(rezultat, "Pol", soima, 30)
PlayerInfo[playerid][pPol] = strval(soima)
db_get_field_assoc(rezultat, "Godini", soima, 30)
PlayerInfo[playerid][pGodini] = strval(soima)
db_get_field_assoc(rezultat, "GM", soima, 30)
PlayerInfo[playerid][pGM] = strval(soima)
db_get_field_assoc(rezultat, "Pari", soima, 30)
PlayerInfo[playerid][pPari] = strval(soima)
db_get_field_assoc(rezultat, "Spawn", soima, 30)
PlayerInfo[playerid][pSpawn] = strval(soima)
db_get_field_assoc(rezultat, "Skin", soima, 30)
PlayerInfo[playerid][pSkin] = strval(soima)
db_get_field_assoc(rezultat, "Zatvor", soima, 30)
PlayerInfo[playerid][pZatvor] = strval(soima)
}else Kick(playerid)
db_free_result(rezultat)
format(string, sizeof(string), "SELECT * FROM `clenovi` WHERE `Ime`='%s'", ImeIgrac(playerid))
rezultat = db_query(konekcijal, string)
if(db_num_rows(rezultat) == 1)
{
db_get_field_assoc(rezultat, "Lider", soima, 30)
new dalielider = strval(soima)
db_get_field_assoc(rezultat, "Mesto", soima, 30)
PlayerInfo[playerid][pClen] = strval(soima)
db_get_field_assoc(rezultat, "Rank", soima, 30)
PlayerInfo[playerid][pRank] = strval(soima)
if(dalielider == 1) PlayerInfo[playerid][pLider] = PlayerInfo[playerid][pClen]
}
db_free_result(rezultat)
return 1
}
new string[1000]
format(string, sizeof(string), "INSERT INTO `akaunti` (Ime, Lozinka, Email, Godini, Pol, Drzava, Pari, Skin, Level) VALUES ('%s', '%s', '%s', '%d', '%d', '%d', '%d', '7', '1')",
ImeIgrac(playerid), PlayerInfo[playerid][pLozinka], PlayerInfo[playerid][pEmail], PlayerInfo[playerid][pGodini], PlayerInfo[playerid][pPol], PlayerInfo[playerid][pDrzava], PlayerInfo[playerid][pPari])
db_free_result(db_query(konekcijal, string))
db_logging 1
Put in server.cfg
pawn Код:
|