Jump to content

Spakye

Members
  • Posts

    108
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Spakye

  1. Hello, I didnt use Slothbot in a long time but i believe "waiting" state wont make him peacefull, it will make him wait until he sees someone, if the player isnt in his team then the bot will chase and shoot, if the player is in his team then he will follow him. So in your script the Bot will always shoot you as soon as he sees you ( assuming im right about the waiting state and if you are not in the same team). Maybe try to use setBotAttackEnabled to false when you spawn it.
  2. Hello, did you try to set the velocity of the projectile when creating it ? you can do it in optional arguments of createProjectile()
  3. ok to store it but then what would you do ? Something like keep the nickname simple (in my case spakye), then modify the scoreboard for it to add the clantag before the nickname and do the same thing when people send a message in the chat ? Is it what you had in mind?
  4. This will change the whole nick to a specific color, i wish people to be able to fully customize the clan tag with few colors. I guess a solution is to edit the scoreboard for it to show clantag..nickname and also to modify the chat so when people writte a message it will show clantag..nickname.. ": "..themessage but maybe there is an easier solution. Right now the way it works is they pick a tag limitation such as [ ] or |, a color for this limitation, a tag wich can include color codes, and finally a color for the player name and blip. So it look like this if the limitation is one char long : tag with color codes .. limitation color .. limitation .. player color .. player name wich gives TM|Spakye and with 2 char limitation : limitation color .. limitation .. tag with color codes .. limitation color .. limitation .. player color .. player name wich gives [TM]Spakye I dont think im explaining it very well, my english isnt great.
  5. Hello, im working on a clan system wich let you choose a clan tag that includes color codes. When a player logs in it should change his name to add his clan tag. Though the function setPlayerName only allows 22 characters and color codes makes it longer. This is the string i want to have as my nickname : #344F25TM#0C1109|#23331BSpakye once you remove the color code it should be TM|Spakye with some colors. Is there a way to bypass this limit of 22 characters ?
  6. local class = { --class name, hp, armor, skin, { {weapon id, weapon ammo} } {"Juggernaut", 100, 100, 0,{ {30,200},{24,50}, {34,10} } }, }
  7. Hello, if i understand well you can use setElementRotation() and setTimer() Edit : if you wish a smooth movement you could use moveObject()
  8. Hello, you can store a var like canEnter = true then when the player leaves the gui you turn it to false and start a timer that will turn it to true after 3mins. setTimer(function() canEnter=true end, 180000,1)
  9. I believe you need to check the source manually. like if source == buttonAuth then your function Take a look at onDgsMouseClick event in the wiki edit: nevermind im wrong
  10. nvm problem solved!
  11. Hi guys, i have an issue with my own login panel, whenever i create a new account and then try to login the console says that the password is incorect. The weird thing is that i did this login panel like months ago and everything was working fine. i didnt touch it since and today i have this problem. I did few tests, using some outputchatbox and searching in the internal db. I know for sure that accounts are created and that i dont send an hashed password when registering or login in. I can log in perfectly fine with all the accounts that i made before today. I also have a "remember me" system wich hash and save your password on your pc so when you join the password editbox is already filled but i dont see why it would cause a problem as it was all working perfectly fine before today. btw im using the mta default account system, the sql query you might see is for an team system. Any ideas ? Server side : function decryptPassShowLogin(cryptedPassword) if cryptedPassword then uncryptedPassword = teaDecode( cryptedPassword , "theMist") end triggerClientEvent (source,"eventShowLoginWdw",getRootElement(), uncryptedPassword) end addEvent("eventDecryptPass",true) addEventHandler("eventDecryptPass",getRootElement(),decryptPassShowLogin) function loginPlayer(username,password, rememberme) if not (username == "") then if not (password == "") then local account = getAccount(username) if ( account == false ) then triggerClientEvent (source,"eventErrorLogin",getRootElement(),"This account doesn't exist") else if logIn (source, account, password) then local cryptedPassword = teaEncode ( password , "theMist") triggerClientEvent (source,"eventRememberHandler",getRootElement(), rememberme, username,cryptedPassword) triggerClientEvent (source,"eventCloseLoginWdw",getRootElement()) else triggerClientEvent (source,"eventErrorLogin",getRootElement(),"Wrong password.") end end else triggerClientEvent (source,"eventErrorLogin",getRootElement(),"Please enter your password.") end end end function registerPlayer(username,password1,password2) if not (username == "") then if not (password1 == "") then if not (password2 == "") then if (password1 == password2) then local account = getAccount (username) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then executeSQLQuery("INSERT INTO members (user,team,role) VALUES (?,?,?)", username, "", "") triggerClientEvent(source,"eventSwitchTab",getRootElement()) else triggerClientEvent (source,"eventErrorRegister",getRootElement(),"An unknown error has occured! Please choose a different username/password and try again.") end else triggerClientEvent (source,"eventErrorRegister",getRootElement(),"An account with this username already exists!") end else triggerClientEvent (source,"eventErrorRegister",getRootElement(),"Passwords do not match!") end else triggerClientEvent (source,"eventErrorRegister",getRootElement(),"Please confirm your password!") end else triggerClientEvent (source,"eventErrorRegister",getRootElement(),"Please enter a password!") end end end addEvent("onRequestLogin",true) addEvent("onRequestRegister",true) addEventHandler("onRequestLogin",getRootElement(),loginPlayer) addEventHandler("onRequestRegister",getRootElement(),registerPlayer) function onPlayerChangeNick(oldNick, newNick, changedByUser) if changedByUser == true then cancelEvent() outputChatBox("You're not allowed to change your name that way.", source, 255, 0, 0) end end addEventHandler("onPlayerChangeNick", root, onPlayerChangeNick) Client side : function startLoginPanel() local username = getPlayerName(getLocalPlayer ( )) local xmlFile = xmlLoadFile("rememberme.xml") if not xmlFile then local xmlFile = xmlCreateFile("rememberme.xml","players") local player = xmlCreateChild( xmlFile, "player" ) xmlNodeSetAttribute(player,"username",username) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) triggerServerEvent("eventDecryptPass",getLocalPlayer(),cryptedPassword) else local players = xmlNodeGetChildren(xmlFile) local cryptedPassword = nil local rememberme = false for i,player in ipairs(players) do storedUsername=(xmlNodeGetAttribute(player, "username")) if ( storedUsername == username ) then rememberme = xmlNodeGetAttribute(player, "rememberme") if rememberme == "true" then cryptedPassword = xmlNodeGetAttribute(player, "password") end end end xmlUnloadFile(xmlFile) triggerServerEvent("eventDecryptPass",getLocalPlayer(),cryptedPassword) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startLoginPanel) function showLoginWdw(uncryptedPassword) intro = playSound("sounds/intro.mp3") setSoundVolume(intro, 0.3) local playerName = getPlayerName (localPlayer) loginWdw = guiCreateWindow ( 0.35, 0.3, 0.3, 0.4, "The Mist | Login ", true) tabMenu = guiCreateTabPanel ( 0.15, 0.1, 0.7, 0.8, true, loginWdw ) showCursor( true, true) loginTab = guiCreateTab ( "Login", tabMenu ) registerTab = guiCreateTab ( "Register", tabMenu) editLoginName = guiCreateEdit ( 0.25, 0.1, 0.5, 0.1, playerName, true, loginTab ) if not uncryptedPassword then rememberCheckBox = guiCreateCheckBox ( 0.35, 0.45, 0.5, 0.1, "Remember me ?", false, true, loginTab ) editLoginPassword = guiCreateEdit ( 0.25, 0.3, 0.5, 0.1, "Password", true, loginTab ) else rememberCheckBox = guiCreateCheckBox ( 0.35, 0.45, 0.5, 0.1, "Remember me ?", true, true, loginTab ) editLoginPassword = guiCreateEdit ( 0.25, 0.3, 0.5, 0.1, uncryptedPassword, true, loginTab ) guiEditSetMasked ( editLoginPassword, true ) end editRegisterName = guiCreateEdit ( 0.25, 0.1, 0.5, 0.1, playerName, true, registerTab ) editRegisterPassword = guiCreateEdit ( 0.25, 0.3, 0.5, 0.1, "Password", true, registerTab ) editRegisterConfirmPassword = guiCreateEdit ( 0.25, 0.5, 0.5, 0.1, "Confirm password", true, registerTab ) guiEditSetReadOnly ( editLoginName, true) guiEditSetReadOnly ( editRegisterName, true) addEventHandler("onClientGUIFocus", editLoginPassword,emptyEdit, false) addEventHandler ( "onClientGUIFocus", editRegisterPassword, emptyEdit, false ) addEventHandler ( "onClientGUIFocus", editRegisterConfirmPassword, emptyEdit, false ) local loginBtn = guiCreateButton ( 0.15, 0.7, 0.3, 0.2, "Login", true, loginTab ) local guestBtn = guiCreateButton ( 0.55, 0.7, 0.3, 0.2, "Play as Guest", true, loginTab ) local registerBtn = guiCreateButton ( 0.35, 0.7, 0.3, 0.2, "Register", true, registerTab ) labelLoginError= guiCreateLabel ( 0, 0.575, 1, 0.1, "", true, loginTab ) guiLabelSetColor (labelLoginError, 255, 0, 0 ) guiLabelSetVerticalAlign ( labelLoginError, "center") labelRegisterError = guiCreateLabel ( 0, 0.6, 1, 0.1, "", true, registerTab ) guiLabelSetColor (labelRegisterError, 255, 0, 0 ) guiLabelSetVerticalAlign ( labelRegisterError, "center") addEventHandler ( "onClientGUIClick", loginBtn, loginAttempt, false ) addEventHandler ( "onClientGUIClick", registerBtn, registerAttempt, false ) addEventHandler ( "onClientGUIClick", guestBtn, closeLoginWdw, false ) showChat ( false ) setPlayerHudComponentVisible("all", false) setTimer( function() fadeCamera (true) setCameraMatrix ( 1710, -647, 60 , 1700, -720, 70) end, 1000, 1) end addEvent("eventShowLoginWdw", true) addEventHandler("eventShowLoginWdw",getRootElement(),showLoginWdw) function loginAttempt() local username = guiGetText(editLoginName) local password = guiGetText(editLoginPassword) local rememberme = guiCheckBoxGetSelected(rememberCheckBox) triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password, rememberme) end function registerAttempt() local username = guiGetText(editRegisterName) local password1 = guiGetText(editRegisterPassword) local password2 = guiGetText(editRegisterConfirmPassword) triggerServerEvent("onRequestRegister", getLocalPlayer(),username,password1,password2) end function emptyEdit() if guiGetText(source) == "Password" or guiGetText(source) == "Confirm password" then guiSetText(source, "") guiEditSetMasked ( source, true ) end end function closeLoginWdw() stopSound ( intro) guiSetVisible ( loginWdw, false ) showCursor(false,false) showChat (true) setPlayerHudComponentVisible("all", true) local play = playSound("sounds/play.mp3") setSoundVolume(intro, 0.5) end addEvent("eventCloseLoginWdw", true) addEventHandler("eventCloseLoginWdw",getRootElement(),closeLoginWdw) function changeErrorLogin(errorMsg) guiSetText ( labelLoginError, errorMsg ) guiLabelSetHorizontalAlign(labelLoginError, "center") end addEvent("eventErrorLogin", true) addEventHandler("eventErrorLogin",getRootElement(),changeErrorLogin) function changeErrorRegister(errorMsg) guiSetText ( labelRegisterError, errorMsg ) guiLabelSetHorizontalAlign(labelRegisterError, "center") end addEvent("eventErrorRegister", true) addEventHandler("eventErrorRegister",getRootElement(),changeErrorRegister) function switchTab() guiSetSelectedTab (tabMenu,loginTab) end addEvent("eventSwitchTab", true) addEventHandler("eventSwitchTab",getRootElement(),switchTab) function rememberHandler(rememberme, username,cryptedPassword) local xmlFile = xmlLoadFile("rememberme.xml") local players = xmlNodeGetChildren(xmlFile) local match = 0 for i,player in ipairs(players) do local usernameXml = xmlNodeGetAttribute ( player, "username") if usernameXml == username then match = 1 if(rememberme == true) then xmlNodeSetAttribute(player,"rememberme","true") xmlNodeSetAttribute(player,"password",cryptedPassword) else xmlNodeSetAttribute(player,"rememberme","false") xmlNodeSetAttribute(player,"password","") end end end if match == 0 then local player = xmlCreateChild( xmlFile, "player" ) if(rememberme == true) then xmlNodeSetAttribute(player,"username",username) xmlNodeSetAttribute(player,"rememberme","true") xmlNodeSetAttribute(player,"password",cryptedPassword) else xmlNodeSetAttribute(player,"rememberme","false") xmlNodeSetAttribute(player,"username",username) end end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end addEvent("eventRememberHandler", true) addEventHandler("eventRememberHandler",getRootElement(),rememberHandler)
  12. Hello, i dont think you need to use getElementType since the source of the event will always be the player that got dammaged. Also use getElementModel() instead of getPedSkin. any error ?
  13. I see one little mistake, in your errors messages you use vehicles_notes and in your screenshot of the db you use vehicle_notes
  14. Hello, you are using numbers on line 6 in the outputChatBox but you didnt assign any value to it. you should add this to the dchat function and i guess it should work. local numbers = tostring(math.random(1,100))
  15. then use toJson to store the skin table in the database
  16. hello, SELECT * FROM staff WHERE hasPermission = 'true'
  17. If you are using mta account system you dont need a data base just to store a skin, use setAccountData() to save the skin then when the player join use getAccountData() to get the skin and apply it to the player
  18. hello, if i understand well you just need to add spawnPlayerAfterLogin(client) after the if condition
  19. what error does it give ? edit : i notice i forgot ) at then end of the code, if you copy pasted my code then add ) at the end
  20. i dont understand why you need the findPlayer function you could do like that addCommandHandler("give", function(player, cmd, name, amount) local amount = tonumber(amount) if name and amount and amount > 0 and math.floor(amount) == amount then -- bugfix local target = getPlayerFromName (name) local money = getPlayerMoney(player) if target ~= false then if money >= amount then takePlayerMoney(player, amount) givePlayerMoney(target, amount) outputChatBox("You gave " .. getPlayerName(target) .. " $" .. amount .. ".", player, 0, 255, 0, false) outputChatBox(getPlayerName(player) .. " gave you $" .. amount .. ".", target, 0, 255, 0, false) else outputChatBox("You do not have enough money.", player, 255, 0, 0, false) end end end
  21. You can start working on showing a guiwindow using triggerClientEvent, add a grid and then add vehicles to the grid. triggerClientEvent guiCreateWindow guiCreateGridList guiGridListAddColumn guiGridListAddRow Then you can make it work with your lvl system if you have one
  22. Hello, there is few things to do. Try to do it step by step, first try to make a red marker at the location you want with : createMarker Then try to create an event attached to it with : onPlayerMarkerHit
  23. Spakye

    Disable guns

    did you place it client side ?
×
×
  • Create New...