SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 18/08/2012, 08:00 PM   #21
Arca
Big Clucker
 
Arca's Avatar
 
Join Date: Jul 2012
Location: Plano, Texas, United States
Posts: 179
Reputation: 33
Default Re: Lua in SAMP (alpha)

Quote:
Originally Posted by Rancho View Post
in Google-Code page, Download AmxUtils/*.cpp,*.h Add your native's information to PawnNative.h

and call it with;

AmxUtils * utils;
utils->callNative( MyNative, "blah string");
Okay thanks. Will try.

Edit: It would be better if LUA have it implemented itself.
__________________

Code:
Arca is offline   Reply With Quote
Old 18/08/2012, 08:04 PM   #22
Rancho
Big Clucker
 
Join Date: Jun 2012
Location: Turkey / GTATurk
Posts: 58
Reputation: 50
Default Re: Lua in SAMP (alpha)

Quote:
Originally Posted by Arca View Post
Okay thanks. Will try.

Edit: It would be better if LUA have it implemented itself.
Oh I will think about that.

Speed fixed DLL Added to Google-Code( It's just 1 fix, but reduces more times);
Rancho is offline   Reply With Quote
Old 18/08/2012, 08:07 PM   #23
Arca
Big Clucker
 
Arca's Avatar
 
Join Date: Jul 2012
Location: Plano, Texas, United States
Posts: 179
Reputation: 33
Default Re: Lua in SAMP (alpha)

Quote:
Originally Posted by Rancho View Post
Oh I will think about that.

Speed fixed DLL Added to Google-Code( It's just 1 fix, but reduces more times);
Great.
__________________

Code:
Arca is offline   Reply With Quote
Old 19/08/2012, 12:53 PM   #24
Rancho
Big Clucker
 
Join Date: Jun 2012
Location: Turkey / GTATurk
Posts: 58
Reputation: 50
Default Re: Lua in SAMP (alpha)

Exporting function from Script to other scripts completed.

0.2.1 is still developing...
Rancho is offline   Reply With Quote
Old 20/08/2012, 09:57 AM   #25
Rancho
Big Clucker
 
Join Date: Jun 2012
Location: Turkey / GTATurk
Posts: 58
Reputation: 50
Default Re: Lua in SAMP (alpha)

New version is now public.You can export functions now.For example;
test.lua:
pawn Code:
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 Code:
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..
Rancho is offline   Reply With Quote
Old 20/08/2012, 11:08 AM   #26
Optimus_Sprite
Big Clucker
 
Join Date: Oct 2011
Posts: 77
Reputation: 2
Default Re: Lua in SAMP (alpha)

I want to get an example with addEventHandler, because i got error: Bad argument @ addEventHandler
Optimus_Sprite is offline   Reply With Quote
Old 20/08/2012, 11:19 AM   #27
Rancho
Big Clucker
 
Join Date: Jun 2012
Location: Turkey / GTATurk
Posts: 58
Reputation: 50
Default Re: Lua in SAMP (alpha)

Quote:
Originally Posted by Optimus_Sprite View Post
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.
Rancho is offline   Reply With Quote
Old 20/08/2012, 07:44 PM   #28
Arca
Big Clucker
 
Arca's Avatar
 
Join Date: Jul 2012
Location: Plano, Texas, United States
Posts: 179
Reputation: 33
Default Re: Lua in SAMP (alpha)

Quote:
Originally Posted by Rancho View Post
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.
__________________

Code:
Arca is offline   Reply With Quote
Old 21/08/2012, 07:13 AM   #29
Rancho
Big Clucker
 
Join Date: Jun 2012
Location: Turkey / GTATurk
Posts: 58
Reputation: 50
Default Re: Lua in SAMP (alpha)

Quote:
Originally Posted by Arca View Post
How to call custom function? For example I have SendPlayerFormattedMessage.
In pawn or in lua?
Rancho is offline   Reply With Quote
Old 21/08/2012, 07:26 AM   #30
Toni
High-roller
 
Toni's Avatar
 
Join Date: Aug 2009
Location: United States
Posts: 1,535
Reputation: 154
Default Re: Lua in SAMP (alpha)

Quote:
Originally Posted by TheArcher View Post
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.
Toni is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[GameMode] zFreePlay[ALPHA] zohartrejx Gamemode Scripts 22 03/01/2013 03:57 PM
[GameMode] Chicken DM 0.1, an alpha for my first GM Anotniomontana Gamemode Scripts 13 27/08/2010 07:12 AM
SendClientMessage: alpha Damn Right M.I.A! Help Archive 3 21/10/2009 01:21 PM


All times are GMT. The time now is 05:47 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.