Coder Social home page Coder Social logo

pmc-callbacks's People

Contributors

ktos93 avatar notsomething0 avatar pitermcflebor avatar twiitchter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pmc-callbacks's Issues

How to work timeouts? I think Im doing something wrong

RegisterCommand("testnew", function(source, args, rawCommand)
exports['pmc-callbacks']:TriggerServerCallback {
eventName = 'Lumberjack:server:secrettoken',
args = {'test'},
timeout = 5000,
timedout = function(result)
print('timed out')
end,
callback = function(result)
print('gotcha', result)
end
}
end, false)

Error on line 57

I get this error

[     script:Test] SCRIPT ERROR: attempt to get length of a nil value
[     script:Test] > handler (@pmc-callbacks/import.lua:57)

This is my code

-- Client
RegisterNUICallback('test:nuiCallback', function (args, cb)
    local data = TriggerServerCallback {
        eventName = 'test:serverCallback'
    }
    cb({ data = data })
end)

-- Server
RegisterServerCallback {
    eventName = 'test:serverCallback',
    eventCallback = function(source, args)
        return 'Test Data'
    end
}

Example code does not work.

Hey, so Im using the example. And so im having an issue with it,

script.js:
function checkPlate(plateNumber) { plateNumber = "hey"; $.post("http://mart/checkplatemaaaaal"); }

client.lua:
RegisterNUICallback('checkplatemaaaaal', function() TriggerServerCallback { eventName = 'mart:testingAwesomeCallback', args = { 'some', 'args', 'here' }, callback = function(result) print('gotcha', result) end } end)

server.lua:
RegisterServerCallback { eventName = 'mart:testingAwesomeCallback', eventCallback = function(source, ...) return 'return something' end }

nothing gets printed, I tried everything I could.

i'd appreciate if someone could provide me a working example.

Example Code not working

Hi!

When i trigger a server event sync / async i dont get any result from server.
I added a debug message in my server event and its getting called so only the result is not working. Can you help me with this?

image

image

image

Best Regards,
Paul!

Triggering Callback error

I have two resources.
I want to trigger server callback of resource 2 from client side of resource 1.
When I do so, it shows me an error:
Error loading script @resource-2/server.lua in resource resource-1: @resource-2/server.lua:31: attempt to call a nil value (global 'RegisterServerCallback')

  1. I have "shared_script '@pmc-callbacks/import.lua'" in manifests of both resources
  2. Resource 2 code snippet:
RegisterServerCallback {
    eventName = 'somename',
    eventCallback = function(source)
        local player = source
        local funcres = somefunction(player)

        local result = 0
        
        if something == true then  
            result = funcres
        else 
            result = 0
        end 

        return result
    end
}
  1. Resource 1 code snippet:
local result = TriggerServerCallback {
        eventName = 'somename',
        args = {'none'}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.