Jump to content

Calling function "getRunningGamemode" returns userdata?


AfuSensi

Recommended Posts

Posted

Hi,

I'm trying to call the function "getRunningGamemode" to detect what gamemode the current map is.

But it returns userdata instead of the gamemode.

I have no idea what userdata is.

I use this to call the function:

gamemode = call(getResourceFromName("mapmanager"), "getRunningGamemode") 
outputChatBox(tostring(gamemode)) 

Returns: userdata: 020000F5

https://wiki.multitheftauto.com/wiki/Map ... _functions

Posted
As its supposed to be.

Now use getResourceName on that userdata.

Thanks! It worked.

Mind explaining what userdata is? I can find nothing on wiki about it.

Posted

With the userdata you can do things with other codes. Like getResourceName, getPlayerName, getTeamName, etc, etc. I don't really know how to explain that properly, but lets just say you can do something with it :3

Posted

There are eight basic data types in Lua: nil, boolean, number, string, userdata, function, thread, and table.

Userdata are used to represent new types created by MTA such as player, vehicle, objects or even xml nodes. That's the way you can represent those elements in lua, as they are not native of the language.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...