mySQL - Robbery System - Money - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mySQL - Robbery System - Money (
/showthread.php?tid=647544)
mySQL - Robbery System - Money -
Oshery - 06.01.2018
After getting the robbed cash in game it isn't being updated in mysql database.
i even made a command for that savestats but nothing its still not updating it.
here are the codes
here is the line after robbing business
Код:
case STAGE_ROBBING:
{
Robbery_Cooldown(id);
format(string, sizeof(string), "~n~~n~~n~~b~~h~~h~Robbery Complete~n~~w~Money Stolen: ~g~~h~~h~%s", formatInt(pInfo[playerid][Money]));
GameTextForPlayer(playerid, string, 3000, 3);
a_GivePlayerMoney(playerid, pInfo[playerid][Money]);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "[ROBBERY] {FFFFFF}%s(%d) robbed {2ECC71}%s {FFFFFF}from {F1C40F}%s.", name, playerid, formatInt(pInfo[playerid][Money]), RobberyData[id][Name]);
SendClientMessageToAll(0x3498DBFF, string);
if(pInfo[playerid][Money] > RobberyData[id][RecordAmount])
{
RobberyData[id][RecordAmount] = pInfo[playerid][Money];
RobberyData[id][RecordBy] = name;
SendClientMessage(playerid, 0x3498DBFF, "[ROBBERY] {FFFFFF}You broke this robbery place's record!");
format(string, sizeof(string), "[ROBBERY] {FFFFFF}Because of that, you'll be rewarded with 15 percent bonus. {2ECC71}(%s)", formatInt(floatround(pInfo[playerid][Money] * 0.15)));
SendClientMessage(playerid, 0x3498DBFF, string);
a_GivePlayerMoney(playerid, floatround(pInfo[playerid][Money] * 0.15));
stmt_bind_value(UpdateRecord, 0, DB::TYPE_INTEGER, RobberyData[id][RecordAmount]);
stmt_bind_value(UpdateRecord, 1, DB::TYPE_STRING, RobberyData[id][RecordBy], MAX_PLAYER_NAME);
stmt_bind_value(UpdateRecord, 2, DB::TYPE_INTEGER, id);
stmt_execute(UpdateRecord);
}
Код:
a_GivePlayerMoney(playerid, money)
{
pInfo[playerid][Money] += money;
GivePlayerMoney(playerid, money);
}
Код:
SaveStats(playerid)
{
if(pInfo[playerid][Login] == 1)
{
mysql_format(mysql, query, 300, "UPDATE `users` SET `Name`='%s',`IP`='%e',`Score`='%d',`Money`='%d',`Kills`='%d',`Deaths`='%d',`Licenses`='%d',`Admin`='%d',`Operator`='%d',`Donor`='%d',`Logined`='0' WHERE `Name`='%e'",
pInfo[playerid][Name],pInfo[playerid][IP],pInfo[playerid][Score],pInfo[playerid][Money],pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][Licenses],pInfo[playerid][Admin],pInfo[playerid][Helper],pInfo[playerid][Donor],pInfo[playerid][Name]);
mysql_query(mysql, query);
}
return 1;
}