savestats

Started by Finch, Mar 21, 2015, 01:47 PM

Previous topic - Next topic

DizzasTeR

Quote from: S.L.C on Mar 23, 2015, 10:16 AMOne more question: Do you even debug your code? Or you just come here and every time something doesn't work.

I don't think you need to ask that. The answer is No.

Edit: Finch kia tum urdu read kar saktay ho?
Reply me if you understood that finch.

EK.IceFlake

Quote from: Finch on Mar 21, 2015, 01:47 PMmy save stats system not working when i kill someone then i type /stats it tell kills 1 then when i do /q it say in console save stats player and when i rejoin and type /stats 0 kills and 0 deaths what is this?

this is savestats function
function SaveStats( player )
{
       try{
   local id = player.ID;
   if ( status[ id ].IsReg == true )
   {
       QuerySQL( db, "UPDATE Account SET Kills='" + status[ id ].Kills + "', Deaths='" + status[ player.ID ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "' WHERE Name='" + player.Name.tolower() + "'" );
   print( "Saved Stats of Player " + player.Name + "[" + player.ID + "]" );
   status[ id ] = null;
   }
   }
   catch(e) print( "Save Stats Error: " + e );
}


QuoteQuerySQL( db, "UPDATE Account SET Kills='" + status[ id ].Kills + "', Deaths='" + status[ player.ID ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "' WHERE Name='" + player.Name.tolower() + "'" );
Are you sure these guys are stored as a string? Try changing to
QuerySQL( db, "UPDATE Account SET Kills=" + status[ id ].Kills + ", Deaths=" + status[ player.ID ].Deaths + ", Cash=" + status[ id ].Cash + ", Bank=" + status[ id ].Bank + " WHERE Name='" + player.Name.tolower() + "'" );

Finch

Not working crystal
Beztone is a scripter but he is too stupid

vcmptr

function SaveStats( player )
{
       try{
    local id = player.ID;
if ( ( status[ player.ID ].IsReg == true ) && ( status[ player.ID ].IsLogged == true ) )
    {
        QuerySQL( db, "UPDATE Account SET Kills='" + status[ id ].Kills + "', Deaths='" + status[ player.ID ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "' WHERE Name='" + player.Name.tolower() + "'" );
     print( "Saved Stats of Player " + player.Name + "[" + player.ID + "]" );
     status[ id ] = null;
    }
    }
    catch(e) print( "Save Stats Error: " + e );
}
Try this.
My English is not good.

Finch

Yeah i Can Understand Doom_Killer <.>


Again not working
Beztone is a scripter but he is too stupid

.

Quote from: Finch on Mar 23, 2015, 03:10 PMYeah i Can Understand Doom_Killer <.>

Are you sure?

Quote from: Finch on Mar 23, 2015, 03:10 PMAgain not working

You're just dying to prove me right with every post you make ;D
Quote from: S.L.C on Mar 23, 2015, 10:07 AMAll you can say is something like "Not work!" and give some sh!tty code, copied from god knows where.
.

DizzasTeR

Quote from: Finch on Mar 23, 2015, 03:10 PMYeah i Can Understand Doom_Killer <.>


Again not working

Sorry if this is against rules but maybe this will reduce this disaster.

Finch Khuda kay leye agr ap scripting nahi kar saktay to na karein kyun kay ap ko samajh nahi aati aur aap theke.tara say error bhi nahi post kartay, Behtar ho ga agar aap dosroon kay server mein khelein ya phir jald jab mera server host ho jai ga jo kay mein apnay aik bro kay sath bana raha hun to ap wahan bhi khelna. Laiken agar aap kisi tareeqay say bhi scripting karna nahi chorna chahte to theke hai magar kam as kam error to theke post kia karein, console aur script notepad mein khol kar os error line ki bhi screen lia karo aur post karo aur jitna ho sakay detail dia karo error ki, aur agar aap sahi tareeqay say post karo gey i bet koi aap ki insult nahi karay ga.
 :)
Hope you will act upon my advice.

Finch

me janta hu doom magr is me post karne me he hi kya phr bhi yeh lo screen shot sari cheezo ke phele set kills in server ke stats cmd ke sath




or ab console ki screen shot





or yeh ab rejoin server ki stats cmd ke sath



Beztone is a scripter but he is too stupid

EK.IceFlake

Quote from: Finch on Mar 24, 2015, 08:27 AMor ab console ki screen shot



Yeh tumhe kahan se console ka screenshot lagta he?
English: From where does it look like a screenshot of console?

rObInX

Database is fucked up.

Try deleting the db and then try.

DizzasTeR

Quote from: NE.CrystalBlue on Mar 24, 2015, 08:58 AM
Quote from: Finch on Mar 24, 2015, 08:27 AMor ab console ki screen shot



Yeh tumhe kahan se console ka screenshot lagta he?
English: From where does it look like a screenshot of console?

Guzara karta hai, atleast samajh to a rahi hai.

try what robinx said.

rww

#26
I know that it will not help you, but:



2x the same module
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

.

#27
Quote from: rwwpl on Mar 24, 2015, 12:26 PMI know that it will not help you, but:

2x the same module

The functions will simply be overwritten by the second loaded module. If the functions weren't available then you'd get a message like "index doesn't exist". I'm sure the bug is really simple. I'll look later into the SQLite module of stormeus and see if I can add proper error reporting. That way you will know there's something wrong with the query if it fails.
.

MacTavish

Off: Guys maybe you didnt noticed but in his top 5 killers have 900 kills so it is clear that none of his function have problem, maybe his stats cmd is bugged

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Kratos_


I tried to make some attempts to conclude something from the codes he posted , here they are :-

-> On console , it prints that his stats saved
This points that the value that array holds is actually transferred to the database because his Savestats function do not have any issue . Thus , it is actually called .

-> When he sets his kills to 900 then this change appear in stats on that particular Join
This points that he is making change to the array variables & so stats gets modified as well .

-> On Next Join, his name appear on Top 5 Killers
This points that arrays were successful in transferring the changed value of Kills on previous Join & that Top 5 list will be made by getting Kills directly from the database .

-> But , on next Join, his kills doesn't gets modified in Stats
This points that arrays aren't syncing anything from the database during login . The arrays are just exploited as one-way . They just transfer the value to the database but aren't designed to get anything from the database when a player does login .

So , After having a glance at all the possibilities , Its the arrays which aren't getting anything from the database while they are supposed to .

Then why the kills & deaths are showing as 0 when player types stats command ?
Answer : Because they're initialized as 0 in class PlayerStats . This way :-
class PlayerStats
{
Kills = 0;
Deaths = 0;
}

Without getting the values from the database , how can u expect that this will appear on your stats ? You need to make a request to the database so that it will give you its contents .

What should you do ?
-> You should take the Kills value from the database so that they can be stored in array & thus making up your stats .

OffTopic :- I tried to tell you this fact here but you haven't responded . Anyway , make those changes to your login function I described & make them sync Kills , Deaths etc  otherwise it will do the same for the remaining values as well .


In the middle of chaos , lies opportunity.