Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: Nihongo^ on Dec 05, 2017, 09:31 AM

Title: script not updating DATABASE
Post by: Nihongo^ on Dec 05, 2017, 09:31 AM
Hello iam trying to add gems on my script

ok to save gems stats my friend use savestats function which mean if the player left the server, script store his info ( gems ) into database
Quotefunction SaveStatus( player )
{
   QuerySQL(db, "UPDATE Accounts SET Gems = '"+status[ player.ID ].Gems+"', GemsRange = '"+status[ player.ID ].GemsRange+ "' WHERE Name = '"+ player.Name +"'");
   print( "saved status of player: "+player.Name+"." );
}

but i remove the savestats function and add this

Quotefunction IncGems( player )
{
   
        local Calc = PlayerGems( player ) + 1;
        local query1 = format( "UPDATE Account SET Gems=%i WHERE Name='" + player.Name +"'", Calc );
        QuerySQL( db, query1 );
   
}
function PlayerGems( player )
{
    local name = player.Name;
    local Answer = QuerySQL( db, "SELECT Kills, Deaths, Joins, Gems FROM Account WHERE Name='" + player.Name +"' COLLATE NOCASE" );
    local Gems = GetSQLColumnData( Answer, 0 );
    if ( !Gems ) return 0;
    else return Gems;
    FreeSQLQuery( Answer );
}

But the script is not updating the gems value in db also what is the use of this value

Quotelocal Gems = GetSQLColumnData( Answer, 0 );

why we put the 0 ?. I saw on my cash function it was 2

Title: Re: script not updating DATABASE
Post by: Nihongo^ on Dec 05, 2017, 02:23 PM
Rip this forum man nobodys helping me
Title: Re: script not updating DATABASE
Post by: Mohamed Boubekri on Dec 05, 2017, 06:30 PM
What u Man, i Don't Understand Anything.
Man just Use The Fuzzie Account System, Its very Good.
P.S Your English RAPED.
Good Luck.
Title: Re: script not updating DATABASE
Post by: Mohamed Boubekri on Dec 05, 2017, 06:31 PM
Try To Add it For function OnPlayerJoin & OnPlayerPart.
SaveStatus( player );GL.
Title: Re: script not updating DATABASE
Post by: Nihongo^ on Dec 06, 2017, 05:06 AM
Quote from: Mohamed on Dec 05, 2017, 06:30 PMP.S Your English RAPED.
Like You did master in inglish
Title: Re: script not updating DATABASE
Post by: Mohamed Boubekri on Dec 06, 2017, 07:26 AM
Fast Go School And Learn how to talk English
Good Luck.
Title: Re: script not updating DATABASE
Post by: Xmair on Dec 06, 2017, 09:06 AM
Quote from: Mohamed on Dec 06, 2017, 07:26 AMFast Go School And Learn how to talk English
Good Luck.
I suggest you to do the same.
Title: Re: script not updating DATABASE
Post by: Mohamed Boubekri on Dec 06, 2017, 09:35 AM
Quote from: Xmair on Dec 06, 2017, 09:06 AM
Quote from: Mohamed on Dec 06, 2017, 07:26 AMFast Go School And Learn how to talk English
Good Luck.
I suggest you to do the same.
Nah, i Already Learned
i Suggest You To Do the Same.
Title: Re: script not updating DATABASE
Post by: ! on Dec 07, 2017, 10:30 AM
Quote from: Mohamed on Dec 06, 2017, 09:35 AM
Quote from: Xmair on Dec 06, 2017, 09:06 AM
Quote from: Mohamed on Dec 06, 2017, 07:26 AMFast Go School And Learn how to talk English
Good Luck.
I suggest you to do the same.
Nah, i Already Learned
i Suggest You To Do the Same.
Lol and what was the reason of suggesting him Fuzzie Account System if you don't even know what he needs.

Quote from: Mohamed on Dec 05, 2017, 06:30 PMWhat u Man, i Don't Understand Anything.
Man just Use The Fuzzie Account System, Its very Good.
P.S Your English RAPED.
Good Luck.
Now we all know who needs to go to school.



@Nihongo^ try this
function IncGems( player )
{
   local Calc = PlayerGems( player ) + 1;
   QuerySQL( db, "UPDATE Account SET Gems='"+Calc+"' WHERE Name='"+player.Name+"'" );
}
function PlayerGems( player )
{
   local query = QuerySQL( db, "SELECT Gems FROM Account WHERE Name='"+player.Name+"'" );

   if ( !query ) return 0;

   local Gems = GetSQLColumnData( query, 0 );
   FreeSQLQuery( query );

   return Gems.tointeger();
}