Jump to content

Vision

Members
  • Posts

    405
  • Joined

  • Last visited

Everything posted by Vision

  1. getPlayerAccount is server-side only
  2. You can use this: https://community.multitheftauto.com/index.php?p= ... ils&id=672
  3. Vision

    [Race] HELP!

    engineLoadTXD engineImportTXD engineLoadDFF engineReplaceModel
  4. Here: https://wiki.multitheftauto.com/wiki/Scr ... troduction
  5. https://community.multitheftauto.com/index.php?p= ... ils&id=538
  6. function globalOOC(thePlayer, commandName, ...) local logged = tonumber(getElementData(thePlayer, "loggedin")) if (logged==1) then if not (...) then outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) else local oocEnabled = exports.global:getOOCState() message = table.concat({...}, " ") local muted = getElementData(thePlayer, "muted") if (oocEnabled==0) and not (exports.global:isPlayerAdmin(thePlayer)) then outputChatBox("OOC Chat is currently disabled.", thePlayer, 255, 0, 0) elseif (muted==1) then outputChatBox("You are currenty muted from the OOC Chat.", thePlayer, 255, 0, 0) else local players = exports.pool:getPoolElementsByType("player") local playerName = getPlayerName(thePlayer) local playerID = getElementData(thePlayer, "playerid") exports.logs:logMessage("[OOC: Global Chat] " .. playerName .. ": " .. message, 1) for k, arrayPlayer in ipairs(players) do local logged = tonumber(getElementData(arrayPlayer, "loggedin")) local targetOOCEnabled = getElementData(arrayPlayer, "globalooc") local adminlevel = exports.global:getPlayerAdminLevel(thePlayer) local gmlevel = exports.global:getPlayerGMLevel(thePlayer) title = exports.global:getPlayerAdminTitle(thePlayer) gmtitle = exports.global:getPlayerGMTitle(thePlayer) if adminlevel >= 4 then color = "#CC0000" else color = "#00ff00" end if gmlevel >= 4 then color1 = "#CC0000" else color1 = "#00ff00" end if adminlevel == 0 or getElementData(thePlayer,"hiddenadmin") == 1 then title = false end if exports.global:getPlayerDonatorLevel(thePlayer) > 0 and exports.global:getPlayerAdminLevel(thePlayer) == 0 and exports.global:getPlayerGMLevel(thePlayer) == 0 then color = "#CC9933" title = "Donator" end if (logged==1) and (targetOOCEnabled==1) then if title and color then outputChatBox("(( [GOOC] (" .. playerID .. ") ["..color.."" ..title.. "#ffe4c4] " .. playerName .. ": " .. message.." ))",arrayPlayer, 255,228,196,true) else outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message.." ))", arrayPlayer, 255,228,196,true) end elseif gmtitle and color1 then outputChatBox("(( [GOOC] (" .. playerID .. ") ["..color1.."" ..gmtitle.. "#ffe4c4] " .. playerName .. ": " .. message.." ))",arrayPlayer, 255,228,196,true) end end end end end end addCommandHandler("o", globalOOC, false, false) addCommandHandler("GlobalOOC", globalOOC)
  7. local gate = createObject ( 975, 1438.1025390625, -2879.2116699219, 2.5887410640717, 0, 0, 180) local marker = createMarker(1438.1025390625, -2865.44531, 2.5887410640717, "cylinder", 6, 255, 255, 255, 0) local marker2 = createMarker(1438.1025390625, -2886.79980, 2.5887410640717, "cylinder", 6, 255, 255, 255, 0) function moveGate(hitPlayer, matchingDimension) if hasObjectPermissionTo(hitPlayer, "function.kickPlayer") then moveObject ( gate, 2200, 1429.4974365234, -2879.0065917969, 2.5750021934509) setTimer(moveBack, 4000, 1) -- the gate will closes in 4 seconds end end addEventHandler("onMarkerHit", marker, moveGate) addEventHandler("onMarkerHit", marker2, moveGate) function moveBack() moveObject ( gate, 2450, 1438.1025390625, -2879.2116699219, 2.5887410640717) end s1 = createMarker( -1529, 490, 7, "cylinder", 13.5, 255, 255, 255, 0) s2 = createBlip( 1438.7745361328, -2938.0595703125, 2.8496370315552,62)
  8. If not work, we can help you
  9. You also can use marker functiions https://wiki.multitheftauto.com/wiki/CreateMarker https://wiki.multitheftauto.com/wiki/OnMarkerHit https://wiki.multitheftauto.com/wiki/OnMarkerLeave
  10. Try this setElementRotation(af,0,0,0)
  11. Your meta.xml is wrong, please read this: https://wiki.multitheftauto.com/wiki/Meta.xml
  12. Vision

    help

    I dont know but you create it with toggleControl
  13. https://wiki.multitheftauto.com/wiki/CreateMarker https://wiki.multitheftauto.com/wiki/SetElementPosition https://wiki.multitheftauto.com/wiki/OnMarkerHit
  14. Vision

    spawning player

    server function passwordHandler(player, oldpassword, newpassword) local account = getPlayerAccount(player) if (account) then if (isGuestAccount(account)) then outputChatBox("You must be logged in to change your password.", player) return end local playerName = getPlayerName(player) local password_check = getAccount(playerName, oldpassword) if (password_check ~= false) then if (string.len(newpassword) >= 5) then setAccountPassword(account, newpassword) triggerClientEvent(player, "hidePasswordWindow", getRootElement()) else outputChatBox("Your new password must be at least 5 characters long!", player) end else outputChatBox("Old password invalid.", player) end end end function loginHandler(player, username, password, thePlayer) local account = getAccount(username, password) if (account ~= false) then if (logIn(player, account, password) == true) then setTimer( spawnPlayer, 2000,1,player, 1574.5, -1246,279.5) fadeCamera ( player, false, 1.0, 0, 0, 0 ) setTimer ( fadeCamera, 5000, 1, player, true, 0.5 ) setElementFrozen(player, false) setTimer( setCameraTarget,3200,1,player) triggerClientEvent (player, "hideLoginWindow1", getRootElement()) else triggerClientEvent (player, "unknownError", getRootElement()) end else triggerClientEvent (player, "loginWrong", getRootElement()) end end function registerHandler(player, username, password) local account = getAccount(username, password) if (account ~= false) then triggerClientEvent(player, "registerTaken", getRootElement()) else account = addAccount(username, password) if (logIn(player, account, password) == true) then triggerClientEvent(player, "hideLoginWindow", getRootElement()) showPlayerHudComponent ( player, "radar", false ) setTimer ( fadeCamera, 50, 1, player,false, 1 ) setTimer ( fadeCamera, 3000, 1, player,true, 3 ) setTimer( spawnPlayer, 2250,1,player, 806.7,-1350,-0.4) setTimer(setCameraMatrix,1500,1,player, 808,-1351,-0.4,-1000,0,0,0,0) --setTimer(setElementPosition,2000,1,player, 806.7,-1350,-0.4) setTimer(setElementRotation,2251,1,player,0,0,220) else triggerClientEvent(player, "unknownError", getRootElement()) end end end function setCameraOnPlayerJoin() fadeCamera(source, true, 5) setTimer ( fadeCamera, 5000, 1, source, true, 0.5 ) setCameraMatrix(source, 1000.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) function hudChangerOnJoin () showPlayerHudComponent ( source, "radar", false ) showChat( source, false) end addEventHandler ( "onPlayerJoin", getRootElement(), hudChangerOnJoin ) function hudChangerOnLogin () showPlayerHudComponent ( source, "radar", true ) end addEventHandler ( "onPlayerLogin", getRootElement(), hudChangerOnLogin ) function logoutHandler()--We define a function name local accountname = getAccountName (getPlayerAccount(source))--we get an account if (isGuestAccount(getPlayerAccount(source)) == true) then cancelEvent()--then cancelEvent --triggerClientEvent("logOutOp", getRootElement())--output him to chatbox that logout is not allowed end end addEventHandler("onPlayerLogout",getRootElement(),logoutHandler)--we add a event handler which will handle the funciton function setCameraRegister(player, thePlayer) setTimer(setElementPosition,1000,1,source, 1574.5,-1246,279.5) setTimer( setCameraTarget,1200,1, source ) setTimer ( fadeCamera, 50, 1, source,false, 1 ) setTimer ( fadeCamera, 3000, 1, source,true, 3 ) setElementFrozen ( source, false ) showPlayerHudComponent ( source, "radar", true ) showChat(source, true) end addEventHandler("onPlayerQuit",root, function() local account = getPlayerAccount(source); if account and not isGuestAccount(account) then local x, y, z = getElementPosition(source); setAccountData(account, "xPosWhileQuit", x); setAccountData(account, "yPosWhileQuit", y); setAccountData(account, "zPosWhileQuit", z); end; end ) addEventHandler("onPlayerLogin",root, function(_, account) if account and not isGuestAccount(account) then local x = getAccountData(account, "xPosWhileQuit"); local y = getAccountData(account, "yPosWhileQuit"); local z = getAccountData(account, "zPosWhileQuit"); if x and y and z then setElementPosition(source,x,y,z); end; end; end ) addEvent("setCameraRegister", true) addEvent("submitChangepw", true) addEvent("submitLogin", true) addEvent("submitRegister", true) addEventHandler("submitChangepw", root, passwordHandler) addEventHandler("submitLogin", root, loginHandler) addEventHandler("submitRegister", root, registerHandler) addEventHandler("setCameraRegister", root, setCameraRegister) client local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) local sx,sy = guiGetScreenSize() wnd_window = {} local guiSkinShop = guiCreateWindow(0.37*sx,0.80*sy,0.3*sx,0.15*sy,"Choose a skin!",false) done = guiCreateButton(0.25,0.60,0.50,0.30,"Done",true,guiSkinShop) left = guiCreateButton(0.07,0.60,0.15,0.30,"<-",true,guiSkinShop) right = guiCreateButton(0.78,0.60,0.15,0.30,"->",true,guiSkinShop) guiWindowSetSizable(guiSkinShop,false) guiSetVisible(guiSkinShop, false) --label skinLabel = guiCreateLabel(0.05,0.30,0.90,0.17,"Skins can be bought once ingame",true,guiSkinShop) guiSetAlpha(skinLabel,1) guiLabelSetColor(skinLabel,255,255,255) guiCreateStaticImage( 0.0001, 0.49, 0.99, 0.02, "red.png", true, guiSkinShop ) guiCreateStaticImage( 0.0001, 0.25, 0.99, 0.02, "red.png", true, guiSkinShop ) guiLabelSetHorizontalAlign(skinLabel,"center",false) guiSetFont(skinLabel,"default-bold-small") function createLoginWindow(title, logo, content) local xml = xmlLoadFile( "server.xml" ) local content = xmlNodeGetValue( xml ) windowLogin = guiCreateWindow(0.02*sx,0.05*sy,0.8*sx,0.8*sy,"LOG-IN",false) guiSetSize(windowLogin, 270, 400, false) guiWindowSetSizable(windowLogin,false) guiCreateMemo(01,170,500,220,content,false,windowLogin) guiSetAlpha(windowLogin,1) labelUsername = guiCreateLabel(10,52,59,24,"Username:",false,windowLogin) guiSetAlpha(labelUsername,1) guiLabelSetColor(labelUsername,255,255,255) guiLabelSetVerticalAlign(labelUsername,"center") guiLabelSetHorizontalAlign(labelUsername,"left",false) labelPassword = guiCreateLabel(10,86,59,24,"Password:",false,windowLogin) guiSetAlpha(labelPassword,1) guiLabelSetColor(labelPassword,255,255,255) guiLabelSetVerticalAlign(labelPassword,"center") guiLabelSetHorizontalAlign(labelPassword,"left",false) labelInfo = guiCreateLabel(10,26,250,17,"Please login or register.",false,windowLogin) guiSetAlpha(labelInfo,1) guiLabelSetColor(labelInfo,255,255,255) guiLabelSetVerticalAlign(labelInfo,"top") guiLabelSetHorizontalAlign(labelInfo,"center",false) guiSetFont(labelInfo,"default-bold-small") editUsername = guiCreateEdit(79,52,181,25,"",false,windowLogin) guiSetAlpha(editUsername,1) guiEditSetMaxLength(editUsername, 50) editPassword = guiCreateEdit(79,86,181,25,"",false,windowLogin) guiSetAlpha(editPassword,1) guiEditSetMasked(editPassword, true) guiEditSetMaxLength(editPassword, 50) buttonLogin = guiCreateButton(10,121,117,21,"Log in",false,windowLogin) guiSetAlpha(buttonLogin,1) buttonRegister = guiCreateButton(149,121,117,21,"Register",false,windowLogin) guiSetAlpha(buttonRegister,1) newsLabel = guiCreateLabel(0.35,0.372,0.300,0.17,"Server News",true,windowLogin) guiSetAlpha(newsLabel,1) guiLabelSetColor(newsLabel,255,255,255) guiCreateStaticImage( 0.0001, 0.11, 0.99, 0.006, "red.png", true, windowLogin ) guiCreateStaticImage( 0.0001, 0.06, 0.99, 0.006, "red.png", true, windowLogin ) guiLabelSetHorizontalAlign(newsLabel,"center",false) guiSetFont(newsLabel,"default-bold-small") guiSetVisible(windowLogin, false) showChat(false) addEventHandler("onClientGUIClick", buttonLogin, clientSubmitLogin, false) addEventHandler("onClientGUIClick", buttonRegister, showReg, false) end regMenu = guiCreateWindow(0.357*sx,0.05*sy,0.33*sx,0.3*sy,"Register Menu",false) guiCreateStaticImage( 0.0001, 0.13, 0.99, 0.010, "red.png", true, regMenu ) guiCreateStaticImage( 0.0001, 0.25, 0.99, 0.010, "red.png", true, regMenu ) guiWindowSetSizable(regMenu,false) guiSetAlpha(regMenu,1) regUsername = guiCreateLabel(10,52,59,24,"Username:",false,regMenu) guiSetAlpha(regUsername,1) guiLabelSetColor(regUsername,255,255,255) guiLabelSetVerticalAlign(regUsername,"center") guiLabelSetHorizontalAlign(regUsername,"left",false) editRegUsername = guiCreateEdit(70,52,181,25,"",false,regMenu) guiSetAlpha(editRegUsername,1) guiEditSetMaxLength(editRegUsername, 50) regPassword = guiCreateLabel(10,86,59,24,"Password:",false,regMenu) guiSetAlpha(regPassword,1) guiLabelSetColor(regPassword,255,255,255) guiLabelSetVerticalAlign(regPassword,"center") guiLabelSetHorizontalAlign(regPassword,"left",false) --editRegPassword = guiCreateEdit(79,86,181,25,"",false,regMenu) editRegPassword = guiCreateEdit(70,86,181,25,"",false,regMenu) guiSetAlpha(editRegPassword,1) guiEditSetMasked(editRegPassword, true) guiEditSetMaxLength(editRegPassword, 50) regComPassword = guiCreateLabel(10,122,59,24,"*Email:",false,regMenu) guiSetAlpha(regComPassword,1) guiLabelSetColor(regComPassword,255,255,255) guiLabelSetVerticalAlign(regComPassword,"center") guiLabelSetHorizontalAlign(regComPassword,"left",false) editEmail = guiCreateEdit(70,120,181,25,"",false,regMenu) --editEmail = guiCreateEdit(60,120,190,25,"",false,regMenu) guiSetAlpha(editEmail,1) guiEditSetMasked(editEmail, true) guiEditSetMaxLength(editEmail, 50) buttonReg = guiCreateButton(10,150,120,21,"Register",false,regMenu) guiSetAlpha(buttonReg,1) buttonCan = guiCreateButton(143,150,117,21,"Cancel",false,regMenu) guiSetAlpha(buttonCan,1) labelRegister = guiCreateLabel(10,26,250,17,"Register with a user and pass here.",false,regMenu) guiSetAlpha(labelRegister,1) guiLabelSetColor(labelRegister,255,255,255) guiLabelSetVerticalAlign(labelRegister,"top") guiLabelSetHorizontalAlign(labelRegister,"center",false) guiSetFont(labelRegister,"default-bold-small") guiSetVisible(regMenu, false) function cancelWindow() guiSetVisible(regMenu, false) end function resourceStart() createLoginWindow() if (windowLogin ~= nil) then guiSetVisible(windowLogin, true) else outputChatBox("An error has occurred.") end showCursor(true) guiSetInputEnabled(true) end function changePw() createPasswordWindow() guiSetVisible(windowChangepw, true) showCursor(true) guiSetInputEnabled(true) end function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(editUsername) local password = guiGetText(editPassword) if username and password then showChat(true) triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else guiSetText(labelInfo, "Enter username and password.") end end end function showReg(button, state) guiSetVisible(regMenu, true) --if button == "left" and state == "up" then -- local username = guiGetText(editUsername) -- local password = guiGetText(editPassword) -- if username and password then --showChat(false) -- -- -- triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) -- else -- guiSetText(labelInfo, "Enter username and password.") -- end --end end function clientSubmitRegister(button, state) if button == "left" and state == "up" then local username = guiGetText(editRegUsername) local password = guiGetText(editRegPassword) if username and password then showChat(false) triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) else -- guiSetText(labelRegister, "User/pass in use.") end end end function clientSubmitChangepw(button, state) if button == "left" and state == "up" then local oldpassword = guiGetText(editOldpw) local newpassword = guiGetText(editNewpw) if oldpassword and newpassword then triggerServerEvent("submitChangepw", getRootElement(), localPlayer, oldpassword, newpassword) else outputChatBox("Enter old and new password.") end end end function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(windowLogin, false) showCursor(false) guiSetVisible(regMenu, false) setTimer(guiSetVisible, 3100, 1, guiSkinShop, true) showCursor(true) end function hideLoginWindow1() guiSetInputEnabled(false) guiSetVisible(windowLogin, false) showCursor(false)
  15. function maxpayne(thePlayer, command) if getGameSpeed() == 1 then setGameSpeed(0.5) outputChatBox("Max Payne Mode On", thePlayer) else setGameSpeed(1) outputChatBox("Max Payne Mode Off", thePlayer) end end addCommandHandler("maxpayne", maxpayne)
  16. viewtopic.php?f=148&t=40809
  17. https://wiki.multitheftauto.com/wiki/Has ... rmissionTo
×
×
  • Create New...