Sistem ne zbraja ubojstva/smrti.

Započeo Plen Ki Mun, Decembar 22, 2017, 12:44:46 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Skripta koju koristim: Skriptu koristim kao FS / Klan.

Detaljan opis problema: Filterskipta je pisana u SQLite, problem je u tome Å¡to kada netko iz bilo kojega klana ubije igraca ili netko umre skripta to ne zbraja u u Klan ubojsta to jest smrti. Sve ostane na 0

Dio skripte: pokazat cu dolje ima puno koda.

Neke slike/video za lakse dobivanje pomoci(neobavezno): //

@Cadilab @Ino42O @Slade
Netko iskusniji neka pomogne.

TABLE


clankills INT(5),\
clandeaths INT(5))");


ONPLAYERDEATH


public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerAnyClanMember(playerid) && IsPlayerAnyClanMember(killerid))
{
    if(strcmp(GetPlayerClan(playerid), GetPlayerClan(killerid), true, 30) == 0)
    {
        return 1;
}
else
{
    new CQuery[200];
format(CQuery, 200, "UPDATE `clans` SET `clankills` = `clankills`+1 = '%d' WHERE `clanname` = '%s'", GetClanKills(GetPlayerClan(killerid)) , GetPlayerClan(killerid));
  db_query(Database, CQuery);
format(CQuery, 200, "UPDATE `clans` SET `clandeaths` = `clandeaths`+1 = '%d' WHERE `clanname` = '%s'", GetClanDeaths(GetPlayerClan(playerid)) , GetPlayerClan(playerid));
db_query(Database, CQuery);
}
}
return 1;
}


KLAN STATISTIKA (OSTAJE NA 0)


format(csstr5, 120, "{E10000}• {FFFFFF}Clan Kills: %d\n", GetClanKills(GetPlayerClan(playerid)));
format(csstr6, 120, "{E10000}• {FFFFFF}Clan Deaths: %d\n", GetClanDeaths(GetPlayerClan(playerid)));



//----------------//
stock GetClanKills(clan[])
{
new CQuery[100], clan_kills[100];
format(CQuery, sizeof(CQuery), "SELECT `clankills` FROM `clans` WHERE `clanname` = '%s'", clan);
Result = db_query( Database, CQuery );
db_get_field_assoc( Result, "clankills", clan_kills, 30 );
db_free_result(Result);
return strval(clan_kills);
}
//----------------//
stock GetClanDeaths(clan[])
{
new CQuery[100], clan_deaths[100];
format(CQuery, sizeof(CQuery), "SELECT `clandeaths` FROM `clans` WHERE `clanname` = '%s'", clan);
Result = db_query( Database, CQuery );
db_get_field_assoc( Result, "clandeaths", clan_deaths, 30 );
db_free_result(Result);
return strval(clan_deaths);
}



stock CreateClan(playerid, clan_name[], clan_tag[], clan_description[], clan_motd[])
{
new CQuery[400], QCRows;

format(CQuery, 200, "SELECT `clanname` FROM `clans` WHERE `clanname` = '%s'", clan_name);
Result = db_query(Database, CQuery);
QCRows = db_num_rows(Result);
if(QCRows >= 1)
{
SendClientMessage(playerid, RED, "(ERROR): {FFFFFF}Isti klan postoji!");
return 0;
}
db_free_result(Result);
format(CQuery, 400, "INSERT INTO `clans`(`clanname`, `clantag`, `clanleader`, `clandes`, `clanmotd`, `clankills`, `clandeaths`) VALUES('%s', '%s', '%s', '%s', '%s', '0', '0')", clan_name, clan_tag, GetPlayerNameEx(playerid), clan_description, clan_motd);
db_query(Database, CQuery);
format(CQuery, 400, "INSERT INTO `members`(`clanname`, `playername`, `playerclanrank`, `isinclan`, `IsOnline`) VALUES('%s', '%s', 4, 1, 1)", clan_name, GetPlayerNameEx(playerid));
db_query(Database, CQuery);
return 1;
}



Poslednja Izmena: Decembar 22, 2017, 12:50:05 POSLE PODNE od Vantage


Jel ima neki log kao kod mysql-a? Tu ti sve pise kad ne updejta ili je premali query ili je empty (nisi lepo formatirao)?

Citat: \nLucius poslato Decembar 22, 2017, 15:28:59 POSLE PODNE
Jel ima neki log kao kod mysql-a? Tu ti sve pise kad ne updejta ili je premali query ili je empty (nisi lepo formatirao)?

Ma nema toga, sve radi i testirano je na maximumu, ali samo to nece a uzim kills / deaths, to jest ne ocitava ih.

Gledaj, ti si postavio provjeru da ce dodati +1 u klan statistiku ako netko iz jednoga klana ubije nekoga iz drugog a ti hoces ako ubije bilo koga, jer tako ?

To bi ti ona išlo ovako.


public OnPlayerDeath(playerid, killerid, reason)
{
    new CQuery[200];
    format(CQuery, 200, "UPDATE `clans` SET `clankills` = `clankills`+1 = '%d' WHERE `clanname` = '%s'", GetClanKills(GetPlayerClan(killerid)) ,
    GetPlayerClan(killerid));
    db_query(Database, CQuery);
    format(CQuery, 200, "UPDATE `clans` SET `clandeaths` = `clandeaths`+1 = '%d' WHERE `clanname` = '%s'", GetClanDeaths(GetPlayerClan(playerid)) ,
    GetPlayerClan(playerid));
    b_query(Database, CQuery);
    return 1;
}
Former Developer | COD: Lords Of War - Modern Warfare 3 | Stunt Planet | Global Warfare |




RijeÅ¡enje je naÄ'eno.
heroin rap - Moskri u kuci, od sledece lajne glava ce mi puci