lindsayslorach Posted December 10, 2010 Share Posted December 10, 2010 Hey guys, I was going through my .NET ScriptHook scripts, and I saw this "functions" script I had started, it's just some functions I thought would make scripting easier. I'll post them, and I was wondering if anyone could make some more? Vehicle functions: void ForceCar(Vehicle vCar, Vector3 vDirection, Vector3 vRotation, bool bRelative){ if (Exists(vCar)) { if (bRelative) { vCar.ApplyForceRelative(vDirection, vRotation); } else { vCar.ApplyForce(vDirection, vRotation); } }} Ped functions: void ForceAimedPed(Vector3 vDirection, Vector3 vRotation, bool bRelavite){ Ped pTagetedPed = Player.GetTargetedPed(); if (Exists(pTagetedPed)) { if (pTagetedPed.isAlive) { if (bRelavite) { pTagetedPed.ApplyForceRelative(vDirection, vRotation); } else { pTagetedPed.ApplyForce(vDirection, vRotation); } } }}void RagdollAimedPed(){ Ped pAimedPed = Player.GetTargetedPed(); if (Exists(pAimedPed)) { if (pAimedPed.isAlive) { if (!pAimedPed.isRagdoll) { pAimedPed.isRagdoll = true; } } }} Other Funtions: void PrintToScreenAndConsole(String sText){ Game.DisplayText(sText); Game.Console.Print(sText);}Vector3 toVector3(float X, float Y, float Z){ Vector3 vec = new Vector3(); vec.X = X; vec.Y = Y; vec.Z = Z; return vec;}Color customColor(byte R, byte G, byte B){ string sR = R.ToString("X2"); string sG = G.ToString("X2"); string sB = B.ToString("X2"); string sFinal = string.Format("#{0}{1}{2}", sR, sG, sB); return ColorTranslator.FromHtml(sFinal);} Havn't tested them all, I just wanted to get this thread started to see what other people come up with. Please contribute Link to comment Share on other sites More sharing options...
a-k-t-w Posted December 10, 2010 Share Posted December 10, 2010 public void HelloWorld(){Game.DisplayText("Hello, World!");} Very important function I think everyone should use. Edit: Oh, and thanks for making this thread. You reminded me that there was a .net script hook, Ima get coding right away. Link to comment Share on other sites More sharing options...
HazardX Posted December 12, 2010 Share Posted December 12, 2010 Thanks for sharing. Just to let you know: The functions toVector3 and customColor are possible by default: Vector3 v = new Vector3(X, Y, Z); Color c = Color.FromArgb(R, G, B); Link to comment Share on other sites More sharing options...
lindsayslorach Posted December 12, 2010 Author Share Posted December 12, 2010 Ahh, thanks HazardX, I started these a while ago when I started coding for the scripthook, didn't really know much about the built in functions, thanks! Link to comment Share on other sites More sharing options...
Tinman1287 Posted January 20, 2011 Share Posted January 20, 2011 Does anyone have any other functions? This is somethings that is relevant to my interests. Link to comment Share on other sites More sharing options...
lindsayslorach Posted January 20, 2011 Author Share Posted January 20, 2011 Hey guys, howcome no one has been posting in here? I thought there would be more activity. Anyway, i've been using this function for a little while now, and it's been more a learning experience than a // This funtion prints to the game console with the text "DEBUG" and which method called it.private void DebugPrint(string msg){ string myCaller = new StackFrame(1).GetMethod().Name; Game.Console.Print("DEBUG (" + myCaller + "): " + msg);} I know it's only one, but thats for now. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now