Kox Posted April 8, 2018 Share Posted April 8, 2018 Buna ziua ma scuzati ca va deranjez cu asta banuiesc ca e minor dar nu stiu sincer si vreau sa invat. Nume:Kox Varsta:22Problema:Am un event Hallowen Event totul ok pana iau bani dupa ce gasesc obiectul dar cand ies si intru iarasi nu se salveaza bani.Tin sa precizez ca gamemode ruleaza pe Mysql cu baza de date.Imagini:NuCod sursa: public OnPlayerPickUpPickup(playerid, pickupid) { if(pickupid == Pumpkin) { DestroyPickup(Pumpkin); new string[256], randmoney = 50000 + random(10000), name[MAX_PLAYER_NAME], Hour, Minute, Second; Winner = 1; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "> Pumpkin was found by %s. His wish him congratulations!", name); SendClientMessageToAll(COLOR_MAUVE, string); gettime(Hour, Minute, Second); format(string, sizeof(string), "> A new pumpkin will be hidden in %d minutes.", Minutes-Minute+10); SendClientMessageToAll(COLOR_MAUVE, string); format(string, sizeof(string), "You won the sum of $%d", randmoney); SendClientMessage(playerid, 0x2C8522FF, string); GivePlayerMoney(playerid, randmoney); Va multumesc Quote Link to comment Share on other sites More sharing options...
Makena Posted April 8, 2018 Share Posted April 8, 2018 Update(playerid, pCashx); la pCashx pune cum ai tu in gm Quote Link to comment Share on other sites More sharing options...
Dany_YTZ7 Posted April 8, 2018 Share Posted April 8, 2018 (edited) Ce fel de gm ai? Cand iei best-ul la war si zic cei invinsi despre tine ca ai AIM Edited April 8, 2018 by Dany_YTZ7 Quote Link to comment Share on other sites More sharing options...
Zooky. Posted April 8, 2018 Share Posted April 8, 2018 Pentru a salva datele in baza de date, va trebui sa trimiti un query. Iti recomand sa inveti SQL inainte de a te apuca de ceva de genul. https://www.w3schools.com/sql/ http://forum.sa-mp.com/showthread.php?t=129183 Va trebuie ca atunci cand te deconectezi, sa trimiti un query cu datele pe care le vrei salvate. Ceva de genul: new query[128]; format(query, sizeof(query), "UPDATE table SET field = '%d' WHERE id = '%d'", valoarea_1, id_internal_al_jucatorului); mysql_tquery(db_handle, query); Quote Link to comment Share on other sites More sharing options...
Un4m3d_Hokage Posted April 9, 2018 Share Posted April 9, 2018 (edited) Nu dai banii cu GivePlayerMoney, foloseste-te de PlayerInfo[play erid][pCash] += suma de bani pe care vrei sa i-o dai; zooky are si el dreptatea lui, foloseste aia dupa ce i-ai dat banii cu pCash += suma; new query[128]; format(query, sizeof(query), "UPDATE table SET Cash = '%d' WHERE id = '%d'", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pSQLID]); mysql_tquery(db_handle, query); p.s: uita-te tu sa editezi dupa cum ai tu variabiile in gamemode dar si in baza de date Edited April 9, 2018 by Un4m3d_Hokage Quote Link to comment Share on other sites More sharing options...
yashinAdevaratu Posted April 10, 2018 Share Posted April 10, 2018 In loc de GivePlayerMoney(playerid, randmoney); Foloseste GivePlayerCash(playerid, randmoney); Apoi da-i update in database folosindu-te de: Update(playerid, pCashx); Nu stiu cum ai tu in gamemode, dar este un exemplu ce ti-am dat mai sus. Quote Link to comment Share on other sites More sharing options...
Kox Posted April 10, 2018 Author Share Posted April 10, 2018 In loc de GivePlayerMoney(playerid, randmoney); Foloseste GivePlayerCash(playerid, randmoney); Apoi da-i update in database folosindu-te de: Update(playerid, pCashx); Nu stiu cum ai tu in gamemode, dar este un exemplu ce ti-am dat mai sus. Incerc revin cu un raspuns Quote Link to comment Share on other sites More sharing options...
yashinAdevaratu Posted April 10, 2018 Share Posted April 10, 2018 Incerc revin cu un raspuns Ai adaugat script-ul in gamemode sau folosesti filterscript? Quote Link to comment Share on other sites More sharing options...
HeliosNR1 Posted April 22, 2018 Share Posted April 22, 2018 GivePlayerMoney(playerid, randmoney); Foloseste GivePlayerCash(playerid, randmoney); Quote Link to comment Share on other sites More sharing options...
Butter SiLENT Posted April 23, 2018 Share Posted April 23, 2018 Trimite un query către baza de date care să dea update la câmpul 'Cash' sau cum ai tu. Quote Link to comment Share on other sites More sharing options...
SereK Posted April 23, 2018 Share Posted April 23, 2018 Loool, pune la ultima linia acolo dupa GivePlayerMoney...sub ea pune asa Update(player id, pCashx); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.