EmaTheLegend Posted July 28, 2010 Share Posted July 28, 2010 function avvertilogin(thePlayer) outputChatBox("** Login or register for ranking system and save money", getRootElement(), 100, 255, 0) end addEventHandler("onPlayerJoin",thePlayer,avvertilogin) function registrazionedb(thePlayer) local account = getAccountName(getPlayerAccount(thePlayer)) if(account) then executeSQLSelect("Giocatori", "Giocatore", "Giocatore = '" ..account.. "'") if (type(result) == "table" and #result == 0) or not result then outputChatBox("** One moment while your account is registered in Database ", getRootElement(), 100, 255, 0) executeSQLInsert("Giocatori","'"..account.."',0,0,0") outputChatBox("** Ok, Account succesfuly registered ! ", getRootElement(), 100, 255, 0) end outputChatBox("** Ok, Account succesfuly loaded from Database ! ", getRootElement(), 100, 255, 0) local datiaccount = executeSQLSelect("Giocatori", "Soldi, Kill, Morti", "Giocatore = '" ..account.. "'") setPlayerMoney(thePlayer,datiaccount[1]['Soldi']) textCreateTextItem("Kill :", 0.8, 0.35, "medium", 255, 255, 0) textCreateTextItem("Death :", 0.8, 0.4, "medium", 255, 255, 0) textCreateTextItem("Ratio :", 0.8, 0.4, "medium", 255, 255, 0) end end addEventHandler("onPlayerLogin",thePlayer,registrazionedb) When i start the resource mta server give me 2 warning : Bad Argument @ 'AddEventHandler' string defined function Bad Argument @ 'AddEventHandler' string defined function Link to comment
Xierra Posted July 28, 2010 Share Posted July 28, 2010 On your script, which one is client, which one is server? If it's client, don't give "theplayer", or any kind like that on every part of the script. the addEventHandler is having a wrong argument on the second argument. So the correct addEventHandler should be: addEventHandler("onPlayerJoin", getRootElement(), avvertilogin) It's easy, change "theplayer" in addEventHandler to "getRootElement()". Here's the example: (Also fixed the typos in your writing) function registrazionedb(thePlayer) local account = getAccountName(getPlayerAccount(thePlayer)) if(account) then executeSQLSelect("Giocatori", "Giocatore", "Giocatore = '" ..account.. "'") if (type(result) == "table" and #result == 0) or not result then outputChatBox("** Please wait while your account is being registered in the database... ", getRootElement(), 100, 255, 0) -- Proper english output fix by me! executeSQLInsert("Giocatori","'"..account.."',0,0,0") outputChatBox("**Account succesfuly registered! ", getRootElement(), 100, 255, 0) --Proper english output fix again by me! end outputChatBox("** Account sucessfully loaded! ", getRootElement(), 100, 255, 0) --Proper english output fix again by me! local datiaccount = executeSQLSelect("Giocatori", "Soldi, Kill, Morti", "Giocatore = '" ..account.. "'") setPlayerMoney(thePlayer,datiaccount[1]['Soldi']) textCreateTextItem("Kill :", 0.8, 0.35, "medium", 255, 255, 0) textCreateTextItem("Death :", 0.8, 0.4, "medium", 255, 255, 0) textCreateTextItem("Ratio :", 0.8, 0.4, "medium", 255, 255, 0) end end addEventHandler("onPlayerLogin",getRootElement(),registrazionedb) -- Changed "theplayer" to "getRootElement()" in this line. PS: You must be -RoCk-Emalegend, right? You must be doing this for the -RoCk- clan server. I can help you fix some problems. Link to comment
EmaTheLegend Posted July 28, 2010 Author Share Posted July 28, 2010 yes xx3 : i'm -RoCk-EmaLegend. This script is for rock server. If you want help me i'm really happy :_ my skype is emanuele.curati.1993 Link to comment
EmaTheLegend Posted July 28, 2010 Author Share Posted July 28, 2010 there's a error here : local datiaccount = executeSQLSelect("Giocatori", "Soldi, Kill, Morti", "Giocatore = '" ..account.. "'") setPlayerMoney(thePlayer,datiaccount[1]['Soldi']) this fuction must set player money retrived from database Link to comment
EmaTheLegend Posted July 29, 2010 Author Share Posted July 29, 2010 I tryed also this but don't work : local datiaccount = executeSQLSelect("Giocatori", "Soldi", "Giocatore = '" ..account.. "'") setPlayerMoney(thePlayer,datiaccount[1][1]) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now