IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Post mod/code requests in the Mod Requests topic

Post mod releases in the Mod Showroom

Read the Modding Rules BEFORE posting!

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 LUA TUTORIAL

 
-TRASE-  
Posted: Tuesday, Dec 23 2008, 11:29
Quote Post


Punk-ass Bitch
Group Icon
Group: Members
Joined: Feb 7, 2008

un.gif

XXXXX



ok, unless someone post a tutorial, i will update this post when i find somthing useful!


YYYES!
Finally got somthing working!
Press TAB and your wanted level is clear.
http://ifolder.ru/9703915

Solving problems
Ok, i found some sort of a tutorial, i will post it here, ile try to figure it out! [HEhe, ROckstar, i dont need your DLC smile.gif we will have somthing cooler, and for FREE]

QUOTE
  GTA IV has many script functions called "Native API" or "natives".
  Alice lua script can call any of this functions from itself.
  Everyone who knows something about assembler and function call
  concept will understand all this native-sh1t what i wrote below
  without any problems :
  [!!! its recomended to look at examples and read this at one time]
  ----- General functions -----
   To push integer/float parameter into the calling native func use
     PushInt(Value) / PushFloat(Value)
   To push script pointer use
     PushVarPtr() -- no params, if native changes pushed value
    -- u must use this function and after native
                  -- calling read the value of this variable
   To get integer/float param from stack after native call use
     Value = GetIntParam(ParamNumber) /
     Value = GetFloatParam(ParamNumber)
   To get the integer/float result of function (if exists) use
     Val = GetIntResult() / Val = GetFloatResult() 
   At least, to call native function use
     CallNative("NATIVE_FUNCTION_NAME") -- names are declared in
     -- other files
     (WARNING : You can't use functions which operate with models,
                and now i don't know what is the reason of this .)
   ----- Other needed functions (not for natives) -----
   Game must be started to use native functions, so we need a check:
     bool IsPlayerPoolCreated() -- if player pool is ok then we can
    -- use some native functions
     bool IsKeyPressed(AnsiKeyNum) -- checking any ansi key state
     Wait(Milliseconds) -- stops script for a needed time
     PrintFloatToLog(Value) / PrintStrToLog("STRING") -- prints
            -- to log
    
   ----- Call example -----
      --  GET_PLAYER_CHAR(0, &Var)
      --  declarations of functions u will see soon ,
      --  and now look at additional files 
      PushInt(0) -- 0 param
      PushVarPtr() -- 1 param (this is our &Var)
      CallNative("GET_PLAYER_CHAR") -- making a call
      PLAYER_CHAR = GetIntParam(1) -- reading the value
       -- from 1 parameter

   ----- Player structure organization -----
      int GET_PLAYER_ID() -- get player id , using only for getting
                          -- results of next functions
                          --  (always 0 in single player mode);
      int CONVERT_INT_TO_PLAYERINDEX( GET_PLAYER_ID() ) -- get player
             -- index from id , this is player definition variable
             -- (in SA was $PLAYER_CHAR) (always 0 in single player mode);
      GET_PLAYER_CHAR( CONVERT_INT_TO_PLAYERINDEX( GET_PLAYER_ID() ), &PlayerChar )
             -- get player char from player index , this is "player as ped/actor"
             -- definition variable (in SA was $PLAYER_ACTOR);


" I wasted 2 days to fill free with lua coding , it's not so hard as you thought ." - says the author.

Dont forget to say Thanks to these guys!
QUOTE
4. About :
    Authors : Alexander /Alexander Blade / Alexander Koryakin ,
       flacs
   THX 2 :    GooD, Listener, Seemann, Sacky, Lua developers ...

wait... GooD? i know this guy!

edit: i dont know how, but i have a pool cue now

This post has been edited by -TRASE- on Tuesday, Dec 23 2008, 13:53
PM
  Top
 

 
~Rick  
Posted: Tuesday, Dec 23 2008, 11:49
Quote Post


Gibbed
Group Icon
Group: Members
Joined: Sep 25, 2003

us.gif

XXXXX



Don't call native functions without first looking at how to use them. Pushing a single argument to a native that takes two is a bit iffy you know. anuj_cop.gif

In the case of DONT_DISPATCH_COPS_FOR_PLAYER, it takes two arguments.

Try:
CODE
PushInt(PLAYER_INDEX)
PushInt(1)
CallNative("SET_PLAYER_INVINCIBLE")


Or:
CODE
PushInt(1)
PushInt(PLAYER_INDEX)
CallNative("SET_PLAYER_INVINCIBLE")



And this isn't a lua tutorial.
Users WebsitePM
  Top
 

 
-TRASE-  
Posted: Tuesday, Dec 23 2008, 11:59
Quote Post


Punk-ass Bitch
Group Icon
Group: Members
Joined: Feb 7, 2008

un.gif

XXXXX



I know nothing about the LUA coding, but im a fast learner smile.gif

i need a script, when you press a button, a selected native function activates, can you help me?
PM
  Top
 

 
~Rick  
Posted: Tuesday, Dec 23 2008, 12:05
Quote Post


Gibbed
Group Icon
Group: Members
Joined: Sep 25, 2003

us.gif

XXXXX



The examples provided should suffice.
Users WebsitePM
  Top
 

 
LunR  
Posted: Monday, Jan 19 2009, 00:30
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jan 18, 2009

XXXXX



I installed afew lua and asi script things but now its telling me just after the loading screen something about 'Lua-native player id' and then gta just closes.
Wat the hell is goin on?
PM
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG