Problem s PVarovima

Započeo LordShigi
5. Avg. 2010.
1,406
pregleda
6
postova
LordShigi
5
Crime Lord
5. Avg. 2010.
Imam funkciju ObnoviPodatke ispod OnPlayerDisconnect. Ta funkcija sprema pvarove u mysql bazu. Ali problem je da kad je pozovem pod OnPlayerDisconnect onda svi PVarovi imaju vrijednost 0. I to se spremi u bazu.
Deleted User
Obrisan korisnik
5. Avg. 2010.
Morat ćeš je prije pozvati jer svi PVarovi se resetiraju na 0 kad se igrač diskonekta, znači na OnPlayerDisconnect callbacku. Najbolje je da staviš u tajmer ili nešto tako.
LordShigi
5
Crime Lord
5. Avg. 2010.
Ok, hvala. Zbunjuje me to jer na SAMP WIKI pise da se jos mogu koristiti na OnPlayerDisconnect.
Deleted User
Obrisan korisnik
5. Avg. 2010.
Ustvari radi, jer sam testirao sada i vidio. Onda nije problem u tome, nego u toj tvojoj funkciji ili negdje.
LordShigi
5
Crime Lord
5. Avg. 2010.
Ocito imas puno vise znanja o tmoe nego meni pa daj mi malo pomozi.

Ovo je kod za slanje igracevih podataka na server:
public ObnoviPodatke(playerid)
{
new query;
new Ime;
GetPlayerName(playerid, Ime, sizeof(Ime));
mysql_real_escape_string(Ime,Ime);
printf("Saljem igraceve podatke na server %s.", Ime);
   format(query, sizeof(query),
"UPDATE `"TABLENAME"` SET `Novac`='%i',`Rank`='%i',`Respect`='%i',`Banana`='%i',`Area`='%i', `Upozorenja`='%i',`NovacBanka`='%i',`Kredit`='%i',`AdminNivo`='%i',`VIP`='%i',`Posao`='%i',`Organizacija`='%i',`Auto`='%i',`Brod`='%i',`Motor`='%i',`Bicikl`='%i',`Kuca`='%i',`Firma`='%i',`Drvo`='%i',`Metal`='%i',`Ljepilo`='%i',`Plastika`='%i',`Staklo`='%i',`Noz`='%i',`Uze`='%i',`Droga`='%i',`Alkohol`='%i',`LijekSifilis`='%i',`LijekGripa`='%i',`LijekMigrena`='%i' WHERE (`Ime` = '%s')",
GetPVarInt(playerid, "Novac"),GetPVarInt(playerid, "Rank"),GetPVarInt(playerid, "Respect"),
GetPVarInt(playerid, "Banana"), GetPVarInt(playerid, "Area"), GetPVarInt(playerid, "Upozorenja"), GetPVarInt(playerid, "NovacBanka"), GetPVarInt(playerid, "Kredit"), GetPVarInt(playerid, "AdminNivo"),
GetPVarInt(playerid, "VIP"), GetPVarInt(playerid, "Posao"), GetPVarInt(playerid, "Organizacija"), GetPVarInt(playerid, "Auto"), GetPVarInt(playerid, "Brod"), GetPVarInt(playerid, "Motor"),
GetPVarInt(playerid, "Bicikl"), GetPVarInt(playerid, "Kuca"), GetPVarInt(playerid, "Firma"), GetPVarInt(playerid, "Drvo"), GetPVarInt(playerid, "Metal"), GetPVarInt(playerid, "Ljepilo"),
GetPVarInt(playerid, "Plastika"), GetPVarInt(playerid, "Staklo"), GetPVarInt(playerid, "Noz"), GetPVarInt(playerid, "Uze"), GetPVarInt(playerid, "Droga"), GetPVarInt(playerid, "Alkohol"),
GetPVarInt(playerid, "LijekSifilis"), GetPVarInt(playerid, "LijekGripa"), GetPVarInt(playerid, "LijekMigrena") ,Ime);
   mysql_query(query, UPDATE_THREAD_ID, playerid);
}

Ovo je kod za primanje podataka:
public UcitajPodatke(playerid)
{
new query;
new Ime;
GetPlayerName(playerid, Ime, sizeof(Ime));
mysql_real_escape_string(Ime,Ime);
    format(query, sizeof(query), "SELECT * FROM `"TABLENAME"` WHERE `Ime` = '%s'", Ime);
    mysql_query(query, LOAD_THREAD_ID, playerid);
}

Ovo se izvrši nakon što je query za primanje podataka izvršen.
case LOAD_THREAD_ID: {
   new value;
GetPlayerName(extraid, pName, sizeof(pName));
mysql_store_result();
if (mysql_retrieve_row())
{
mysql_get_field("Novac",value); SetPVarInt(extraid, "Novac",strval(value));
mysql_get_field("Rank",value); SetPVarInt(extraid, "Rank",strval(value));
mysql_get_field("Respect",value); SetPVarInt(extraid, "Respect",strval(value));
mysql_get_field("Banana",value); SetPVarInt(extraid, "Banana",strval(value));
mysql_get_field("Area",value); SetPVarInt(extraid, "Area",strval(value));
mysql_get_field("Upozorenja",value); SetPVarInt(extraid, "Upozorenja",strval(value));
mysql_get_field("NovacBanka",value); SetPVarInt(extraid, "NovacBanka",strval(value));
mysql_get_field("Kredit",value); SetPVarInt(extraid, "Kredit",strval(value));
mysql_get_field("AdminNivo",value); SetPVarInt(extraid, "AdminNivo",strval(value));
mysql_get_field("VIP",value); SetPVarInt(extraid, "VIP",strval(value));
mysql_get_field("Posao",value); SetPVarInt(extraid, "Posao",strval(value));
mysql_get_field("Organizacija",value); SetPVarInt(extraid, "Organizacija",strval(value));
mysql_get_field("Auto",value); SetPVarInt(extraid, "Auto",strval(value));
mysql_get_field("Brod",value); SetPVarInt(extraid, "Brod",strval(value));
mysql_get_field("Motor",value); SetPVarInt(extraid, "Motor",strval(value));
mysql_get_field("Bicikl",value); SetPVarInt(extraid, "Bicikl",strval(value));
mysql_get_field("Kuca",value); SetPVarInt(extraid, "Kuca",strval(value));
mysql_get_field("Firma",value); SetPVarInt(extraid, "Firma",strval(value));
mysql_get_field("Drvo",value); SetPVarInt(extraid, "Drvo",strval(value));
mysql_get_field("Metal",value); SetPVarInt(extraid, "Metal",strval(value));
mysql_get_field("Ljepilo",value); SetPVarInt(extraid, "Ljepilo",strval(value));
mysql_get_field("Plastika",value); SetPVarInt(extraid, "Plastika",strval(value));
mysql_get_field("Staklo",value); SetPVarInt(extraid, "Staklo",strval(value));
               mysql_get_field("Noz",value); SetPVarInt(extraid, "Noz",strval(value));
               mysql_get_field("Uze",value); SetPVarInt(extraid, "Uze",strval(value));
               mysql_get_field("Droga",value); SetPVarInt(extraid, "Droga",strval(value));
               mysql_get_field("Alkohol",value); SetPVarInt(extraid, "Alkohol",strval(value));
               mysql_get_field("LijekSifilis",value); SetPVarInt(extraid, "LijekSifilis",strval(value));
               mysql_get_field("LijekGripa",value); SetPVarInt(extraid, "LijekGripa",strval(value));
               mysql_get_field("LijekMigrena",value); SetPVarInt(extraid, "LijekMigrena",strval(value));
printf("%i",GetPVarInt(extraid, "Novac"));
              printf("Ucitavanje podataka za igraca %s(%i) uspjelo.", pName, extraid);
}
mysql_free_result();
if(GetPVarInt(extraid,"Banana") == 1)
{
   SendClientMessage(extraid,LIGHTRED,"Banan si s ovog servera.");
Kick(extraid);
}
return 1;
}
LordShigi
5
Crime Lord
6. Avg. 2010.
Probao i nije u tome problem

Krivo sam napisao u postu iznad, sad cu ispraviti.

Diagnosticirao sam da je problem u primanju podataka, sad pokusavam otkriti u kojem dijelu.

Super, rijesio sam. napravio sam tak retardiranu pogresku da se sam sebi smijem sad. Zaboravio sam staviti da ucita podatke na registraciju.

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha