The Hazardous Realm
The Hazardous Realm
READ ONLY MODE

The forum is now in read-only mode! It's only kept around for informative purposes and to prevent deadlinks!
Use e-mail to contact me instead. Any announcements would be made on my twitter account and any discussions would use some public platform instead.

Need help with GTA IV scripthook

Discussions about gaming in general.

Need help with GTA IV scripthook

by VDH-SOFT » 27 Apr 2013 12:25

Hey,

I need some help with making mods for GTA IV. I want to make help messages that can be appear in the left upper corner of the screen. Also LCPDFR are using this help messages with their own text in it. I don't know how to make one, can you help? Also i need help with saving booleans/integers in a mod. e.g. i = 20 and you press ALT+X then there must be a sub that saves the integer or boolean, any idea? (and when you debug the mod again, it will overwrite the saved value, so not with application settgins.)

I need help with this 2 things.'

regards,

VDH-SOFT.
VDH-SOFT
 

Re: Need help with GTA IV scripthook

by Hazard » 27 Apr 2013 20:00

Hey, i didn't test it, but this script should draw a box in the top left corner with text in it:


using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using GTA;

namespace ExampleScripts {
public class TextInBoxExample : Script {

public TextureDrawingExample() {
PerFrameDrawing += new GTA.GraphicsEventHandler(TextureDrawingExample_PerFrameDrawing);
}

private void TextureDrawingExample_PerFrameDrawing(object sender, GTA.GraphicsEventArgs e) {
var g = e.Graphics;
g.Scaling = FontScaling.ScreenUnits;
// we use ScreenUnits, so 0.1 means width and height are both 10% of the screen.
var rect = new RectangleF(0f, 0f, 0.1f, 0.1f);
// draw base rectangle in white with 50% transparency
g.DrawRectangle(rect, Color.FromArgb(128, 255, 255, 255));
g.DrawText("Hey, this is the text that should appear inside the box!", rect,
TextAlignment.Top | TextAlignment.Left, Color.Black);
}

}
}


I'm not exactly sure what you want to know with your second question. What do you want to do exactly? Do you want to save values to disk to access them the next time you play, or do you want to save them to disk for testing purposes or something like that?

BTW: You'll have to register on the forum to reply, because guests can't write in the forum. But the forum is for discussions like these, while the blog comments are really just for comments on the blog.
Hazard
Hazardous Code Monkey
 
Posts: 187
Joined: 05 Jan 2006 19:49


Return to General Gaming Discussion