Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

vitafit

LUA native issues

Recommended Posts

vitafit

Hi folks,

 

i am trying to call a native function:

PLAYER::_SET_MOVE_SPEED_MULTIPLIER

Hashes: 0x6DB47AA77FD94E09 0x825423C2

void _SET_MOVE_SPEED_MULTIPLIER(Player player, float multiplier)
// 0x6DB47AA77FD94E09 0x825423C2

 

Unfortunately i can't get this to work:

if IsKeyDown(KEY_F10) thenlocal me = LocalPlayer()natives.PLAYER.SET_MOVE_SPEED_MULTIPLIER(me, 5,5)end

Somehow the player entity seems to be wrong:

load_addon spawn_vehicle[LuaScriptThread] Thread spawn_vehicle reset
[LuaScriptThread] Thread spawn_vehicle:Tick caused an error!
[LUA] GTALua/internal/extensions/CScriptThread.lua:70: ...internal/modules/../..
/addons/spawn_vehicle/main.lua:36: attempt to call field 'SET_MOVE_SPEED_MULTIPL
IER' (a nil value)
Oh no! Example Thread caused an error!
LuaScriptThread::Reset spawn_vehicle

 

 

Any ideas? I am trying to increase the run-speed...

 

Thanks!

Edited by vitafit

Share this post


Link to post
Share on other sites
Freakyy

Hey

 

 

if IsKeyDown(KEY_F10) thenlocal me = LocalPlayer()natives.PLAYER.SET_MOVE_SPEED_MULTIPLIER(me, 5,5)end

 

If you want to use your LocalPlayer for natives, you need to pass me.PlayerID - That's where your Player ID is stored. If you pass me, you are passing a Player class instance.

Also float numbers are used like this: 5.5 - not with a ",".

 

 

if IsKeyDown(KEY_F10) thenlocal me = LocalPlayer()natives.PLAYER.SET_MOVE_SPEED_MULTIPLIER(me.PlayerID, 5.5)end
If you want to live chat, make sure to check out GTALua's IRC channel.

irc.gtanet.com (Port 6667)

#gtalua

 

Freaky

Edited by Freakyy

Share this post


Link to post
Share on other sites
vitafit
[LUA] GTALua/internal/extensions/CScriptThread.lua:70: ...internal/modules/../..
/addons/spawn_vehicle/main.lua:36: attempt to call field 'SET_MOVE_SPEED_MULTIPL
IER' (a nil value)
Oh no! Example Thread caused an error!
LuaScriptThread::Reset spawn_vehicle

 

 

Thats not working either, i tried your code - btw. thanks for your response, i got your idea.

Share this post


Link to post
Share on other sites
Freakyy

Ah wait, found the mistake.

 

 

if IsKeyDown(KEY_F10) thenlocal me = LocalPlayer()natives.PLAYER._SET_MOVE_SPEED_MULTIPLIER(me.PlayerID, 5.5)end
The native has a "_" there :)
  • Like 1

Share this post


Link to post
Share on other sites
vitafit

Thanks, seems to work. Good to know the thing about the _ :lol:

Share this post


Link to post
Share on other sites
Freakyy

Great.

 

It's not with all natives, just some of them :)

Share this post


Link to post
Share on other sites
vitafit

Well yes, nativedb seems to be wrong... let me give you an example:

PLAYER::SET_PLAYER_SPRINT

Hashes: 0xA01B8075D8B92DF4 0x7DD7900C

void SET_PLAYER_SPRINT(Player player, float sprint)
// 0xA01B8075D8B92DF4 0x7DD7900C

 

 

obviously the second parameter is expected to be a float which it is not:

 

[LUA] GTALua/internal/extensions/CScriptThread.lua:70: GTALua/internal/extension
s/CNativeReg.lua:70: CNativeReg:Call [PLAYER/SET_PLAYER_SPRINT]: Argument type m
ismatch (index 2 - got number expected boolean)

 

natives.PLAYER.SET_PLAYER_SPRINT(me.PlayerID, 50.5)

 

Is there any better source for natives??

Share this post


Link to post
Share on other sites
Freakyy

No, NativeDB is the best source actually. If a native isn't working in lua, the native_call_layout.ini has to be updated.

SET_PLAYER_SPRINT=ab)v

needs to be replaced with

SET_PLAYER_SPRINT=af)v

 

This change will be in included in the next version.

Share this post


Link to post
Share on other sites
vitafit

Hold on i just realized that you are actually the guy who has made the awesome LUA plugin i am so stupid :lol:

Okay long story short _SET_MOVE_SPEED_MULTIPLIER is working but not doing what i want - i just want to make the player run faster any idea how you would do it?

Share this post


Link to post
Share on other sites
Freakyy

Haha :D

Nope, no idea. I haven't really worked that much with natives yet :D

Share this post


Link to post
Share on other sites
derkk

The move speed multiplier doesn't work when you use values above 1.49/1.50

Share this post


Link to post
Share on other sites
chinagreenelvis

There are a LOT of natives I'm having issues with in GTALua.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.