Jump to content

Smart.

Members
  • Posts

    340
  • Joined

  • Last visited

Posts posted by Smart.

  1. Try this

    function sendEmail(email, subject, message) 
        callRemote("URL", function() end, email, subject, message) 
    end 
    

    php:

    <?php    
        include("MTA/mta_sdk.php" ); 
        $input = mta::getInput(); 
      
        mail($input[0], $input[1], $input[2]); 
      
        mta::doReturn($input[0], $random); 
    ?> 
    

  2. Can't be bothered to finish, if anyone wants to work on it themselves here is the current code:

    server

      
    marker = {} 
      
    function createShops() 
        for index, dat in pairs(shops) do 
            outputChatBox(dat[1]) 
            marker[dat[4]] = createMarker(dat[1], dat[2], dat[3] - 1, "cylinder", 1.5, 255, 255, 255) 
        end 
    end 
    addEventHandler("onResourceStart", resourceRoot, createShops) 
      
    function enterMarker(player, match) 
        if (not match) then return end 
        if (not isElement(player) or getElementType(player) ~= "player") then return end 
        if (isPedInVehicle(player)) then 
            outputChatBox("You can't enter the shop while being inside a vehicle", player, 200, 0, 0) 
            return 
        end 
         
        triggerClientEvent(player, "carsystem.enterMarker", player) 
    end 
    addEventHandler("onMarkerHit", resourceRoot, enterMarker) 
      
    function buyCar(car, cost) 
        if (getPlayerMoney(client) <= tonumber(cost)) then 
            outputChatBox("You can't afford "..car..", you are missing $"..formatNumber(tonumber(cost) - getPlayerMoney(client)), client, 200, 200, 0) 
            return 
        end 
         
        local model = getVehicleModelFromName(car) 
         
        if (not model) then 
            outputChatBox("An error occured while attempting to purchase this vehicle", client, 255, 0, 0) 
            return 
        end 
         
        --takePlayerMoney(client, cost) 
        triggerClientEvent(client, "carsystem.boughtCar", client, car, cost) 
        --addCarToDB(client, car) 
    end 
    addEvent("carsystem.buyCar", true) 
    addEventHandler("carsystem.buyCar", root, buyCar) 
      
    function finalizeDeal(r, g, b, car, cost) 
        if (getPlayerMoney(client) <= tonumber(cost)) then 
            outputChatBox("You can't afford "..car..", you are missing $"..formatNumber(tonumber(cost) - getPlayerMoney(client)), client, 200, 200, 0) 
            return 
        end 
         
        local model = getVehicleModelFromName(car) 
         
        if (not model) then 
            outputChatBox("An error occured while attempting to purchase this vehicle", client, 255, 0, 0) 
            return 
        end 
         
        if (not mycars[client]) then mycars[client] = {} end 
         
        takePlayerMoney(client, cost) 
        outputChatBox(getPlayerName(client).." you have succesfully bought a "..car.." for $"..formatNumber(cost), client, 0, 255, 0) 
         
        closestShop(client) 
        local x, y, z, rotation = closest[client][5], closest[client][6], closest[client][7], closest[client][8] 
        local veh = createVehicle(model, x, y, z, 0, 0, rotation) 
        table.insert(mycars[client], veh) 
        warpPedIntoVehicle(client, veh) 
        setVehicleColor(veh, r, g, b) 
    end 
    addEvent("carsystem.finalizeDeal", true) 
    addEventHandler("carsystem.finalizeDeal", root, finalizeDeal) 
    

    client

      
    local carsGui = {} 
      
    function formatNumber(n) 
        if (not n) then return "Error catching data" end 
        local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') 
        if (not num) then return end 
        return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right 
    end 
      
    function createDealerWindow() 
        buyDealerButton = guiCreateButton(929, 536, 146, 44, "PURCHASE", false) 
        guiSetFont(buyDealerButton, "clear-normal") 
        closeDealerButton = guiCreateButton(1121, 534, 146, 44, "CLOSE", false) 
        guiSetFont(closeDealerButton, "clear-normal") 
      
        dealerGridList = guiCreateGridList(927, 58, 350, 466, false) 
        guiGridListAddColumn(dealerGridList, "Vehicle", 0.5) 
        guiGridListAddColumn(dealerGridList, "Price", 0.5) 
      
        for index, dat in pairs(cars) do 
            local row = guiGridListAddRow(dealerGridList) 
            carsGui[dat[1]] = dat[2] 
            guiGridListSetItemText(dealerGridList, row, 1, tostring(dat[1]), false, false) 
            guiGridListSetItemText(dealerGridList, row, 2, "$" ..tostring(formatNumber(dat[2])), false, false) 
        end 
         
        addEventHandler("onClientGUIClick", dealerGridList, clickedOnGrid, false) 
        addEventHandler("onClientGUIClick", buyDealerButton, buyVehicleFromDealer, false) 
        addEventHandler("onClientGUIClick", closeDealerButton, closeDealerFunc, false) 
        dealerGuiStuff = {buyDealerButton, dealerGridList, closeDealerButton} 
         
        for ind, elem in pairs(dealerGuiStuff) do 
            guiSetVisible(elem, false) 
        end 
    end 
    addEventHandler("onClientResourceStart", resourceRoot, createDealerWindow) 
      
    function createDealerDX() 
        dxDrawRectangle(920, 0, 360, 595, tocolor(0, 0, 0, 200), false) 
        dxDrawLine(920, 35, 1277, 35, tocolor(255, 255, 255, 255), 1, true) 
        dxDrawText("VEHICLE SHOP", 919, 0, 1277, 35, tocolor(255, 255, 255, 200), 2.00, "default-bold", "center", "center", false, false, true, false, false) 
    end 
      
    function enterMarker(mTable) 
        currentShop = mTable 
        showCursor(true) 
        addEventHandler("onClientRender", root, createDealerDX) 
        for ind, elem in pairs(dealerGuiStuff) do 
            guiSetVisible(elem, true) 
        end 
    end 
    addEvent("carsystem.enterMarker", true) 
    addEventHandler("carsystem.enterMarker", root, enterMarker) 
      
    function closeDealerFunc() 
        removeEventHandler("onClientRender", root, createDealerDX) 
        for ind, elem in pairs(dealerGuiStuff) do 
            guiSetVisible(elem, false) 
        end 
        setElementDimension(localPlayer, 0) 
        setCameraTarget(localPlayer) 
        showCursor(false) 
    end 
      
    function buyVehicleFromDealer() 
        local car = guiGridListGetItemText(dealerGridList, guiGridListGetSelectedItem(dealerGridList), 1) 
        if (not car or not carsGui[car]) then return end 
        triggerServerEvent("carsystem.buyCar", root, car, carsGui[car]) 
    end 
      
    function clickedOnGrid() 
        local car = guiGridListGetItemText(source, guiGridListGetSelectedItem(source), 1) 
        if (not car or not carsGui[car]) then return end 
        local cost = carsGui[car] 
        viewCar(car, cost) 
        outputChatBox(tostring(car).." - "..cost) 
    end 
      
    function viewCar(name, cost) 
        if (previewCar and isElement(previewCar)) then 
            destroyElement(previewCar) 
            previewCar = false 
        end 
        local id = getVehicleModelFromName(name) 
        local randomDim = math.random(1, 1000) 
        previewCar = createVehicle(id, 1417.6, -1478.2, 125.3) 
        setElementDimension(localPlayer, randomDim) 
        setElementDimension(previewCar, randomDim) 
        setElementFrozen(previewCar, true) 
        setCameraMatrix(1426.9, -1474.4, 126.3, 1426.0, -1474.8, 126.2) 
         
        if (not rotating) then 
            addEventHandler("onClientRender", root, rotateCar) 
        end  
    end 
      
    function rotateCar() 
        if (not previewCar) then removeEventHandler("onClientRender", root, rotateCar) rotating = false  return end 
        local _, _, z = getElementRotation(previewCar)  
        setElementRotation(previewCar, 0, 0, z + 0.5) 
        rotating = true 
    end 
      
    function changeCarColor(_, _, r, g, b) 
        if (not isElement(previewCar)) then return end 
        setVehicleColor(previewCar, r, g, b) 
    end 
    addEvent("onColorPickerChange", true) 
    addEventHandler("onColorPickerChange", root, changeCarColor) 
      
    function boughtCar(car, cost) 
        openPicker(localPlayer, "FFAA00", "Select car color") 
        acar = car 
        acost = cost 
    end 
    addEvent("carsystem.boughtCar", true) 
    addEventHandler("carsystem.boughtCar", root, boughtCar) 
      
    function finalizeDeal() 
        if (not isElement(previewCar)) then closeDealerFunc() return end 
        local r, g, b = getVehicleColor(previewCar) 
        triggerServerEvent("carsystem.finalizeDeal", root, r, g, b, acar, acost) 
        closeDealerFunc() 
    end 
    addEvent("onColorPickerOK", true) 
    addEventHandler("onColorPickerOK", root, finalizeDeal) 
    

    client & lua

    closest = {} 
    mycars = {} 
      
    -- {"Vehicle Model Name", costInNumbers}, 
    cars = { 
        {"Infernus", 500000}, 
        {"Bullet", 200000}, 
        {"NRG-500", 1000}, 
    } 
      
    shops = { 
        -- makerX, markerY, markerZ, shopName, spawnPointX, spawnPointY, spawnPointZ, rotationZ 
        {1121.6, -1460.0, 15.8, "Los Santos DealerShip", 1122.16772, -1408.44250, 13.41691, 270}, 
    } 
      
    function formatNumber(n) 
        if (not n) then return "Error catching data" end 
        local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') 
        if (not num) then return end 
        return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right 
    end 
      
    function closestShop(plr) 
        if (isElement(plr)) then 
            local px, py, pz = getElementPosition(plr) 
            local shop = nil 
            local miniumDistance = 2000 
            for index, pos in pairs(shops) do 
                local x, y = pos[1], pos[2] 
                local distance = getDistanceBetweenPoints2D(px, py, x, y) 
                if (distance < miniumDistance) then 
                    shop = pos 
                    miniumDistance = distance 
                end 
            end 
            closest[plr] = shop 
            return closest[plr] 
        end 
    end 
    

  3. From what I can see there is no proper vehicle/car system so I've decided to work on one.

    Features:

    • * Dealer shops, where you will be able to preview a car, select color, [thanks to
    https://community.multitheftauto.com/ind ... anddescr=1] see prices etc..
    * Management GUI, See basic information such as location, health and a few functions like lock, hide, blip
    * Saved using SQL, Vehicles will be stored in a sql database so when you restart the server or the resource they'll be saved.
    * Recover positions (if the vehicle is stuck or w/e)
    * Vehicle will break down and become undriveable instead of exploding or being destroyed.
    * Sell function (sell your vehicle for 5% less than what you bought it for, 10% if the vehicle is damaged)
    * Easy to add shops and cars/vehicles (see screenshots)

    If you have any ideas of features just post them here and I'll do my best to add them :)

    • Screenshots:

    a6057f6090fefe55c5a9c3dea884e85c.png

    1d04ab3e3d362fe8f61097407ba87b5a.png

    592de3d6e52fa45c2376d26359db0e48.png

    1901250c6c9775d6d0f6aa71795cf9d5.png

    Ohh, I'm also planning on released it uncompiled because apparently there is already a car system but it's compiled

  4.   
    function addWantedLevel(player, amount) 
        local cur = wantedLevel[player] or 0 
        local wl = getPlayerWantedLevel(player) or 0 
        if (tonumber(wl + 1) >= 6) then return end 
        wantedLevel[player] = cur + amount 
        setPlayerWantedLevel(player, wl + 1) 
        setElementData(player, "wap", cur + amount) 
        setElementData(player, "wans", wl + 1) 
    end 
    

  5. @Smart.: 1 day? And you scripted everything by your own? (Not copied anything, started by an empty file. And lets not say GUIEditor) I wonder how the hell you, and others, can script that fast? :o (And no, I don't use GUIEditor lol.)

    Yup, completely from scratch. Dunno bout others but when I get started on something I don't do something else until it's finished

  6. The package comes with the following resources:

    Login system [login, register and save password and if you're banned a screen will be shown] 
      
    Admin system [completely custom admin system which allows you to moderate your server extremely well. Comes with the following: 
      
    All the basic features (bans, kicks, mute, freeze, spectate, general information (fps, ping, location, acc name etc) 
      
    Admin Jail (send a player to prison for X time or let the automatic system decide time) 
      
    Punishlog and regular log (view account logs) 
      
    Automatic Punishment System (checks if the account has been punished for the same reason before and if so it decides a reasonable time to be punished (can be changed)) 
      
    Notes (where you can leave notes in-between staff) 
      
    And a-lot more.] 
      
    Ban system [custom ban system which uses MySQL, also if you're banned and you try to connect you'll get a ban screen rather than MTA's standard system which is not being able to join the server] 
      
    Misc stuff [Chat system (support, team, localchat and a GUI)], [blips, blips shown in the team color] 
      
    Damage control [Not being able to hurt staffs and other good stuff] 
      
    Respawn system [respawn at closest hospital and a killcam if the killer is a player, the system is very similar to GTA V's death thingy] 
      
    Donation system [You add an account to a database and for how many hours, once the time has been passed the VIP access for that account will get automatically removed and there is a GUI for admins where you can add/remove and view current VIPs] 
      
    Job System [A job resource where you can manually add jobs] 
      
    Log System [each account will have their own general log (with stuff such as chatlines, purchases etc) and a punishlog (where you can see all rule breaks from that account) and a group log (each group gets their own log with group chat, group donations etc). The logs are stored in MySQL so it's easy to show on websites and stuff] 
      
    Police System [Wanted system where you get wanted for committing some crimes, NOTE: Only attacks/murders are added] 
      
    Arrest System [Arrest a wanted player by hitting them with a baton stick 2 times and bring them to the closest PD before timer runs out] 
      
    Prison System [A resource which forces a player into a prison with no option to leave, you can be sent to prison for either rule brekaing (admin jail) or because a police officer apprehended you]  
      
    Text/notification System [A system which lets you output messages in a much nicer way than the standard way. It's used simply by calling an export and you can select font, time visible and much more in the export] 
      
    Updates system [View new updates to the server in-game (basically a changelog)] 
      
    Group System [see here: [url=https://forum.multitheftauto.com/viewtopic.php?f=108&t=67832]https://forum.multitheftauto.com/viewtopic.php?f=108&t=67832[/url]] 
    

    Price can be discussed just PM me if interested and I'll update this topic with screenshots soon.

    And the resources haven't been used anywhere except for a server I was making but never released (nobody else have the scripts except for the group system) and they're all of high quality, uncompiled and completely debugscript-free.

    -- Screenshots --

    https://forum.multitheftauto.com/viewtopic.php?f ... 78#p733900

    --- Some snippets of various scripts --

    http://i.gyazo.com/ceb4df40eca43f9c7ff476b4db30bc32.png - Simple and smart way of checking if the staff has the correct permissions to perform a certain action

    http://i.gyazo.com/004dc4ac2c53ad34435caa440680f4e4.png - Damage control handler

    http://i.gyazo.com/d3f4b661b42cb0126d404091f61edfd9.png - Custom screen shown if the player is banned

    http://i.gyazo.com/5d42c356d095c0aea44a4df53f7a3739.png - Easy to add rules and how many seconds the punishment should be

    http://i.gyazo.com/470735f1ff423cdd7c0c885d9783c519.png - Script checking for previous encounters of the specifically rule broken and takes the time given in the rules table * encounters

  7. Good tutorial but maybe you should explain how you can use tables more efficiently, many people store simple information that's only used within the resource itself by using setElementData and getElementData when it can simply be used with a table and if you want to use it outside the resource you can use a simple export to return the table :)

  8. So, this is basically an uncompiled version of viewtopic.php?f=108&t=50510 but it hasn't been tested in months and may not work (although if my memory serves me right it should work flawlessly) but if there are any bugs they should be easy to fix.

    Client:

    ------------------------------------------------------------------------------------ 
    --  RIGHTS:      All rights reserved by developers 
    --  FILE:        jobs/jobs.lua 
    --  PURPOSE:     Job System Client 
    --  DEVELOPERS:  Smart (Sebbe) 
    ------------------------------------------------------------------------------------ 
      
    local sx, sy = guiGetScreenSize() 
      
    function makeJobGUI() 
        jobWnd = guiCreateWindow((sx / 1) - (364 / 1), (sy / 2) - (458 / 2), 364, 458, "", false) 
        guiWindowSetSizable(jobWnd, false) 
        guiSetVisible(jobWnd, false) 
        guiSetAlpha(jobWnd, 1) 
      
        jobDescLbl = guiCreateLabel(7, 23, 347, 332, "Job Desc", false, jobWnd) 
        guiSetFont(jobDescLbl, "clear-normal") 
        selectJobButton = guiCreateButton(9, 415, 94, 33, "Have Job", false, jobWnd) 
        exitJobButton = guiCreateButton(260, 415, 94, 33, "Close Window", false, jobWnd) 
        addEventHandler("onClientGUIClick", selectJobButton, wantsJob, false) 
        addEventHandler("onClientGUIClick", exitJobButton, exitJob, false) 
         
         
        skinWnd = guiCreateWindow((sx / 1) - (436 / 1), (sy / 2) - (178 / 2), 436, 178, "Skin Selection", false) 
        guiSetAlpha(skinWnd, 1) 
        guiWindowSetSizable(skinWnd, false) 
        guiSetVisible(skinWnd, false) 
      
        skinLbl = guiCreateLabel(6, 24, 420, 57, "Please select what skin you want to work in.", false, skinWnd) 
        guiSetFont(skinLbl, "clear-normal") 
        guiLabelSetHorizontalAlign(skinLbl, "center", false) 
        --guiCreateComboBox(132, 142, 238, 150, "Select Punishment", false, punishWnd) 
        skinCombo = guiCreateComboBox(10, 50, 416, 1500, "Select Skin..", false, skinWnd) 
        skinSelectBttn = guiCreateButton(10, 139, 416, 29, "Select Skin", false, skinWnd) 
         
        addEventHandler("onClientGUIClick", skinCombo, previewModel, false) 
        addEventHandler("onClientGUIClick", skinSelectBttn, youHaveSelectedSkin, false) 
    end 
    addEventHandler("onClientResourceStart", resourceRoot, makeJobGUI) 
      
    --[[selectJobButton = guiCreateButton((sx / 1680) * 1352,  (sy / 1050) * 757,  (sx / 1680) * 99,  (sy / 1050) * 30, "Have Job", false) 
    exitJobButton = guiCreateButton((sx / 1680) * 1576,  (sy / 1050) * 757,  (sx / 1680) * 99,  (sy / 1050) * 30, "Exit", false) 
    guiSetVisible(selectJobButton, false) 
    guiSetVisible(exitJobButton, false)--]] 
      
    function enteredMarker(t, d, s) 
        jobTitle = t 
        jobDesc = d 
        jobSkins = s 
        mySkin = getElementModel(localPlayer) 
        jobTitle = jobTitle:gsub("#%x%x%x%x%x%x", "") 
        showCursor(true) 
        guiSetVisible(jobWnd, true) 
        guiSetText(jobWnd, jobTitle) 
        guiSetText(jobDescLbl, jobDesc) 
    end 
    addEvent("jobs.enteredMarker", true) 
    addEventHandler("jobs.enteredMarker", root, enteredMarker) 
      
    function exitJob() 
        guiSetVisible(jobWnd, false) 
        showCursor(false) 
        --removeEventHandler("onClientRender", root, drawJobText) 
        drawing = false 
    end 
      
    function previewModel() 
        local mod = guiGetText(source) 
        if (tonumber(mod)) then 
            setElementModel(localPlayer, mod) 
        end 
    end 
      
    function wantsJob() 
        guiSetVisible(jobWnd, false) 
        showCursor(false) 
        --windowSelection =  
        --removeEventHandler("onClientRender", root, drawJobText) 
        drawing = false 
         
        if (jobSkins and #jobSkins > 0) then 
            guiSetVisible(skinWnd, true) 
            showCursor(true) 
        end 
         
        guiComboBoxClear(skinCombo) 
         
        for ind, dat in pairs(jobSkins) do 
            guiComboBoxAddItem(skinCombo, dat) 
        end 
        --local jobTitle = jobTitle:gsub("#%x%x%x%x%x%x", "") 
        --triggerServerEvent("jobs.wantJob", root, jobTitle) 
    end 
      
    function youHaveSelectedSkin()   
        for ind, dat in pairs(jobSkins) do 
            if (not getElementModel(localPlayer) == dat) then 
                --exports.texts:message("You can't use this skin for this job", 255, 0, 0, "defualt-bold", true, 0.1) 
                outputChatBox("You cannot use this this skin for this job", 255, 0, 0) 
                return 
            end 
        end 
         
        guiSetVisible(skinWnd, false) 
        showCursor(false) 
        triggerServerEvent("jobs.wantJob", root, _, jobTitle, getElementModel(localPlayer)) 
    end 
    

    Server:

    ------------------------------------------------------------------------------------ 
    --  RIGHTS:      All rights reserved by developers 
    --  FILE:        jobs/jobs.slua 
    --  PURPOSE:     Jobs Server 
    --  DEVELOPERS:  Smart (Sebbe) 
    ------------------------------------------------------------------------------------ 
      
    mrkr = {} 
    jobPed = {} 
      
    jobsLocation = { 
        {job = "#454545FBI", rotation = 90, x = 1547, y = -1670, z = 12.5, r = 105, g = 105, b = 105, team = "Government", skin = {286}, jobEvent = "event", maxWL = 3, description = "This is the Federal Bureau of Investigation.\nMore description will be available soon.\n\nGroup is led by NOBODY.", group = "FBI"}, 
    } 
      
    function makeJobs() 
        for ind, data in pairs(jobsLocation) do 
            --local title = data.job:gsub("#%x%x%x%x%x%x", "") 
            local m = createMarker(data.x, data.y, data.z, "cylinder", 1.5, data.r, data.g, data.b, 75) 
            blip = createBlipAttachedTo(m, 56) 
            setBlipVisibleDistance(blip, 300) 
            mrkr[m] = data.job 
            if (data.skin) then 
                for ind, model in pairs(data.skin) do 
                    jobPed[data.job] = createPed(model, data.x, data.y, data.z + 1) 
                    setElementFrozen(jobPed[data.job], true) 
                    setElementData(jobPed[data.job], "immortalPed", true) 
                    setElementRotation(jobPed[data.job], 0, 0, data.rotation) 
                    break 
                end 
            end 
            addEventHandler("onMarkerHit", m, enteredMarker) 
        end 
    end 
    addEventHandler("onResourceStart", resourceRoot, makeJobs) 
      
    function wantJob(jobName, player, model) 
        if (not player) then player = client end 
        for ind, data in pairs(jobsLocation) do 
            local realTitle = data.job:gsub("#%x%x%x%x%x%x", "") 
            if (realTitle == jobName) then 
                --exports.texts:message(player, "You are working as "..jobName, data.r, data.g, data.b, "default-bold", true, 0.15) 
                --exports.teams:setPlayerTeam(player, data.team) 
                outputChatBox("You are now working as "..jobname, player, data.r, data.g, data.b) 
                setPlayerTeam(player, getTeamFromName(data.team)) 
                if (data.skin and not model) then 
                    for ind, model in pairs(data.skin) do 
                        setElementModel(player, model) 
                        break 
                    end 
                else 
                    setElementModel(player, model) 
                end 
            end 
        end 
    end 
    addEvent("jobs.wantJob", true) 
    addEventHandler("jobs.wantJob", root, wantJob) 
      
      
    function enteredMarker(plr, match) 
        if (not match) then return end 
        if (not mrkr[source]) then return end 
        if (not isElement(plr) or getElementType(plr) ~= "player") then return end 
         
        if (isPedInVehicle(plr)) then  
            outputChatBox("You cannot be inside a vehicle when entering this marker", plr, 255, 0, 0) 
            --exports.texts:message(plr, "You can not be inside a vehicle when entering this marker", 255, 0, 0, "default-bold", true, 0.2) 
            return  
        end 
         
        local name = mrkr[source] 
        for ind, data in pairs(jobsLocation) do 
            if (data.job == name) then 
                local wl = getPlayerWantedLevel(plr) or 0 
                if (wl > data.maxWL) then 
                    outputChatBox("You cannot take this job with "..wl.." stars", plr, 255, 0, 0) 
                    --exports.texts:message(plr, "You can not take this job with "..wl.." stars", 255, 0, 0, "default-bold", true, 0.2) 
                    return 
                end 
                 
                triggerClientEvent(plr, "jobs.enteredMarker", plr, name, data.description, data.skin) 
                 
                return 
            end 
        end 
    end 
    

  9. Funny to see people arguing about this

    c8760bea8af06268dbf2dd98491e50cd22bc7ef7263efcbb0af5f1065f3a5592.jpg

    OT: The MTA wiki is really all you need, most of the scripting is logical. What I also recommend is downloading scripts from the community and reading them to understand what they do and how they do it and just modify small things.

  10. After many many many many days I've added group balance which lets you store money in the group. Obviously the amount will be saved using sql.

    It has NOT been tested too thoroughly so if you find a bug let me know and I'll fix it.

    This means there is a new export which is: getGroupBankAmount(group) which returns the balance (I recommend using groupTable[group][7] inside the script because it's basically the same thing).

    You can also decide who's able to withdraw money using the rank editor and everybody is able to deposit and if the logging is enabled it's logged. In-fact I've made all group outputs logged (only if it's turned on)

  11. IMO,

    It's pretty pretty hard for a guy who doesn't know at least a little big of programming,

    I know a couple, and it's so hard to teach them because they don't have the logic that programming requires.

    MTA Lua and programming is NOT the same thing.

  12. The if statement isn't ended [and no 'then' ?(or I don't see how)]...
    if (isset($_POST["account"]) && isset($_POST["amount"])) 
    

    nevermind if above is PHP and not LUA

    clearly it's PHP

    Lua:

    -- for PHP_Callback resource 
    -- make sure to export "giveTheMoneyToAccount" on http also 
    --  
      
    

    What's mean that? Where I should paste this?

    Duhh, ofc it's not going to work if you haven't added the function as an export http, you need to paste in into your meta.xml uncommented. so;

    Also, i would REALLY suggest to add some security to the .php or you'll have tons and tons of money exploiters. Either you make your own login system which can be hard if you're not enough experienced with php so what I'd recommend is install SMF as your forum and then add a custom smf page and check the user-group OR make a simple IP check:

    <?php    
        $IP = $_SERVER["REMOTE_ADDR"]; 
         
        if ($IP !== "YOURIP") {  
            header("Location: fak_off.php"); 
        }  
    ?> 
    

  13. Okay, i got something.

    I hosted website server local on my computer by use program call Webserv.

    but in browser still same error:

      
    Parse error: syntax error, unexpected $end in D:\WebServ\httpd\mm\addmoney.php on line 21 
      
    

    and no connection with server.

    I got connection by use clean script posted by xXMADEXx:

    [2014-08-16 13:51:55] HTTP: 'dewu' entered correct password from 192.168.137.2 
    

    but still something is wrong:

      
    Fatal error: Uncaught exception 'Exception' with message 'Not Found' in D:\WebServ\httpd\mm\sdk\mta_sdk.php:203 Stack trace: #0 D:\WebServ\httpd\mm\sdk\mta_sdk.php(79): mta->do_post_request('192.168.137.2', 22005, '/PHP_Callback/c...', '["dewu","1000"]') #1 D:\WebServ\httpd\mm\sdk\mta_sdk.php(257): mta->callFunction('PHP_Callback', 'giveTheMoneyToA...', Array) #2 D:\WebServ\httpd\mm\addmoney.php(10): Resource->call('giveTheMoneyToA...', 'dewu', '1000') #3 {main} thrown in D:\WebServ\httpd\mm\sdk\mta_sdk.php on line 203 
      
    

    It's my first contact with PHP_SDK. To everything I had to walk alone.

    So, please help familiar users with it ;/

    <form action="#" method="post"> 
        Account: <input type="text" name="account"> 
        <br> 
        Amount: <input type="text" name="amount"> 
        <input type="submit" name="submit"> 
    </form> 
      
    <? 
        if (isset($_POST["account"]) && isset($_POST["amount"]))  
        { 
         
            $amount = $_POST["amount"]; 
            $account = $_POST["account"]; 
             
            print $amount . "<br>" . $account; 
             
            include("mta/mta_sdk.php"); 
            $mtaServer = new mta("host", port, "user", "password" ); 
            $mtaServer->getResource("PHP_Callback")->call("giveTheMoneyToAccount", $account, $amount); 
        } 
    ?> 
    

    Try this and post result, might not work cause I haven't done any scripting in more than half a year

×
×
  • Create New...