Jump to content

SinaAmp

Members
  • Posts

    94
  • Joined

  • Last visited

Everything posted by SinaAmp

  1. Thank you bro that worked can you please expline this line of your code? if(#SkinData > 0) then for _,row in ipairs(SkinData) do setElementModel(source, row["Skin"]) end
  2. im testing the WHERE that solved the updating specific row data problem but after login the skins not change
  3. Hello guys i want to UPDATE data in database for the user who buy in store and retrive it after player login but the problem is the player gets the latest row data not his saved data with his account name here is my script: and login script: @Burak5312 @The_GTA @IIYAMA
  4. finally solved this issue function afterlogin(theplayer) if isElement(theplayer) and getElementType(theplayer) ~= "player" then return end local SkinData = dbPoll(dbQuery(db,"SELECT Account,Skin,ID FROM SkinShop"), -1) local account = getPlayerAccount(source) local accName = getAccountName(account) if (SkinData) and (SkinData[1]) and (SkinData[2]) then if (SkinData[1].Account == tostring(accName)) then setElementModel(source, SkinData[2].Skin ) end end end addEventHandler("onPlayerLogin",root, afterlogin)
  5. hi if you using database you must wrote the function that update your previous saved skin model data in database after leaving or changing job or faction
  6. thank you bro maybe @The_GTA can help
  7. skin save in database when the player buy the skin but not when player disconnected from server i want to get and use that saved data from shop
  8. this is my database https://s6.uupload.ir/files/mysqlda_60e3.png this problem solved but when every player loged in, their skin change to saved skin in database @Burak5312
  9. Thank you bro problem solved i want to wrote the script that get skin id from database after login and set player model to it but again my script not work: function afterlogin() local skinData = dbQuery(db,"SELECT Skin,Account FROM SkinShop") local result = dbPoll(skinData,-1) if (result) and (result[1]) and (result[2]) then setElementModel(source, result[1].skin ) end end addEventHandler("onPlayerLogin",root, afterlogin)
  10. thank you @Burak5312 after runing your script the errors had disapared but i got dbexec fail error and null account name in my account column in database the id and skinid had no issue and saved data well
  11. Hello guys i want to get player account to save his name in database but i got this error: script: function BuySkin159 (theplayer) local account = getPlayerAccount(theplayer) local accName = getAccountName(account) local skinprice = 5000 if account then if getPlayerMoney(theplayer) >= skinprice then takePlayerMoney(theplayer, 5000) setTimer(function() fadeCamera(theplayer,true) setElementModel(theplayer, 159) local ID = getFreeID() local skinid = 159 local myData = dbExec(db,"INSERT INTO SkinShop VALUES (?, ?, ?)",ID,accName,skinid) skin = getElementModel(theplayer) outputChatBox("#00ff00 [Done]: #ffffffskin shoma be id #ff0000"..skin.."#ffffff taghir kard",theplayer, 255,255,255,true) end,1000,1) fadeCamera(theplayer,false) end end end addEventHandler("onMarkerHit", marker1, BuySkin159)
  12. sorry guys problem solved by using this trick https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server
  13. hello guys i want to connect one of my resources to mysql workbench server but i got this error https://imgur.com/a/sdVhvz4
  14. but how to change element model to received skin number
  15. yes but not work id select from column id and skin from column skin
  16. guys i changed theplayer to source but nothing changed i disconnected from server and loged again but my skin doesent changed is that connection part in dbquery is true? https://imgur.com/a/W1hOs3w i changed the dbpoll query handle to skinData
  17. hi guys i want to change the player skin after login . i mean after player logged i want to setplayermodel to the number i saved in the accounts table here is my connecting script and that works well: local db_host = "" local db_username = "" local db_password = "" local db_table = "" local db_port = "" local connection = false function connect() connection = dbConnect("mysql","dbname="..db_table..";host="..db_host..";port="..db_port..";unix_socket=/var/run/mysqld/mysqld.sock",db_username,db_password) if (connection) then outputChatBox("connected") return true else outputChatBox("not connected") setTimer(connect,5000,1) end end addEventHandler("onResourceStart",resourceRoot,connect) and this is my changing skin code: function afterlogin() local skinData = dbQuery(connection,"SELECT * FROM accounts WHERE id=? AND skin=? LIMIT 1",(id),(skin)) local result = dbPoll( qh, -1 ) if (skinData) then setElementData(theplayer,"id",skinData.id) setElementModel (theplayer, skinData.skin ) end end addEventHandler("onPlayerLogin",root, afterlogin)
  18. thank you so much @IIYAMA and @Burak5312 changing size worked
  19. I want to take money from player but that does not work for no reason No I don't want to do same thing to all of them I tested my code to output something in chat box but that doesn't work too!
  20. thank you also i have another issue i dont know why my code doesent work and show any error in debugscript marker1 = createMarker(163.017578125, -89.5458984375, 1000.8046875,"cylinder",1.0) setElementInterior(marker1, 18) marker2 = createMarker(159.3408203125, -89.36328125, 1000.8046875,"cylinder",1.0) setElementInterior(marker2, 18) marker3 = createMarker(153.2841796875, -78.6357421875, 1000.8046875,"cylinder",1.0) setElementInterior(marker3, 18) function skin159 (theplayer) if getPlayerMoney(theplayer) >= 4999 then takePlayerMoney(theplayer, 5000) outputChatBox("pooletkamshod") end end addEventHandler("onMarkerHit", marker1, skin159)
  21. hi why i got these errors for this code inside = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255) function createmymarker() local inhouse = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255) setElementPosition(theplayer,-1883.283203125, 865.4765625, 35.171875) setElementInterior(theplayer, 18) end addEventHandler("onMarkerHit",inhouse, createmymarker) errors: https://imgur.com/a/Efrr0To
×
×
  • Create New...