Jump to content

Get time and date


Wiebrendh

Recommended Posts

Is there any option to trigger an if statement when it is sunday 12 o'clock? Really need this for my mod

Link to comment
Share on other sites

LordOfTheBongs

Everything in GTA is done using native functions, you need to familiarize yourself with the following...

 

  1. Download ilspy (free, i use this) or .net reflector and decompile the scripthookdotnet.asi and then review all classes and functions inside the GTA namespace. You can also use this program to decompile anyone's .net gta scripts. This will give u ideas from modders who are more familiar with GTA.
  2. Download the GTAIV and EFLC SCO scripts decompiled with OpenIV (julionib provided a link on one of these threads) and the use a text searching app (write one) to look for natives and you can see how R* uses them.
  3. Look here... http://www.gtamodding.com/index.php?title=List_of_native_functions
  4. The c++ scripthook header file also has many documented natives... http://code.google.com/p/gta4modding/source/browse/trunk/ScriptHook/Scripting.h?r=5
  5. More Natives here on another headerfile... http://code.google.com/p/gta4modding/source/browse/trunk/ScriptHook/ScriptingDirty.h?spec=svn5&r=5, the parameters are not reversed, but there are ways to figure out (guessing, looking at SCO or other people's code, reversing)

I see you asking mostly basic stuff u accomplish by just being aware of a native so i think this info will help new modders like yourself. BTW i found what you were looking for using ilspy...

 

8kaf.png

 

so u can even see the GTA native being used... GetTimeOfDay

 

But you wouldn't need to use the native since the maker of the scripthookdotnet already added for u to use... just call... World.CurrentDate (which is a DateTime object... google how to get the hour) ;)

Edited by LordOfTheBongs
Link to comment
Share on other sites

When i do int Date = World.CurrentDate, it says: Cannot implicitly convert type 'System.DateTime' to 'int/floatt/string'..

 

Sorry, am a new starting coder :D

Link to comment
Share on other sites

LordOfTheBongs

like i said... it is a DateTime object... google is your friend

 

google "C# dotnetperls DateTime"

Link to comment
Share on other sites

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
  • 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.