Little Help.
#1

Hello everybody.Today I get big problem with my saving system.Here is the code
pawn Код:
SaveServerCfg()
{
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `doublescore` = %d",sPanel[Doublescore]);
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `carcapture` = %d",sPanel[CarCapture]);
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `connectmessage` = %d",sPanel[ConnectMessage]);
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `watchpm` = %d",sPanel[WatchPM]);
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `zonesdebug` = %d",sPanel[ZonesDebug]);
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `drugstats` = %d",DrugStats);
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `weaponstats` = %d",WeaponStats);
    mysql_query(slova);

}
This function is saving those variables into MySQL database.But some how Drug and weapon stats won`t save.I don`t know why.Anyone can helps me?
Reply
#2

Use https://sampwiki.blast.hk/wiki/Strcat to concatenate strings together.
Reply
#3

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Use https://sampwiki.blast.hk/wiki/Strcat to concatenate strings together.
Aha ok I will try
Reply
#4

pawn Код:
SaveServerCfg()
{
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `doublescore` = %d, `carcapture` = %d, `connectmessage` = %d, `watchpm` = %d, `zonesdebug` = %d, `drugstats` = %d, `weaponstats` = %d",
    sPanel[Doublescore], sPanel[CarCapture], sPanel[ConnectMessage], sPanel[WatchPM], sPanel[ZonesDebug], DrugStats, WeaponStats);
    mysql_query(slova);
   
}
Make sure the size of slova is enough to store the whole text.
Reply
#5

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Use https://sampwiki.blast.hk/wiki/Strcat to concatenate strings together.
It`s not working again same problem it`s not saving...
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
SaveServerCfg()
{
    format(slova, sizeof(slova), "UPDATE `serverpanel` SET `doublescore` = %d, `carcapture` = %d, `connectmessage` = %d, `watchpm` = %d, `zonesdebug` = %d, `drugstats` = %d, `weaponstats` = %d",
    sPanel[Doublescore], sPanel[CarCapture], sPanel[ConnectMessage], sPanel[WatchPM], sPanel[ZonesDebug], DrugStats, WeaponStats);
    mysql_query(slova);
   
}
Make sure the size of slova is enough to store the whole text.
Again same thing..
Reply
#7

Post your mysql logs.
Reply
#8

Код:
[14:05:41] ---------------------------

[14:05:41] MySQL Debugging activated (01/08/14)

[14:05:41] ---------------------------

[14:05:41]  

[14:05:41] >> mysql_connect( )

[14:05:41] CMySQLHandler::CMySQLHandler() - constructor called.

[14:05:41] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "samp23" | Username: "root" ...

[14:05:41] CMySQLHandler::Connect() - Connection was successful.

[14:05:41] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[14:05:41] >> mysql_query( Connection handle: 1 )

[14:05:41] CMySQLHandler::Query(SELECT * FROM serverpanel) - Successfully executed.

[14:05:41] >> mysql_store_result( Connection handle: 1 )

[14:05:41] CMySQLHandler::StoreResult() - Result was stored.

[14:05:41] >> mysql_num_rows( Connection handle: 1 )

[14:05:41] CMySQLHandler::NumRows() - Returned 1 row(s)

[14:05:41] >> mysql_retrieve_row( Connection handle: 1 )

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("doublescore") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("carcapture") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("connectmessage") - 1

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("watchpm") - 1

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("zonesdebug") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("drugstats") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("weaponstats") - 20

[14:05:41] >> mysql_free_result( Connection handle: 1 )

[14:05:41] CMySQLHandler::FreeResult() - Result was successfully free'd.

[14:05:41] >> mysql_query( Connection handle: 1 )

[14:05:41] CMySQLHandler::Query(UPDATE `serverpanel` SET `doublescore` = 0, `carcapture` = 0, `connectmessage` = 1, `watchpm` = 1, `zonesdebug` = 0, `drugstats` = 0, `weaponstats` = 20) - Successfully executed.

[14:05:41] >> mysql_query( Connection handle: 1 )

[14:05:41] CMySQLHandler::Query(SELECT * FROM serverpanel) - Successfully executed.

[14:05:41] >> mysql_store_result( Connection handle: 1 )

[14:05:41] CMySQLHandler::StoreResult() - Result was stored.

[14:05:41] >> mysql_num_rows( Connection handle: 1 )

[14:05:41] CMySQLHandler::NumRows() - Returned 1 row(s)

[14:05:41] >> mysql_retrieve_row( Connection handle: 1 )

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("doublescore") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("carcapture") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("connectmessage") - 1

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("watchpm") - 1

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("zonesdebug") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("drugstats") - 0

[14:05:41] >> mysql_fetch_field_row( Connection handle: 1 )

[14:05:41] CMySQLHandler::FetchField("weaponstats") - 20

[14:05:41] >> mysql_free_result( Connection handle: 1 )

[14:05:41] CMySQLHandler::FreeResult() - Result was successfully free'd.

[14:05:41] >> mysql_query( Connection handle: 1 )

[14:05:41] CMySQLHandler::Query(UPDATE `serverpanel` SET `doublescore` = 0, `carcapture` = 0, `connectmessage` = 1, `watchpm` = 1, `zonesdebug` = 0, `drugstats` = 0, `weaponstats` = 20) - Successfully executed.
Reply
#9

What is not working ?
pawn Код:
[14:05:41] CMySQLHandler::Query(UPDATE `serverpanel` SET `doublescore` = 0, `carcapture` = 0, `connectmessage` = 1, `watchpm` = 1, `zonesdebug` = 0, `drugstats` = 0, `weaponstats` = 20) - Successfully executed.
@Logs : Successfully executed. query executed successfully!
Reply
#10

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
What is not working ?
pawn Код:
[14:05:41] CMySQLHandler::Query(UPDATE `serverpanel` SET `doublescore` = 0, `carcapture` = 0, `connectmessage` = 1, `watchpm` = 1, `zonesdebug` = 0, `drugstats` = 0, `weaponstats` = 20) - Successfully executed.
@Logs : Successfully executed. query executed successfully!
Ye but when I buy something in weapon store debug is saying me there is 12 left.I restart server and there is 20 again.
I don`t know why?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)