19.01.2015, 18:01
Hello , i recently downloaded a server called LGG , the script tooks fine but i got a poplem in saving the groups. Here the codes.
AND THE CMD THAT SAVE IS :
My proplem that /savegroup [id] doesnt save to mysql , once i restart the server , everything is gone..
Please help
PHP код:
forward Group_Save(iGroupID); public Group_Save(iGroupID) {
if(!(0 <= iGroupID < MAX_GROUPS)) // Array bounds check. Use it.
return 0;
new
szQuery[2516],
i = 0;
format(szQuery, sizeof szQuery, "UPDATE `groups` SET \
`Type` = %i, `Name` = '%s', `Allegiance` = %i, `SirenAccess` = %i, `Bug` = %i, `Chat` = %i, \
`Radio` = %i, `DeptRadio` = %i, `DutyColour` = %i, `RadioColour` = %i, `Stock` = %i, \
`LockerX` = %.2f, `LockerY` = %.2f, `LockerZ` = %.2f, `LockerVW` = %i, `Share` = %i, \
`HourlyPayment` = %i, `Editable` = %i, `Disabled` = %i",
GroupData[iGroupID][g_iGroupType], GroupData[iGroupID][g_szGroupName], GroupData[iGroupID][g_iAllegiance], GroupData[iGroupID][g_iBugAccess], GroupData[iGroupID][g_iSirenAccess],
GroupData[iGroupID][g_iChatAccess], GroupData[iGroupID][g_iRadioAccess], GroupData[iGroupID][g_iDeptRadioAccess], GroupData[iGroupID][g_hDutyColour], GroupData[iGroupID][g_hRadioColour], GroupData[iGroupID][g_iLockerStock],
GroupData[iGroupID][g_fLockerPos][0], GroupData[iGroupID][g_fLockerPos][1], GroupData[iGroupID][g_fLockerPos][2], GroupData[iGroupID][g_iLockerVW], GroupData[iGroupID][g_iShareAssets], GroupData[iGroupID][g_iGroupHourlyPayment],
GroupData[iGroupID][g_iEditable], GroupData[iGroupID][g_iDisabled]);
for(i = 0; i != MAX_GROUP_RANKS; ++i) format(szQuery, sizeof szQuery, "%s, `Rank%i` = '%s'", szQuery, i, GroupRanks[iGroupID][i]);
for(i = 0; i != MAX_GROUP_DIVS; ++i) format(szQuery, sizeof szQuery, "%s, `Div%i` = '%s'", szQuery, i, GroupDivisions[iGroupID][i]);
for(i = 0; i != MAX_GROUP_WEAPONS; ++i) format(szQuery, sizeof szQuery, "%s, `Gun%i` = %i, `Cost%i` = %i", szQuery, i, GroupData[iGroupID][g_iLockerGuns][i], i, GroupData[iGroupID][g_iLockerCost][i]);
for(i = 0; i != MAX_GROUP_RANKS; i++) format(szQuery, sizeof szQuery, "%s, `RankSkin%i` = %i", szQuery, i, GroupData[iGroupID][g_iRankSkin][i]);
for(i = 0; i != MAX_GROUP_RANKS; i++) format(szQuery, sizeof szQuery, "%s, `Rank%iPay` = %i", szQuery, i, GroupData[iGroupID][g_iGroupPay][i]);
format(szQuery, sizeof szQuery, "%s WHERE `id` = %i", szQuery, iGroupID + 1);
return mysql_function_query(g_iConnectionHandle[0], szQuery, false, "OnQueryFinish", "i", THREAD_NO_RESULT);
}
PHP код:
CMD:savegroup(playerid, params[])
{
if(PlayerData[playerid][pAdmin] >= 3)
{
new iGroupID, iIndex, string[128];
if(sscanf(params, "d", iGroupID)) return SendClientMessage(playerid, COLOR_GRAD1, SYNTAX_MESSAGE"/savegroup [group id]");
Group_Save(iGroupID);
format(string, sizeof(string), "Successfully saved Group ID: %s (%d)", GroupData[iGroupID][g_szGroupName], iGroupID);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
Please help