Jump to content

Saml1er

Retired Staff
  • Posts

    1,058
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Saml1er

  1. If you're hitting the marker with a vehicle then. -- Client sided Marker = createMarker (1811.0029296875, 1076.5595703125, 6.734375, "cylinder", 2.0, 0, 255,255) function MyMarker(hitPlayer) if hitPlayer~=localPlayer then return end local vehicle = getPedOccupiedVehicle(hitPlayer) if vehicle and source==Marker then -- YOUR CODE end end end addEventHandler ("onClientMarkerHit", resourceRoot, MyMarker)
  2. if I can't even activate my paypal account, how'll I pay with USD?
  3. Do you really think I can't pay for a server? Paypal doesn't work for my country thats why I can't have a server.
  4. What exactly do you want to fix?
  5. Huh? Your code wrong not the wiki example. It doesn't work anymore. I tested it many times and I finally ended up with this code.
  6. Hey guys, since I wanted to know how to use fetchRemote so after looking hard into this example I finally found a way to make it work. So I decided to share it for those who wants to know how it works. [Yes, the example you've seen on wiki is bugged] -- server sided -- server side function myCallback( responseData, errno, player) if errno == 0 then for i,v in ipairs(getElementsByType("player")) do triggerClientEvent( v, "onGetPhoto", getRootElement(), responseData ) end end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function ( player ) fetchRemote ( "http://media.prleap.com/image/587/320/Apple_logo.png", myCallback, "", false, player ) myCallback( responseData, errno, player ) end) client sided --client sided function renderimage() dxDrawImage(0, 0, 403, 119, "logo.png") end addEvent("onGetPhoto", true) addEventHandler("onGetPhoto", getRootElement(), function(photodata) photodata = "logo.png" addEventHandler("onClientRender", root, renderimage) end ) -- meta.xml "Author" version="1.0" name="Script01" type="script"/> "1.3.0-9.04563" client="1.3.2" />
  7. I think he wanted to remove ped from Vehicle. here -- function leaveVehicle (thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) if vehicle and isElement(vehicle) and not isPlayerRaceDead(thePlayer) then outputChatBox(getPlayerName(thePlayer).." is out from vehicle ) removePedFromVehicle ( thePlayer ) end end addCommandHandler("eject", leaveVehicle)
  8. Here's the code which I made for someone. ---CLIENT SIDE showCursor(true) m_window = guiCreateWindow(0.63, 0.01, 0.37, 0.46, "Login panel", true) guiWindowSetMovable(m_window, false) guiWindowSetSizable(m_window, false) guiSetAlpha(m_window, 1.00) m_label1 = guiCreateLabel(5, 22, 283, 15, "If you dont have account yet, create it now!", false, m_window) guiSetFont(m_label1, "default-bold-small") guiLabelSetHorizontalAlign(m_label1, "center", false) guiLabelSetVerticalAlign(m_label1, "center") m_button1 = guiCreateButton(15, 103, 263, 22, "LOGIN", false, m_window) guiSetProperty(m_button1, "NormalTextColour", "FFAAAAAA") m_label2 = guiCreateLabel(17, 79, 83, 14, "Password", false, m_window) guiLabelSetVerticalAlign(m_label2, "center") m_label3 = guiCreateLabel(17, 55, 83, 14, "Login", false, m_window) guiLabelSetVerticalAlign(m_label3, "center") m_edit1 = guiCreateEdit(78, 56, 200, 20, "", false, m_window) m_edit2 = guiCreateEdit(78, 80, 200, 20, "", false, m_window) m_button2 = guiCreateButton(15, 226, 263, 22, "REGISTER", false, m_window) guiSetProperty(m_button2, "NormalTextColour", "FFAAAAAA") m_label4 = guiCreateLabel(17, 178, 83, 14, "Login", false, m_window) guiLabelSetVerticalAlign(label4, "center") label5 = guiCreateLabel(17, 202, 83, 14, "Password", false, m_window) guiLabelSetVerticalAlign(label5, "center") m_edit3 = guiCreateEdit(78, 178, 200, 20, "", false, m_window) m_edit4 = guiCreateEdit(78, 202, 200, 20, "", false, m_window) guiSetVisible(m_window, true) addEventHandler("onClientGUIClick", root, function (button, state) if button == "left" and state == "up" then if (source == m_button1) then local username = guiGetText(m_edit1) local password = guiGetText(m_edit2) if username and password and username ~= "" and password ~= "" then triggerServerEvent("onRequestLogin", localPlayer, username, password) guiSetVisible(m_window, false) end end end end) addEventHandler("onClientGUIClick", root, function (button, state) if button == "left" and state == "up" then if (source == m_button2) then local username = guiGetText(m_edit3) local password = guiGetText(m_edit4) if username and password and username ~= "" and password ~= "" then triggerServerEvent("onRequestRegister", localPlayer, username, password) guiSetVisible(m_window, true) end end end end) function createText() dxDrawLine(548, 44, 751, 44, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(501, 155, 792, 155, tocolor(32, 32, 32, 255), 4, true) end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender. end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) function hideLoginWindow() showCursor(false) removeEventHandler( "onClientRender", root, createText ) removeEventHandler("onClientGUIClick",m_button2,clientSubmitRegister) removeEventHandler("onClientGUIClick",m_button1,clientSubmitLogin) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) --SERVER SIDE function loginPlayer(username,password) if not (username == "") then if not (password == "") then local account = getAccount ( username, password ) if ( account ~= false ) then logIn (source, account, password) triggerClientEvent (source,"hideLoginWindow",getRootElement()) end end else outputChatBox ("#0000FF* #FFFFFFError! Please enter your password or username",source,255,255,255,true) end end addEvent("onRequestLogin", true) addEventHandler("onRequestLogin", getRootElement(), loginPlayer) -- Registration here function registerPlayer(username,password) if not (username == "") then if not (password == "") then local account = getAccount (username,password) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then outputChatBox ("#0000FF* #FFFFFFYou have sucessfuly registered! [username: #ABCDEF" .. username .. " #FF0000| #FFFFFFPassword: #ABCDEF" .. password .. "#FFFFFF]",source,255,255,255,true ) setTimer(outputChatBox,800,1,"#0000FF* #FFFFFFYou can now login with your new account.",source,255,255,255,true ) else outputChatBox ("#0000FF* #FFFFFFAn unknown error has occured! Please choose a different username/password and try again.",source,255,255,255,true ) end else outputChatBox ("#0000FF* #FFFFFFError! An account with this username already exists!",source,255,255,255,true ) end else outputChatBox ("#0000FF* #FFFFFFError! Please enter a password!",source,255,255,255,true) end else outputChatBox ("#0000FF* #FFFFFFError! Please enter a username you would like to register with!",source,255,255,255,true) end end addEvent("onRequestRegister", true) addEventHandler("onRequestRegister", getRootElement(), registerPlayer)
  9. You need php scripting knowledge for that.
  10. centerWindow ( yourWindow, 0, 50 ) you forgot to add " ) " Add some spaces in these codes because newbies won't even try to read the tutorial when they see these codes, honestly saying.
  11. Use this function before using playSound. setRadioChannel ( 0 )
  12. Saml1er

    Ayuda

    function createVcle( thePlayer, commandName ) local x,y,z = getElementPosition( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then objeto = createObject( 897, x, y - 7, z + 0.3, 0, 90, 90) setTimer ( destroyElement, 30000, 1, objeto ) end end addCommandHandler("dotoon",createVcle )
  13. You mean this? -- CLIENT SIDE Object1 = createObject ( 153.87090,-1772.38123,8 ) Marker = createMarker (1811.0029296875, 1076.5595703125, 6.734375, "cylinder", 2.0, 0, 255,255) function MyMarker(hitPlayer) if hitPlayer~=localPlayer then return end local vehicle = getPedOccupiedVehicle(hitPlayer) if vehicle and source==Marker then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)),aclGetGroup("Admin")) then moveObject (Object1,1200,148.69999694824,-1772.4000244141,-4) else moveObject (Object1,1200,148.69999694824,-1772.4000244141,2.7000000476837) end end end end addEventHandler ("onClientMarkerHit", resourceRoot, MyMarker) change the coordinates and the group name with whatever you want. Not tested but should work.
  14. Try this function createExplosionCommand (thePlayer, command) local x, y, z = getElementPosition ( thePlayer ) createExplosion ( x, y, z+2 ) end addCommandHandler("explosion", createExplosionCommand) thePlayer - the one who executes this command x,y,z - Coordinates
  15. Saml1er

    Scripter

    I've some scripting knowledge and I script everyday trying new things but I've never tried to create a gamemode but anyways if you really want one then I can create if you tell me what exactly do you need.
  16. Oh my pancreas, I should've think about this earlier and I like it if username and password and username ~= "" and password ~= "" then Thanks mate.
  17. When ever I add this line if button == "left" and state == "up" then then my gui window is hidden. I've no idea what's causing this. function loginwindow() showChat(false) showCursor(true) m_window = guiCreateWindow(0.63, 0.01, 0.37, 0.46, "Login panel", true) guiWindowSetMovable(m_window, false) guiWindowSetSizable(m_window, false) guiSetAlpha(m_window, 1.00) m_button1 = guiCreateButton(15, 103, 263, 22, "LOGIN", false, m_window) m_edit1 = guiCreateEdit(78, 178, 200, 20, "", false, m_window) m_edit2 = guiCreateEdit(78, 202, 200, 20, "", false, m_window) guiSetVisible(m_window, true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () loginwindow() end addEventHandler( "onClientGUIClick", root, function (button, state) if button == "left" and state == "down" then if ( source == m_button1 ) then local username = guiGetText(m_edit1) local password = guiGetText(m_edit2) if username and password then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password) guiSetVisible(m_window, true) end end )
  18. Thanks. I never used setAccountData so I had no idea how it works. Thank you so much mate.
  19. Hello, I want to learn more about getElementData and so on after spending 5 hours on wiki I made some code but it's not working the way I want it to work. I want it save the player's serial,account info whenever he leaves and joins ( for everyone ) and when I execute this command "/srl" and I want to get the serial and previous account, sadly I can't get the previous account + it's giving me the account details of player who logged in. function onPlayerQuit ( previous_Account, Current_Account ) local playerAccount = getAccountData (source) if (playerAccount) then local playerserial = getPlayerSerial ( source ) local playername = getPlayerName ( source ) local previous = getAccountName ( previous_Account ) local current = getAccountName ( Current_Account ) setAccountData ( playerAccount, "piraterpg.current", current ) setAccountData ( playerAccount, "piraterpg.previous", previous ) setAccountData ( playerAccount, "piraterpg.serial", playerserial ) end end function onPlayerLogin ( ) local playerAccount = getAccountData (source) if (playerAccount) then getAccountData ( playerAccount, "piraterpg.serial" ) getAccountData ( playerAccount, "piraterpg.current" ) getAccountData ( playerAccount, "piraterpg.previous" ) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) addCommandHandler ("srl", function ( ) local playerAccount = getAccountData(source) if ( playerAccount ) then local serialss = getAccountData ( playerAccount, "piraterpg.serial" ) local currents = getAccountData ( playerAccount, "piraterpg.current" ) local previous = getAccountData ( playerAccount, "piraterpg.previous" ) outputChatBox ( "* "..playeraccount.." found on serial: "..serialss..": "..currents..", "..previous, source, 255, 255, 0, true ) end end )
  20. Okay I got every thing done for my mta sa server via linux now I can't connect to my server nor I can see it in web tab and I entered every command from cd /opt to last command sudo service mtasa_server start it said that " service start/running 2653 processes " now what can be the problem ? P.S I did exactly said in this tutorial https://docs.google.com/document/d/1LbP ... edit?pli=1 EDIT: How do I host my server even if I turn off my computer? Because after the last step when I tried to join with another spare computer I could join and so on the server depends on my computer if it is on then the server will be and if it is off then the server will be off. how do I host it that's my question.
  21. Idk how but my friend told me that he can connect to port 21 FTP access so he and I decided to buy domain for our website and host our server with this method. https://forum.multitheftauto.com/viewtopic.php?f=148&t=38344 Anyways so problem is solved now since my friend is able to connect to port 21.
  22. No actually here the problem is different, we belong to the same country (Pakistan) and our ISP is blocking our ports and is there any way that we can bypass our ISP ? This time I'll use filezilla or PuTTY because I found them easy but the problem is blocked ports. EDIT: I contacted my isp to unblock those damn ports but they say no it's not our job nor we are allowed to.
  23. If it's all about scripting then I have a scripter for my server, he'll do it for me.
  24. Mate, I'm a newbie to MysQL, I don't have any idea where to put these codes, can you please tell me where can I put these codes ? anyways I want to host my server online. Well if I host my server on computer then when ever I turn off my computer then the server will shut down, right ?
×
×
  • Create New...