What's new

Solved Scripting Help Needed!

R

Rede

Enthusiast
Messages
255
Reaction score
36
Ok so i'm in need of help on how to script, I have been watching videos on how to "C" with some programs. I know how to to convert .c to .sco. But, I just want to create some personal simple scripts.

So, basically I want to create scripts to do a few things, but unfortunately I can't really do so, because I don't know the "source codes" to do so. I have been on Cosy's post, and read his codes as well as others. But, I still can't figure out how to implement them in a .c or .sco. As I think you create a script first with a .c and them convert the file to .sco.


If anyone, can help me over TeamViewer and or Skype, that would be greatly appreciated!


Thanks!
 
Z

NayJames123

Read Art
Messages
4,273
Reaction score
3,475
just copy this base into a c file, then add functions into it in the void functions(void)
Code:
#include <natives.h>
#include <common.h>
#include <types.h>
#include <consts.h>
bool isplayerinvincible = false;//needed to toggle invincibility
void functions(void)//add mods here
{
 //example script to toggle godmode on pressing I
 if(IS_GAME_KEYBOARD_KEY_JUST_PRESSED(KEY_I))
  {
  isplayerinvincible = !isplayerinvincible; //toggles the boolean
  if (isplayerinvincible)
   {
   SET_CHAR_INVINCIBLE(GetPlayerPed(), true);
   PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "You are now invincible", 2500, 1);
   }
   else
   {
   SET_CHAR_INVINCIBLE(GetPlayerPed(), false);
   PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "You are no longer invincible", 2500, 1);
   }
  }
}
 
void main(void)
{
THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
while(1)
{
functions();
WAIT(0);
}
}
 
R

Rede

Enthusiast
Messages
255
Reaction score
36
just copy this base into a c file, then add functions into it in the void functions(void)
Code:
#include <natives.h>
#include <common.h>
#include <types.h>
#include <consts.h>
bool isplayerinvincible = false;//needed to toggle invincibility
void functions(void)//add mods here
{
//example script to toggle godmode on pressing I
if(IS_GAME_KEYBOARD_KEY_JUST_PRESSED(KEY_I))
  {
  isplayerinvincible = !isplayerinvincible; //toggles the boolean
  if (isplayerinvincible)
  {
  SET_CHAR_INVINCIBLE(GetPlayerPed(), true);
  PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "You are now invincible", 2500, 1);
  }
  else
  {
  SET_CHAR_INVINCIBLE(GetPlayerPed(), false);
  PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "You are no longer invincible", 2500, 1);
  }
  }
}
 
void main(void)
{
THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
while(1)
{
functions();
WAIT(0);
}
}



Ok, can I use any program to use this? IE Code block?
 
Z

NayJames123

Read Art
Messages
4,273
Reaction score
3,475
you can, but i just use notepad++ and set it to c language to give you syntax highlighting, its much simpler in there
 
R

Rede

Enthusiast
Messages
255
Reaction score
36
you can, but i just use notepad++ and set it to c language to give you syntax highlighting, its much simpler in there
Right, that's what I wanted to use. Great, thanks! Also, fairly new to all this scripting stuff. So, is it possible you can join the convo that I started? please? thanks.
 
R

Rede

Enthusiast
Messages
255
Reaction score
36
Can anyone help me with this? I have learned a little bit more from, Three-socks. I'm just needing the extra help on how to actually implement void functions. Thanks!
 
R

Rede

Enthusiast
Messages
255
Reaction score
36
Bump, please help! I only need to know how to add the functions. Thanks!
 
Top Bottom