[Plugin] Lua in SAMP (alpha)
#21

Exporting function from Script to other scripts completed.

0.2.1 is still developing...
Reply
#22

New version is now public.You can export functions now.For example;
test.lua:
pawn Код:
function IsValidAge(_match_str)
    if (not tonumber(_match_str)) then return false; end
    return tonumber(_match_str)>7 and tonumber(_match_str) <= 125;
end
export("IsValidAge",IsValidAge);
test2.lua
pawn Код:
exports.test:IsValidAge(21);
// or
call("CAccount", "IsValidAge", 21);
Like this,
The first string in export, what's the function name to export other scripts
Second parameter is which function..
Reply
#23

I want to get an example with addEventHandler, because i got error: Bad argument @ addEventHandler
Reply
#24

Quote:
Originally Posted by Optimus_Sprite
Посмотреть сообщение
I want to get an example with addEventHandler, because i got error: Bad argument @ addEventHandler
New download added, fixed some bugs..

addEventHandler(name, rootID, function)

rootID = Event called for who, -1 is for all
addEventHandler('onPlayerConnect', -1, function) -- all players
addEventHandler('onPlayerConnect',0,function) -- for id 0 only

rootID usually first parameter in the publics.
Reply
#25

Quote:
Originally Posted by Rancho
Посмотреть сообщение
New download added, fixed some bugs..

addEventHandler(name, rootID, function)

rootID = Event called for who, -1 is for all
addEventHandler('onPlayerConnect', -1, function) -- all players
addEventHandler('onPlayerConnect',0,function) -- for id 0 only

rootID usually first parameter in the publics.
How to call custom function? For example I have SendPlayerFormattedMessage.
Reply
#26

Quote:
Originally Posted by Arca
Посмотреть сообщение
How to call custom function? For example I have SendPlayerFormattedMessage.
In pawn or in lua?
Reply
#27

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
I read almost all the replies about LUA used by MTA. I'm pretty sure that it's also used mostly for new mods and source engine (CSS, GarrysMod etc...).
Yeah most games on SE do besides CSS and TF2. They actually use PAWN. Which is a huge benefit for us SA:MP coders because you can run right over there and start doing all the stuff you want. SourceMod is based on AMX Mod.

Congratulations on this release though, it's very nice.
Reply
#28

Linux version is coming

Just last 1-2 edit...
Reply
#29

Linux version added.
Reply
#30

Quote:
Originally Posted by Arca
Посмотреть сообщение
How to call custom function? For example I have SendPlayerFormattedMessage.
Can someone help me out?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)