03.08.2013, 20:27
Hi,
I have problem with mysql. I want to change dini to mysql in gamemode The Godfather.
I think its works, but i have problem with save playerdata.
Whet i put savePlayerData(playerid); to public onplayerdisconnect, after i left the server it will crash.
And when i put savePlayerData(playerid); into command /savedata i have message "Server: Unknown Command" Can somebody help me?
I have problem with mysql. I want to change dini to mysql in gamemode The Godfather.
I think its works, but i have problem with save playerdata.
Код:
stock savePlayerData(const playerid) { //if(PlayerInfo[playerid][pStatus] >= 1 || PlayerInfo[playerid][pStatus] == -1) { new saveQuery[3900]; if(PlayerInfo[playerid][pStatus] == -1) PlayerInfo[playerid][pStatus] = 0; format(saveQuery, sizeof(saveQuery), "UPDATE playeraccounts SET playerMoney = '%d', playerLevel = '%d', playerAdminLevel = '%d', playerDonateRank = '%d', playerUpgradePoints = '%d'", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pDonateRank], PlayerInfo[playerid][gPupgrade]); format(saveQuery, sizeof(saveQuery), "%s, playerConnectedTime = '%d', playerRegistered = '%d', playerSex = '%d', playerAge = '%d', playerOrigin = '%d', playerCK = '%d', playerMuted = '%d'", saveQuery, PlayerInfo[playerid][pConnectTime], PlayerInfo[playerid][pReg], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pAge], PlayerInfo[playerid][pOrigin], PlayerInfo[playerid][pCK], PlayerInfo[playerid][pMuted]); format(saveQuery, sizeof(saveQuery), "%s, playerRespect = '%d', playerMoney = '%d', playerBank = '%d', playerCrimes = '%d', playerKills = '%d', playerDeaths = '%d', playerArrested = '%d'", saveQuery, PlayerInfo[playerid][pExp], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pAccount], PlayerInfo[playerid][pCrimes], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pArrested]); format(saveQuery, sizeof(saveQuery), "%s, playerWantedDeaths = '%d', playerPhonebook = '%d', playerLottoNr = '%d', playerFishes = '%d', playerBiggestFish = '%d', playerJob = '%d', playerPaycheck = '%d'", saveQuery, PlayerInfo[playerid][pWantedDeaths], PlayerInfo[playerid][pPhoneBook], PlayerInfo[playerid][pLottoNr], PlayerInfo[playerid][pFishes], PlayerInfo[playerid][pBiggestFish], PlayerInfo[playerid][pJob], PlayerInfo[playerid][pPayCheck]); format(saveQuery, sizeof(saveQuery), "%s, playerJailed = '%d', playerJailTime = '%d', playerMaterials = '%d', playerDrugs = '%d', playerLeader = '%d', playerMember = '%d', playerFMember = '%d'", saveQuery, PlayerInfo[playerid][pJailed], PlayerInfo[playerid][pJailTime], PlayerInfo[playerid][pMats], PlayerInfo[playerid][pDrugs], PlayerInfo[playerid][pLeader], PlayerInfo[playerid][pMember], PlayerInfo[playerid][pFMember]); format(saveQuery, sizeof(saveQuery), "%s, playerRank = '%d', playerChar = '%d', playerContractTime = '%d', playerDetSkill = '%d', playerSexSkill = '%d', playerBoxSkill = '%d', playerLawSkill = '%d', playerMechSkill = '%d', playerJackSkill = '%d'", saveQuery, PlayerInfo[playerid][pRank], PlayerInfo[playerid][pChar], PlayerInfo[playerid][pContractTime], PlayerInfo[playerid][pDetSkill], PlayerInfo[playerid][pSexSkill], PlayerInfo[playerid][pBoxSkill], PlayerInfo[playerid][pLawSkill], PlayerInfo[playerid][pMechSkill], PlayerInfo[playerid][pJackSkill]); format(saveQuery, sizeof(saveQuery), "%s, playerCarSkill = '%d', playerNewsSkill = '%d', playerDrugsSkill = '%d', playerCookSkill = '%d', playerFishSkill = '%d', playerSHealth = '%f', playerHealth = '%f', playerInt = '%d', playerLocal = '%d', playerTeam = '%d', playerModel = '%d'", saveQuery, PlayerInfo[playerid][pCarSkill], PlayerInfo[playerid][pNewsSkill], PlayerInfo[playerid][pDrugsSkill], PlayerInfo[playerid][pCookSkill], PlayerInfo[playerid][pFishSkill], PlayerInfo[playerid][pSHealth], PlayerInfo[playerid][pHealth], PlayerInfo[playerid][pInt], PlayerInfo[playerid][pLocal], PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel]); format(saveQuery, sizeof(saveQuery), "%s, playerPhoneNr = '%d', playerHouse = '%d', playerBizz = '%d', playerX = '%f', playerY = '%f', playerZ = '%f', playerCarLic = '%d', playerFlyLic = '%d', playerBoatLic = '%d', playerFishLic = '%d', playerGunLic = '%d', playerGun1 = '%d', playerGun2 = '%d', playerGun3 = '%d'", saveQuery, PlayerInfo[playerid][pPnumber], PlayerInfo[playerid][pPhousekey], PlayerInfo[playerid][pPbiskey], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], PlayerInfo[playerid][pCarLic], PlayerInfo[playerid][pFlyLic], PlayerInfo[playerid][pBoatLic], PlayerInfo[playerid][pFishLic], PlayerInfo[playerid][pGunLic], PlayerInfo[playerid][pGun1], PlayerInfo[playerid][pGun2], PlayerInfo[playerid][pGun3]); format(saveQuery, sizeof(saveQuery), "%s, playerGun4 = '%d', playerAmmo1 = '%d', playerAmmo2 = '%d', playerAmmo3 = '%d' playerAmmo4 = '%d'", saveQuery, PlayerInfo[playerid][pGun4], PlayerInfo[playerid][pAmmo1], PlayerInfo[playerid][pAmmo2], PlayerInfo[playerid][pAmmo3], PlayerInfo[playerid][pAmmo4]); format(saveQuery, sizeof(saveQuery), "%s, playerCarTime = '%d', playerPayDay = '%d', playerPayDayHad = '%d', playerCDPlayer = '%d', playerWins = '%d', playerLoses = '%d', playerAlcoholPerk = '%d', playerDrugPerk = '%d', playerMiserPerk = '%d', playerPainPerk = '%d', playerTraderPerk = '%d', playerTutorial = '%d', playerMission = '%d', playerWarnings = '%d', playerAdjustable = '%d', playerFuel = '%d'", saveQuery, PlayerInfo[playerid][pCarTime], PlayerInfo[playerid][pPayDay], PlayerInfo[playerid][pPayDayHad], PlayerInfo[playerid][pCDPlayer], PlayerInfo[playerid][pWins], PlayerInfo[playerid][pLoses], PlayerInfo[playerid][pAlcoholPerk], PlayerInfo[playerid][pDrugPerk], PlayerInfo[playerid][pMiserPerk], PlayerInfo[playerid][pPainPerk], PlayerInfo[playerid][pTraderPerk], PlayerInfo[playerid][pTut], PlayerInfo[playerid][pMissionNr], PlayerInfo[playerid][pWarns], PlayerInfo[playerid][pAdjustable], PlayerInfo[playerid][pFuel]); format(saveQuery, sizeof(saveQuery), "%s WHERE playerID = '%d'", saveQuery, PlayerInfo[playerid][pUID]); mysql_query(saveQuery); } return 1; }
And when i put savePlayerData(playerid); into command /savedata i have message "Server: Unknown Command" Can somebody help me?