Jump to content

Ziemo

Members
  • Posts

    17
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Ziemo's Achievements

Square

Square (6/54)

3

Reputation

  1. It works, shows the info in debug, and outputs skin and money from database! Thanks you both guys.
  2. This new function doesn't work, but when I delete: iprint( "qh " .. qh ..", result: ".. result ) from the older code, error doesn't show up EDIT: never mind it showed, I just missed it
  3. It works, It outputted valid values, but I see an error: attempt to concatenate local 'result' (a table value)
  4. @DNL291 I have set player's name in mta to the same as in database
  5. Hi, I've started writing scripts connected to the database, and I struggle why the current script that I am working on doesn't work. Info: - Name of the table: accounts - Columns: username, skin, money - No errors Here is my script: function showStats(player) local playerName = getPlayerName(player) local qh = dbQuery(db, "SELECT skin, money FROM accounts WHERE username=?", playerName) local result = dbPoll(qh, -1) if result then for _, row in ipairs(result) do outputChatBox("Skin: " ..row["skin"].. "Money: "..row["money"] .. "") end end end addCommandHandler("stats", showStats)
  6. It's working, thank you both so much!
  7. I changed my code to this: SERVER: local characterName = 'John Doe' triggerClientEvent('showCharacters', root, characterName) CLIENT: function showCharacters(characterName) outputChatBox(characterName, localPlayer) end addEvent('showCharacters', true) addEventHandler('onResourceStart', localPlayer, showCharacters) But it isn't working. I have an error: Server triggered clientside event showCharacters, but event is not added clientside.
  8. I think it will work, but I want to make the opposite thing, pass a variable from server to client.
  9. so this variable in client script should look like this? characterName = triggerServerEvent('getCharacterName', localPlayer, characterName)
  10. so client variable should look like this? characterName = triggerServerEvent('getCharacterName', localPlayer, characterName)
  11. So how can i make a function that calls server-side variable?
  12. But it won't open up the whole gui. I want to open this gui after successful client login.
  13. Hi, I have a little problem with my script. I wanted to use server variable in client-side script, so I used trigger server and client event, but unfortunately, it didn't work. Do you know why? PS: This script has to display variable characterName in grid row. SERVER SIDE SCRIPT: function getCharacterName(characterName) local characterName = 'James' triggerClientEvent ( thePlayer, 'getCharName', thePlayer, characterName ) end addEvent('getCharacterName', true) addEventHandler('getCharacterName', root, getCharacterName) CLIENT-SIDE SCRIPT: function openCharacterMenu(characterName) menu = guiCreateWindow(0.5, 0.5, 0.2, 0.25, 'Characters', true) charactersList = guiCreateGridList(0.5, 0.5, 0.4, 0.6, true, menu) charactersColumn = guiGridListAddColumn(charactersList, 'Characters', 0.6) charactersRow = guiGridListAddRow(charactersList, 'No characters found') guiGridListSetItemText(charactersList, charactersColumn, charactersRow, characterName, false, false) end addEvent('getCharName', true) addEventHandler('login.success', localPlayer, openCharacterMenu) I see one error in client debug: Bad argument @ 'gu'iGridListSetItemText [expected string at argument 4 got, nil] Event 'login.success' opens up characters gui
  14. Hello everyone, i wanted to make custom texures (vinyls) for vehs on my mta server. I wanted it to look like this: The main function of this script should be putting textures on every part of my car. I don't want to replace txd, because I want to replace only one car at once. The main problem is, I have no idea how to make this kind of script. Does anyone in here knows how to write this kind of script? PS: I want to make this as simple as possible.
  15. Hello, I wanned to add vehicle variant, but I have no idea how to do this. I already read MTA wiki, but it still doesn't work.
×
×
  • Create New...