Jump to content

ViRuZGamiing

Members
  • Posts

    1,050
  • Joined

  • Last visited

Everything posted by ViRuZGamiing

  1. can't seem to be able to edit my post on the "new" forum design 50% of the time appearantly
  2. Hi guys, I'm trying to make a execute query function, this is what I got. But I seem to be doing something wrong. Server sided addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() connection = dbConnect(dbInfo["databaseType"], "dbname="..dbInfo["dbname"]..";host="..dbInfo["host"], dbInfo["username"], dbInfo[password]) if connection then outputDebugString("Connection with database was successfully established.") else outputDebugString("Connection with database couldn't be established.") end end) function execQuery (queryString) local query = dbQuery(connection, tostring(queryString)) if (string.find(queryString, "SELECT")) then local result = dbPoll(query, -1 ) if not result == nil then return result end end dbFree(query) end This I have server sided in another file for testing my db addEventHandler ("onPlayerJoin", getRootElement(), function () local query = execQuery("SELECT username FROM users WHERE username = '"..getPlayerName(source) .."'") if (query) then outputChatBox("found username: "..tostring(query[0])) else outputChatBox("didn't found username, inserting!") execQuery("INSERT INTO users VALUES('', '"..getPlayerName(source).."')") end end ) Also I'm not quite sure how to get the value since I'm returning a table atm. Kind regards P.S. my database looks like this
  3. Hi guys I was looking into: call and I was wondering, for example; you have the function outputChatBox("") which works both client and server side with the same name. Will I be able to do the same with exports. Example; Client function drawDxStuff () --dx stuff end addEvent("drawDxStuff", true) addEventHandler("drawDxStuff", getRootElement(), drawDxStuff) Server function drawDxStuff() triggerClientEvent(source, "drawDxStuff", source) --source would probably be the player calling the function end Meta <export function="drawDxStuff" type="server"/> <export function="drawDxStuff" type="client"/> Would this work or will this give an error cause they have the same name or for other reasons? Kind Regards
  4. ViRuZGamiing

    Question

    You shouldn't add it in the meta with playSound when using an URL (Sound specified by filepath has to be predefined in the meta.xml file with <file /> tag.)
  5. ViRuZGamiing

    Question

    playSound soundPath: the filepath or URL of the sound file you want to play.
  6. isPlayerInACL Needs the function as well function isPlayerInACL ( player, acl ) local account = getPlayerAccount ( player ) if ( isGuestAccount ( account ) ) then return false end return isObjectInACLGroup ( "user."..getAccountName ( account ), aclGetGroup ( acl ) ) end which is server sided and the code you have is, I guess, client sided so you need a trigger. @CodyL I suppose client sided because of the file name
  7. So I tested my code (changed to work with account name now) and it does work, but I hope it's ment to be a door in the air. Else check your coordinates.
  8. That won't work, I can see an error without trying "attempting to compare player data with string" getPlayerAccount Returns the player's account object, or false if the player passed to the function is invalid.
  9. Then you'll need to use getAccountName(hitElement) instead What does the debug/console say?
  10. promax isn't a defined variable also you're trying to get the account not the name. I think you're looking for this; door = createObject (3089, 2004.5 , -1280 , 36.9 , 0, 0, 0) marker = createMarker ( 2005.5 , -1280 , 35.9 , 'cylinder', 1, 0, 0, 0, 255) -- after creating function moveGate(hitElement, time, targetX, targetY, targetZ, moveRX, moveRY, moveRZ) if (getElementType(hitElement) == "player") then if (getPlayerName(hitElement) == "promax" then moveObject ( door, time, targetX, targetY , targetZ, moveRX, moveRY, moveRZ) else return end else return end end addEventHandler ( 'onMarkerHit', marker, function(hitElement) moveGate(hitElement, 2000, 2004.5 , -1280 , 30.9, 0, 0, 0) end) addEventHandler ( 'onMarkerLeave', marker, function(hitElement) moveGate(hitElement ,2000, 2004.5 , -1280 , 36.9, 0, 0, 0) end) I changed the use of 2 function which do the same and made them use parameters, first you check if the hitelement is a player then you check if the name is equal to the string. i've also cleaned up the long coordinates btw xxx.9000000000xx doesn't matter, just make it xxx.9 (Not tested, just written) Kind regards
  11. Didn't knew created elements inside a col did trigger the enter event, in that case indeed
  12. You didn't change the windowWidth, windowHeight = 321, 338 to work on different resolutions, for every resolution you use these values in width and height. What you need to do is, (value / yourscreenx) * hisscreenx what in your own case become (321 / 1366) * 1366 = 321 but for your friend it'll be (321 / 1366) * 1600 = 376
  13. You could use this as well getElementsWithinColShape
  14. addEventHandler("onClientPreRender", getRootElement(), dxGui); You are rendering it for root a.k.a everyone, rendering it only for the one who has to see it, being localPlayer since it's clientside
  15. You could just store the salt in a seperate column in the database the just take that add it to the password and hash it on login, right? You wouldn't need to re-generate the salt? also you wouldn't be able to play on different PC's since you'll then have a different serial as you said
  16. Yeah I heard of rainbow tables but very little, I know the MD5 on the salt doesn't need to, but I thought it might give a stronger result. My teacher on college told me that I'd best use characters above ASCII value 128 since they wouldn't appear in the rainbow table. So is my 0-9, A-F combination secure enough?
  17. So first you create the bars off-screen with a length equal to the max width of the screen (for example 1920px) so the position is -1920px "the blue line is a photoshop guide representing +/- 30% of the screen" 30% of 1920px is 576px so you generate a math.random(0, 576) or start higher somewhere higher than 0 to be sure it's minimum somewhere on the screen. That random number you add to the -1920px so you'll have, for example; math.random(50, 576) => returns 377 then you do -1920px + 377px = -1543px After setting all these bars a random position then just start doing there horizontal position (-1543px) plus 1 every frame. so -1543px + 1. After 1920 frames you stop the render since every possible bar would've hit the right by then. (Note: I'm not sure if putting something to the left off screen is -1920 but I think so, anyhow, I hope you get my idea)
  18. I think you're simply looking for removeEventHandler("onClientRender", root, renderDXCameraFading) and for the different sizes I'd just make them start on a random location of the leftside of the screen between 0 and 30% for example and then make the all move to the right and stopping when you went from 0 till 100% at least, that's how I'd do it
  19. Yeah cause then they'd just see it in there client files Is this a good way of doing it? First time working with salt. function generateSalt() local characters = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} local salt = "" for i=0,31 do salt = salt .. tostring(characters[math.random(0, 16)]) end return md5(salt) end addCommandHandler ( "sha", function ( thePlayer, command, input ) if (input) then local salt = generateSalt() local sha256hash = sha256(input .. salt) outputChatBox(sha256hash) end end )
  20. Thanks and indeed, I found an article saying exactly the same.
  21. Thanks and how would I decode SHA256, I wouldn't be able (when a player is already registered) to compare the SHA password in the SQL Database with the password written in the (for example:) GUI Login Panel encoded, since they wouldn't be the same, right?
  22. Hi guys! When working on a login panel I'll need to hash the password as I guess (since we wouldn't like our password te be plain string) My question tho, Can I choose my encryption type myself? I'm familiar with the MD5 Hash since that's what I'm taught on college. Should I use MD5 which I know or is there a better suggested one? Kind Regards
  23. fx files are scripts as well written in HLSL https://msdn.microsoft.com/en-us/library/windows/desktop/bb509561(v=vs.85).aspx
  24. Post in English or post the message in the right language board Regards
×
×
  • Create New...