Jump to content

Michael#

Members
  • Posts

    168
  • Joined

  • Last visited

Everything posted by Michael#

  1. Michael#

    text

    That's a 3D text if I'm right, you can't do it server side, you must do it client side. https://wiki.multitheftauto.com/wiki/Ser ... _functions
  2. -- client side triggerServerEvent ( "submitRegister", getRootElement(), username, password, passwordConfirm ) -- send data -- server side function registerHandler(username,password,passwordConfirm) if ( password == passwordConfirm ) then -- if pw is equal to confirmation local connect = dbConnect("mysql", "dbname=mta_userdata;host=127.0.0.1","root","klaas","share=1") -- connect to db if ( connect ) then -- if connected sucessfully dbExec(connect,"INSERT INTO `user` VALUES ( ?, ?, ? )", tostring ( username ), tostring ( password ), tostring ( passwordConfirm ) ) -- insert data else return -- if not connected sucessfully, end function end else return -- if password is not the same of confirm, end function end end addEvent("submitRegister", true) addEventHandler("submitRegister",getRootElement(),registerHandler)
  3. And what is idUser, Name, Passwort, ... ?? Also, better start learning from something more easy. I gave you the correct code and you wrote a fucked up script.
  4. It works, I tested here.
  5. Because you don't save the file.
  6. If you tell me what's you're doing...
  7. You put ',' instead of '('
  8. ? = tostring ( text ) dbExec ( myConnection, "INSERT INTO `myTable` VALUES ( ? )", tostring ( text ) )
  9. Because getPlayerMoney don't return a right value, it don't pass statement. You should learn and check if it pass statement.
  10. getPlayerMoney don't have any parameters.
  11. No problem And I'm not the best
  12. Michael#

    text

    If you wanna put in top of the ped, you must create it client-side. if you wanna put it in the place where is the ped, use Server-side Text Functions.
  13. -- client myEdit = guiCreateEdit ( ... ) myButt = guiCreateButton ( ... ) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == myButt ) then triggerServerEvent ( 'updateDb', root, guiGetText ( myEdit ) ) end end ) -- server local myConnection = dbConnect ( "mysql", "dbname=example;host=localhost", "***", "***", "share=1" ) addEvent ( 'updateDb', true ) addEventHandler ( 'updateDb', root, function ( text ) local add = dbExec ( myConnection, "INSERT INTO `myTable` VALUES ( ? )", tostring ( text ) ) end ) ?
  14. client -- why is that here? win = guiCreateWindow(140,69,596,460,"save carr",false) save = guiCreateButton(474,417,113,34,"save",false,win) GetPositon = guiCreateButton(495,132,83,26,"GetPositon",false,win) x = guiCreateEdit(9,80,96,27,"",false,win) guiSetAlpha(x,0.5) z = guiCreateEdit(11,155,96,27,"",false,win) guiSetAlpha(z,0.5) y = guiCreateEdit(10,119,96,27,"",false,win) guiSetAlpha(y,0.5) function GetPositionzer(button,state) local thisPlayer = getLocalPlayer() -- why you need this? local xp, yp, zp = getElementPosition(thisPlayer) guiSetText ( x, xp ) guiSetText ( y, yp ) guiSetText ( z, zp ) end addEventHandler("onClientGUIClick", GetPositon, GetPositionzer, false) function saveer(button,state) -- local root = xmlLoadFile ("car.xml") -- why you commented this? p_x5 = guiGetText(x) -- why you make it global p_y5 = guiGetText(y) -- y p_z5 = guiGetText(z) -- z if carRoot then -- what? what is carRoot? -- Nothing here? Cool. else local carRoot = xmlCreateFile("car.xml","newcar") local newCar = xmlCreateChild (carRoot,"cars") xmlNodeSetAttribute (newCar,"x",p_x5) -- where is x subnode created? xmlNodeSetAttribute (newCar,"y",p_y5) -- where is y subnode created? xmlNodeSetAttribute (newCar,"z",p_z5) -- where is z subnode created? xmlSaveFile(carRoot) end end addEventHandler("onClientGUIClick", save, saveer, false) Read comments. -- Correct: win = guiCreateWindow(140,69,596,460,"save carr",false) save = guiCreateButton(474,417,113,34,"save",false,win) GetPositon = guiCreateButton(495,132,83,26,"GetPositon",false,win) x = guiCreateEdit(9,80,96,27,"",false,win) guiSetAlpha(x,0.5) z = guiCreateEdit(11,155,96,27,"",false,win) guiSetAlpha(z,0.5) y = guiCreateEdit(10,119,96,27,"",false,win) guiSetAlpha(y,0.5) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == GetPosition ) then -- if clicked element is GetPosition local nX, nY, nZ = getElementPosition ( localPlayer ) -- get player position guiSetText ( x, nX ) -- set text guiSetText ( y, nY ) -- set text guiSetText ( z, nZ ) -- set tet elseif ( source == save ) then -- else, if clicked element is save local x5, y5, z5 = guiGetText ( x ), guiGetText ( y ), guiGetText ( z ) -- get edit text local carRoot = xmlLoadFile ( 'car.xml' ) -- load file if ( carRoot ) then -- if file is loaded -- Something here, no? else carRoot = xmlCreateFile ( 'car.xml', 'newcar' ) -- create a file called car.xml local newCar = xmlCreateChild ( carRoot, 'cars' ) -- create a child cars inside newCar local nodeX, nodeY, nodeZ = xmlCreateChild ( newCar, 'x' ), xmlCreateChild ( newCar, 'y' ), xmlCreateChild ( newCar, 'z' ) -- create child x, y, z xmlNodeSetAttribute ( newCar, 'x', tonumber ( x5 ) ) -- set x value xmlnodeSetAttribute ( newCar, 'y', tonumber ( y5 ) ) -- set y value xmlNodeSetAttribute ( newCar, 'z', tonumber ( z5 ) ) -- set z value end end end ) If is there something wrong, please say.
  15. In MTA 1.0, maybe not work but in MTA 1.3 I'm sure it works.
  16. https://wiki.multitheftauto.com/wiki/engineLoadDFF https://wiki.multitheftauto.com/wiki/engineReplaceModel https://wiki.multitheftauto.com/wiki/engineLoadTXD https://wiki.multitheftauto.com/wiki/engineImportTXD Learn Why you asked this? Just use the functions lol -.-
  17. Your script is totally messed up. Learn: viewtopic.php?f=148&t=40809
  18. Use engineLoadDFF, engineReplaceModel, engineLoadTXD, engineImportTXD. To add new weapons, as far as I know, it's impossible.
×
×
  • Create New...