Log in to reply

[C#][Tutorial] Basics of creating a script PART 1

  • I am trying to create a script that detects that a vanilla mission has started. and get the name of that mission.
    Can't seem to find the correct functions calls to achieve that. Any help is appreciated.

  • @Amrovich Use GET_MISSION_FLAG to get whether there is an ongoing mission. To get the mission name, try using STAT_GET_INT with the stat name of SP_LAST_MISSION_NAME to get the hash of the mission, and use GET_STREET_NAME_FROM_HASH_KEY to get the mission name from the hash (the comments on this native say you can get mission names with it). Totally untested by me; I have no idea if this will work.

  • does not work for me Im pressing my num pad 1 which is what i assigned to spawn a ped and it wont work?

  • @zerzox Show your code, and make sure Num Lock is on.

  • @Jitnaught it worked after i put the scripthookvdotnet.dll into the game directory, am i supposed to do that?

  • @zerzox Yes.

  • @AHK1221
    nice job !

    im trying to mod an existing script but im a newbe
    I want to add a bigger Healtpoint list for mission maker
    to have stronger ped

    but there is an error ! :(

    ![alt text](0_1587019514141_33.PNG image url)

    ![alt text](0_1587019539439_11.PNG image url)

    ![alt text](0_1587019602948_22.PNG image url)

  • This post is deleted!

  • @ShadoFax said in [C#][Tutorial] Basics of creating a script PART 1:

    can someone pls help me with a something

    pls help me, i am learning the basics of scripting but how do i use one key to increase and a other one for decrease cuz i only know how to set something, example: key"1" for 1 star. key"2" for 2star etc
    how do i a key to increase in stead of using 1-2-3-4-5 per wanted star level, example:

    for increase wanted level press PageUp
    for decrease wanted level press PageDown
    How do i do this

    if(Game.Player.WantedLevel < 5) {Game.Player.WantedLevel += 1;}

    if(Game.Player.WantedLevel > 0) {Game.Player.WantedLevel -= 1;}

    += 1 will increase a number by 1.
    -= 1 will decrease a number by 1.

  • Thx

  • @ShadoFax

    on your script find "private void on key up"

    it looks like this

    private void OnKeyUp(object sender, KeyEventArgs e)
    if (e.KeyCode == Keys.K) //change the key to whaever you want//
    // do what ever you want here including increasing wanted level

  • @AHK1221 no, you should make your code excerpts stylized so it is reader friendly

  • For the line "UI.ShowSubtitle("You have no wanted level.");" I get an error saying "The name "UI" does not exist in the current context, that is the only problem. I couldnt find scripthookvdotnet so i used scripthookvdotnet3, so i am wondering if that is the problem or if it doesnt matter.

  • @trapx1 Its called scripthookvdotnet.asi i think??? wait no its not hmm or is it ;(

  • @trapx1 install nativeui, btw im not late ;)

  • @trapx1 With dotnet3 it became

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.