Jump to content

Phoenix-Roleplay

Members
  • Posts

    92
  • Joined

  • Last visited

Everything posted by Phoenix-Roleplay

  1. I know, its all local right now just trying to get as familiar as I can with MySQL and GUI's
  2. *facepalm* this is the second time this has happened to me, it's accpassword. Gonna fix it and I'll let you know if it works. EDIT: Any password logs you in. function loginHandler(username,password) local row = mysql_query(handler, "SELECT * FROM accounts WHERE accname='" .. username .. "' AND accpassword='" .. password .. "'") if row then outputChatBox("You have successfully logged in!", client, 0, 255, 0) mysql_free_result(row) return true else outputChatBox("Your username and/or password is incorrect!", client, 255, 0, 0) triggerClientEvent(client, "displayLogin", getRootElement()) return false end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler) EDIT 2: Switching back to this function loginHandler(username,password) local row = mysql_query(handler, "SELECT * FROM accounts WHERE accname='" .. username .. "' AND accpassword='" .. password .. "'") if( mysql_num_rows( row ) == 1 ) then outputChatBox("You have successfully logged in!", client, 0, 255, 0) return true else outputChatBox("Your username and/or password is incorrect!", client, 255, 0, 0) triggerClientEvent(client, "displayLogin", getRootElement()) return false end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler) Works perfectly. Thanks so much.
  3. No matter what I put it says "username or password is incorrect"
  4. One error: pf\s_main.lua:13: bad argument #1 to `mysql_num_rows` (msqlResult expected, got nil)
  5. Um.. I'm not sure what you want me to do with that snippet. EDIT: Nevermind, I got it but now it shows "Incorrect Password Supplied" Code: function loginHandler(username,password,thePlayer) local row = mysql_query( handler, "SELECT * FROM `accounts` WHERE accname = '"..username.."' " ); if( mysql_num_rows( row ) == 1 ) then if (row['password'] == password) then outputChatBox("You have successfully logged in!", client, 0, 255, 0) return end else outputChatBox("Unable to find username", client, 255, 0, 0) end outputDebugString("Incorrect Pasword Supplied") triggerClientEvent(client, "displayLogin", getRootElement()) end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler)
  6. ERROR: pf\s_main.lua:22: attempt to index field `?` (a nil value) Line 22: if(row[1]['accname'] ~= username) then
  7. Well thanks Samer, but I have to agree when it was xUltimate I was not that great of a scripter, I might say I have learned a lot over the past few days and have grown accustom to LUA quite nicely.
  8. Your slightly late, already revised it and it works both ways. Also, you forgot a tag there buddy! function createVehicleCommand ( thePlayer, commandName, carName ) local currVehicle = getPedOccupiedVehicle(thePlayer) if currVehicle then outputChatBox("You already are in a vehicle! Use /cv to change your vehicle!", thePlayer, 255, 0, 0) return end if commandName == "v" then if not carName then outputChatBox("Syntax: /" .. commandName .. " [vehicle id/model]", thePlayer, 255, 0, 0) return end local x, y, z = getElementPosition ( thePlayer ) local carModel = tonumber ( carName ) if (type(carModel) == "number") then if (carModel < 400 or carModel > 611) then outputChatBox("Invalid vehicle ID!", thePlayer, 255, 0, 0) return else createVehicle(carModel, x+5, y, z+2) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (Model: " .. carModel .. ") (ID: " .. vehicles.id .. ") was spawned!", thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end else local carModel = getVehicleModelFromName(carName) if carName == "random" then carModel = math.random(400,611) createVehicle(carModel, x+5, y, z+2) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (Model: " .. carModel .. ") (ID: " .. vehicles.id .. ") was spawned!", thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end if (not carModel) then outputChatBox("Invalid vehicle name!", thePlayer, 255, 0, 0) return else createVehicle(carModel, x+5, y, z+2) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (Model: " .. carModel .. ") (ID: " .. vehicles.id .. ") was spawned!", thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end end elseif commandName == "vx" then if not carName then outputChatBox("Syntax: /" .. commandName .. " [vehicle id/model]", thePlayer, 255, 0, 0) return end local x, y, z = getElementPosition ( thePlayer ) local carModel = tonumber ( carName ) local theVeh if (type(carModel) == "number") then if (carModel < 400 or carModel > 611) then outputChatBox("Invalid vehicle ID!", thePlayer, 255, 0, 0) return else theVeh = createVehicle(carModel, x, y, z+2) warpPedIntoVehicle(thePlayer, theVeh) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (Model: " .. carModel .. ") (ID: " .. vehicles.id .. ") was spawned!", thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end else local carModel = getVehicleModelFromName(carName) if carName == "random" then carModel = math.random(400,611) theVeh = createVehicle(carModel, x, y, z+2) warpPedIntoVehicle(thePlayer, theVeh) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (Model: " .. carModel .. ") (ID: " .. vehicles.id .. ") was spawned!", thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end if (not carModel) then outputChatBox("Invalid vehicle name!", thePlayer, 255, 0, 0) return else theVeh = createVehicle(carModel, x, y, z+2) warpPedIntoVehicle(thePlayer, theVeh) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (Model: " .. carModel .. ") (ID: " .. vehicles.id .. ") was spawned!", thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end end end end addCommandHandler("v", createVehicleCommand) addCommandHandler("vx", createVehicleCommand)
  9. I am Noob, YES! .I really don't want to be a pro in gaming world, games should be played for fun for couple of hours.You should stop crying here, Well I wouldn't call you a noob as I know nothing about you, but it all depends on your views and thoughts of a `pro` gaming world.
  10. Registration works perfect now! Only issue is login does not show any errors in the console only thing it says is "Unable to find username" function loginHandler(username,password) local row = mysql_query(handler, "SELECT * FROM accounts WHERE accname='"..username.."'") if (username ~= row) then outputDebugString("Unable to find username. " .. mysql_error(handler)) triggerClientEvent(client, "displayLogin", getRootElement()) outputChatBox("Unable to login.") return end if (password ~= row.password) then outputDebugString("Incorrect Pasword Supplied") triggerClientEvent(client, "displayLogin", getRootElement()) return end outputChatBox("You have successfully logged in!", client, 0, 255, 0) end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler)
  11. Alright, I'll accept that. In the past yes I did know nearly nothing about scripting, but I am here to take another chance upon the MTA community. I have recently purchased the LUA Second Edition, have been reading the wiki numerous times and I have been going in full-development with my new server, I am truly staying dedicated. @Daniel, no need to interfere sexy!
  12. Thank you so much for the support Daniel, xUltimate recognizes you and we understand you have always been a `platinum` member with us!
  13. If you give me a bit, yes, I did not do this recently, this was from experience the other day. EDIT: Only photo I had handy.. But as you can see it seems to lower the quality, this is at 128x128 (Stock size)
  14. Tried all of this, still fails to display properly.. Using: Adobe Photoshops CS6 processing a PNG non-interlaced Dimensions of file: 64x64 Dimensions set in-game: 64x64 Still displays pix-elated
  15. First time using GUI's or working with MySQL and upon using it I get the following error from server/MySQL INFO: Registration failed. Unknown column `Phoenix` in `field list` Where `Phoenix` is the username Code: function registrationHandler(username,password) local row = mysql_query(handler, "SELECT * FROM accounts WHERE username=`"..username.."`") if row then outputDebugString("Username already exists") triggerClientEvent(client, "displayLogin", getRootElement()) return end local result = mysql_query(handler, "INSERT INTO accounts (`accname`, `accpassword`) VALUES (`"..username.."`, `"..password.."`)") if not result then outputDebugString("Registration failed. "..mysql_error(handler)) triggerClientEvent(client, "displayLogin", getRootElement()) return end triggerClientEvent(client, "displayLogin", getRootElement()) outputChatBox("Registration successful!", client, 0, 255, 0) end addEvent("submitRegister",true) addEventHandler("submitRegister",root,registrationHandler)
  16. I use PNG, it may be the game engine not sure. Would like to see a little bit of clarification on how the whole system works. But for now I honestly think images can be obstructive and in the way
  17. Not unless you decided to have a RP server that was as close to real life as possible and wanted to have a actual calculator as a item, or if you wanted to make calculations in game, which is pointless.
  18. Now fix it! all joking aside, I'm trying to fix it myself EDIT: Revised it a little bit and I fixed it! For anyone wanting to use it: function createVehicleCommand ( thePlayer, commandName, carName ) if not carName then outputChatBox("Syntax: /v [vehicle id/model]", thePlayer, 255, 0, 0) return end local x, y, z = getElementPosition ( thePlayer ) local carModel = tonumber ( carName ) if (type(carModel) == "number") then if (carModel < 400 or carModel > 611) then outputChatBox("Invalid vehicle ID!", thePlayer, 255, 0, 0) return else createVehicle(carModel, x + 5, y, z) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (#" .. carModel .. ") was spawned with an ID of " .. vehicles.id, thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end else local carModel = getVehicleModelFromName(carName) if (not carModel) then outputChatBox("Invalid vehicle name!", thePlayer, 255, 0, 0) return else createVehicle(carModel, x + 5, y, z) outputChatBox("Your " .. getVehicleNameFromModel(carModel) .. " (#" .. carModel .. ") was spawned with and ID of " .. vehicles.id, thePlayer, 0, 255, 0) vehicles.id = (vehicles.id + 1) return end end end addCommandHandler ( "v", createVehicleCommand )
  19. Ok! Yours seems to spawn the vehicle and display the message, but fails to display any messages if you enter a incorrect vehicle id, but will display it if you input a invalid name strange..
  20. All the same issues, it seems the only one that would work was Cadus but it didn't show the successful spawn message.
×
×
  • Create New...