Jump to content

طلب كود صغير


RLP[Farouk]

Recommended Posts

mtaserver.conf في ملف

في آخر الملف

تلقى زي كذا

هذا لتشغيل لوحة الأدمنية مع بداية تشغيل السيرفر

"admin" startup="1" protected="0"/> 

حط تحته

"اسم المود الي تبي يشتغل مع بداية تشغيل السيرفر" startup="1" protected="0"/> 

mtaserver.conf للمزيد من المعلومات عن ملف

https://wiki.multitheftauto.com/wiki/Server_mtaserver.conf

Link to comment

هيك مظبوط؟؟؟

function setCameraOnPlayerJoin() 
    fadeCamera( source, true ) 
    setCameraMatrix( source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316 ) 
end 
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) 
  
--function stopCameraOnPlayerLogin() 
 --   fadeCamera( source, false ) 
--end 
--addEventHandler("onPlayerLogin", getRootElement(), stopCameraOnPlayerLogin) 
  
addEvent("submitLogin", true) 
addEvent("submitRegister", true) 
  
function loginHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent (source, "hideLoginWindow", source) 
        end 
    end 
end 
addEventHandler("submitLogin", root, loginHandler) 
  
function registerHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        outputChatBox( "", root, 255, 255, 255 ) 
    else 
        account = addAccount(username, password) 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent(source, "hideRegisterWindow", getRootElement()) 
        end 
    end 
end 
addEventHandler("submitRegister", root, registerHandler) 
  
    addEventHandler("onPlayerLogin", root, 
    function() 
         spawnPlayer(source, 1682.9846191406, -2245.932189063, 13.547117233276) 
         setCameraTarget(source) 
    end) 

Link to comment

ملاحظة: انا اريد ان ينزل الاعب الجديد في مكان معيين بعد التسجيل فقط

هذه الاكواد ما عدلت عليها شي

الكلنت ما دخله

انا لما اعدل على ملف السيرفر

الازرار تخرب

Client:

-- REPLACE THIS ! 
local serverInfo = "Put server information here" 
  
  
  
  
  
  
function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
local loginWindow = {} 
local loginLabel = {} 
local loginEdit = {} 
local loginButton = {} 
local mainButton = {} 
local mainLabel = {} 
local mainMemo = {} 
local registerWindow = {} 
local registerLabel = {} 
local registerEdit = {} 
local registerButton = {} 
  
-- Login 
loginWindow["mainWindow"] = guiCreateWindow (0,0,505, 235,"Welcome to the server!", false) 
centerWindow( loginWindow["mainWindow"] ) 
guiWindowSetMovable( loginWindow["mainWindow"], false ) 
guiWindowSetSizable( loginWindow["mainWindow"], false ) 
guiSetInputEnabled( true ) 
showCursor(true) 
loginLabel["Username"] = guiCreateLabel( 20, 40, 70, 20, "Username:", false, loginWindow["mainWindow"]) 
loginEdit["Username"] = guiCreateEdit( 82, 38, 90, 20, "", false, loginWindow["mainWindow"] ) 
loginLabel["Password"] = guiCreateLabel( 20, 70, 70, 20, "Password:", false, loginWindow["mainWindow"]) 
loginEdit["Password"] = guiCreateEdit( 82, 68, 90, 20, "", false, loginWindow["mainWindow"] ) 
loginButton["Main"] = guiCreateButton( 82, 98, 90, 30, "Login", false, loginWindow["mainWindow"] ) 
  
-- Main 
mainLabel["New"] = guiCreateLabel( 57, 148, 160, 30, "Are you new to the server?", false, loginWindow["mainWindow"] ) 
mainButton["ClickHere"] = guiCreateButton( 82, 178, 90, 30, "Click here!", false, loginWindow["mainWindow"] ) 
mainMemo["ServerInfo"] = guiCreateMemo( 230, 38, 265, 170, serverInfo, false, loginWindow["mainWindow"] ) 
  
-- register 
registerWindow["mainWindow"] = guiCreateWindow (0,0,250, 150,"Register", false) 
centerWindow( registerWindow["mainWindow"] ) 
guiSetVisible( registerWindow["mainWindow"], false ) 
registerLabel["Username"] = guiCreateLabel( 45, 40, 70, 20, "Username:", false, registerWindow["mainWindow"]) 
registerEdit["Username"] = guiCreateEdit( 107, 38, 90, 20, "", false, registerWindow["mainWindow"] ) 
registerLabel["Password"] = guiCreateLabel( 45, 70, 70, 20, "Password:", false, registerWindow["mainWindow"]) 
registerEdit["Password"] = guiCreateEdit( 107, 68, 90, 20, "", false, registerWindow["mainWindow"] ) 
registerButton["Main"] = guiCreateButton( 107, 98, 90, 30, "Register", false, registerWindow["mainWindow"] ) 
registerButton["Close"] = guiCreateButton( 30, 30, 20, 20, "X", false, registerWindow["mainWindow"]) 
  
guiEditSetMasked(registerEdit["Password"], true) 
guiEditSetMasked(loginEdit["Password"], true) 
  
function clientSubmitLogin(button, state) 
    if button == "left" and state == "up" then 
        local username = guiGetText(loginEdit["Username"]) 
        local password = guiGetText(loginEdit["Password"]) 
        if username and password then 
            triggerServerEvent("submitLogin",localPlayer, username, password) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", loginButton["Main"], clientSubmitLogin, false) 
  
function clientSubmitRegister(button, state) 
    if button == "left" and state == "up" then 
        local username = guiGetText(registerEdit["Username"]) 
        local password = guiGetText(registerEdit["Password"]) 
        if username and password then 
            triggerServerEvent("submitRegister",localPlayer, username, password) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", registerButton["Main"], clientSubmitRegister, false) 
  
function hideLoginWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible(loginWindow["mainWindow"], false) 
    showCursor(false) 
end 
  
function showRegisterWindow() 
    guiSetInputEnabled( true ) 
    guiSetVisible(registerWindow["mainWindow"], true) 
    showCursor(true) 
    guiSetVisible(loginWindow["mainWindow"], false) 
end 
addEventHandler("onClientGUIClick", mainButton["ClickHere"], showRegisterWindow, false) 
  
function hideRegisterWindow1() 
    guiSetInputEnabled( true ) 
    guiSetVisible(registerWindow["mainWindow"], false) 
    showCursor(true) 
    guiSetVisible(loginWindow["mainWindow"], true) 
end 
addEventHandler("onClientGUIClick",registerButton["Close"], hideRegisterWindow1, false) 
  
  
function hideRegisterWindow() 
    guiSetInputEnabled( false ) 
    guiSetVisible(registerWindow["mainWindow"], false) 
    showCursor(false) 
end 
  
addEvent("hideRegisterWindow", true) 
addEvent("hideLoginWindow", true) 
addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) 
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) 
  
  
  

Server:

function setCameraOnPlayerJoin() 
    fadeCamera( source, true ) 
    setCameraMatrix( source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316 ) 
end 
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) 
  
--function stopCameraOnPlayerLogin() 
 --   fadeCamera( source, false ) 
--end 
--addEventHandler("onPlayerLogin", getRootElement(), stopCameraOnPlayerLogin) 
  
addEvent("submitLogin", true) 
addEvent("submitRegister", true) 
  
function loginHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent (source, "hideLoginWindow", source) 
        end 
    end 
end 
addEventHandler("submitLogin", root, loginHandler) 
  
function registerHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        outputChatBox( "", root, 255, 255, 255 ) 
    else 
        account = addAccount(username, password) 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent(source, "hideRegisterWindow", getRootElement()) 
        end 
    end 
end 
addEventHandler("submitRegister", root, registerHandler) 

Link to comment
function setCameraOnPlayerJoin() 
    fadeCamera( source, true ) 
    setCameraMatrix( source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316 ) 
end 
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) 
  
--function stopCameraOnPlayerLogin() 
 --   fadeCamera( source, false ) 
--end 
--addEventHandler("onPlayerLogin", getRootElement(), stopCameraOnPlayerLogin) 
  
addEvent("submitLogin", true) 
addEvent("submitRegister", true) 
  
function loginHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent (source, "hideLoginWindow", source) 
        end 
    end 
end 
addEventHandler("submitLogin", root, loginHandler) 
  
function registerHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        outputChatBox( "", root, 255, 255, 255 ) 
    else 
        account = addAccount(username, password) 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent(source, "hideRegisterWindow", getRootElement()) 
            spawnPlayer(source, 1682.9846191406, -2245.932189063, 13.547117233276) 
            setCameraTarget(source) 
        end 
    end 
end 
addEventHandler("submitRegister", root, registerHandler) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...