Tutorial [NOOBS] "How to GSC"

Harry

Certified Sick ℂunt
Premium Member
Messages
1,263
Reaction score
969
Points
973
sorry ive just sterted this.....where do i put new functions for the mods...say i want to add unlimited ammo...do i go to the botton of the script and the add it or do i have to add it to a specific place in the script
Anywhere if fine. I do recommend the bottom, as long as you DO NOT BREAK A FUNCTION:

Normal:
Function1()
{
call("Call");
}

Function2()
{
Call("call");
}



Broken (DO NOT DO THIS)

Function1()
{
Call(I);
Function2()
{
Call(I);
}
}
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Hey I need help on this part:
First, we want to make it so when the game ends, we still want to walk around, and before the game starts!
Go to main.gsc and find menuinit()
Find his line and delete it:
bVXqjkJ.png

Now we can move about after the game has ended :smile:
Now find 'onplayerspawned()' and add the following code where I have highlighted it:

Code:
freezecontrols(false);
Vrzzhi6.png


So at the first little box do I delete 'level endon("Game_ended");' or not because when I delete that and add the 'freezecontrols(false);'
When I try to start up a game my PS3 freezes...
 

The Dark Side

Former Staff Member
Messages
1,007
Reaction score
784
Points
993
Hey I need help on this part:
First, we want to make it so when the game ends, we still want to walk around, and before the game starts!
Go to main.gsc and find menuinit()
Find his line and delete it:
bVXqjkJ.png

Now we can move about after the game has ended :smile:
Now find 'onplayerspawned()' and add the following code where I have highlighted it:

Code:
freezecontrols(false);
Vrzzhi6.png


So at the first little box do I delete 'level endon("Game_ended");' or not because when I delete that and add the 'freezecontrols(false);'
When I try to start up a game my PS3 freezes...
Okay first of all you gotta define who is getting their controls unfrozen. self freezecontrols(false);?
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Okay first of all you gotta define who is getting their controls unfrozen. self freezecontrols(false);?
<3 That worked :smile: Would you be able to explain where to add the function codes like:
self enableInvulnerability(); // On
self disableInvulnerability(); // Off
^I'm not really sure where to put those since the instructions weren't that clear.
 

The Dark Side

Former Staff Member
Messages
1,007
Reaction score
784
Points
993
Just use a variable.

Code:
ToggleGod() //Call it like ::Togglegod
{
    if(self.God==0) //Variable for the toggle.
    {
        self iPrintln("God Mode [^2ON^7]"); //Message telling you you turned it on.
        self enableInvulnerability(); //The actual godmode.
        self.God=1; //Setting variable to true, or 1.
    }
    else
    {
        self iPrintln("God Mode [^1OFF^7]"); //Message telling you you turned it off.
        self disableInvulnerability(); //Godmode OFF
        self.God=0; // Switching the variable back too 0. Or false.
    }
}

Now you could be pretty biased about this code here. Technically the "right way" to do it would be something like...

Code:
godmode_toggle()
{
    if(!isDefined(self.God) || !self.God)
        self EnableInvulnerability();
    else
        self DisableInvulnerability();

    self.God = !self.God;
    self iPrintLn("Godmode " + self.God ? "Enabled" : "Disabled");
}

But since you're just starting out, you know. First one seems more simple. :tonguewink:
 
Last edited:

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Just use a variable.

Code:
ToggleGod() //Call it like ::Togglegod
{
    if(self.God==0) //Variable for the toggle.
    {
        self iPrintln("God Mode [^2ON^7]"); //Message telling you you turned it on.
        self enableInvulnerability(); //The actual godmode.
        self.God=1; //Setting variable to true, or 1.
    }
    else
    {
        self iPrintln("God Mode [^1OFF^7]"); //Message telling you you turned it off.
        self disableInvulnerability(); //Godmode OFF
        self.God=0; // Switching the variable back too 0. Or false.
    }
}

Now you could be pretty biased about this code here. Technically the "right way" to do it would be something like...

Code:
godmode_toggle()
{
    if(!isDefined(self.God) || !self.God)
        self EnableInvulnerability();
    else
        self DisableInvulnerability();

    self.God = !self.God;
    self iPrintLn("Godmode " + self.God ? "Enabled" : "Disabled");
}

But since you're just starting out, you know. First one seems more simple. :tonguewink:
Thanks a lot that helped, do you know the code for models I know:

self setModel( "model" );

But how would I set that out?
 

Syndicate

Modder
Messages
671
Reaction score
551
Points
908
Just use a variable.

Code:
ToggleGod() //Call it like ::Togglegod
{
    if(self.God==0) //Variable for the toggle.
    {
        self iPrintln("God Mode [^2ON^7]"); //Message telling you you turned it on.
        self enableInvulnerability(); //The actual godmode.
        self.God=1; //Setting variable to true, or 1.
    }
    else
    {
        self iPrintln("God Mode [^1OFF^7]"); //Message telling you you turned it off.
        self disableInvulnerability(); //Godmode OFF
        self.God=0; // Switching the variable back too 0. Or false.
    }
}

Now you could be pretty biased about this code here. Technically the "right way" to do it would be something like...

Code:
godmode_toggle()
{
    if(!isDefined(self.God) || !self.God)
        self EnableInvulnerability();
    else
        self DisableInvulnerability();

    self.God = !self.God;
    self iPrintLn("Godmode " + self.God ? "Enabled" : "Disabled");
}

But since you're just starting out, you know. First one seems more simple. :tonguewink:
some swag coding bro
 

Harry

Certified Sick ℂunt
Premium Member
Messages
1,263
Reaction score
969
Points
973
Thanks a lot that helped, do you know the code for models I know:

self setModel( "model" );

But how would I set that out?
Precache the model in 'init()' FIRST:

Code:
init()
{
    self blah();
    self moreblah();
    precachemodel("ModelName");//Add this here and change model name to the desired model. There are model threads elsewhere)
}
Now make a function like this:
Code:
ChangeModel(Model)
{
    self setmodel(model);
    self iPrintln(model);
}

And call it like this:
Code:
self add_option("Menu Name", "Option Name", ::ChangeModel, "ModelName");

Have a try and tell me what happens ^.^
Model Thread Here:
You do not have permission to view link Log in or register now.


KNOW WHAT THEY ARE BEFORE USING AS SOME MIGHT CRASH/FREEZE
 
Last edited by a moderator:

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Precache the model in 'init()' FIRST:

Code:
init()
{
    self blah();
    self moreblah();
    precachemodel("ModelName");//Add this here and change model name to the desired model. There are model threads elsewhere)
}
Now make a function like this:
Code:
ChangeModel(Model)
{
    self setmodel(model);
    self iPrintln(model);
}

And call it like this:
Code:
self add_option("Menu Name", "Option Name", ::ChangeModel, "ModelName");

Have a try and tell me what happens ^.^
Model Thread Here:
You do not have permission to view link Log in or register now.


KNOW WHAT THEY ARE BEFORE USING AS SOME MIGHT CRASH/FREEZE
Yeah works thanks, also is there something like that to make a weapons menu because I don't know how to make that.
 

Harry

Certified Sick ℂunt
Premium Member
Messages
1,263
Reaction score
969
Points
973
Yeah works thanks, also is there something like that to make a weapons menu because I don't know how to make that.
This is how to replace the current weapon your holding:
Code:
BG_GivePlayerWeapon(weapon)
{
    weap = self getCurrentWeapon();
    self takeWeapon(self getCurrentWeapon());
    self giveWeapon(weapon,0,true(45,0,0,0,0));
    self switchToWeapon(weapon);
    self giveMaxAmmo(weapon);
    self iPrintln("^7"+weapon+" Given");
}

Some cool things,
here:
self giveWeapon(weapon,0,true(45,0,0,0,0));
where it says '45', you can change that to any of the camo codes (0 = default skin)
Camos:
Code:
    self add_option("Default_C", "None", ::SetCamo, 0);
    self add_option("Default_C", "DEVGRU", ::SetCamo, 1);
    self add_option("Default_C", "ERDL", ::SetCamo, 3);
    self add_option("Default_C", "Siberia", ::SetCamo, 4);
    self add_option("Default_C", "Choco", ::SetCamo, 5);
    self add_option("Default_C", "Blue Tiger", ::SetCamo, 6);
    self add_option("Default_C", "Bloodshot", ::SetCamo, 7);
    self add_option("Default_C", "Delta 6", ::SetCamo, 8);
    self add_option("Default_C", "Typhon", ::SetCamo, 9);
    self add_option("Default_C", "Carbon Fiber", ::SetCamo, 10);
    self add_option("Default_C", "Cherry Blossom", ::SetCamo, 11);
    self add_option("Default_C", "Art of War", ::SetCamo, 12);
    self add_option("Default_C", "Ronin", ::SetCamo, 13);
    self add_option("Default_C", "Skulls", ::SetCamo, 14);
    self add_option("Default_C", "Gold", ::SetCamo, 15);       
    self add_option("Default_C", "Diamond", ::SetCamo, 16);

    self add_option("DLC_C", "Jungle Warfare", ::SetCamo, 19);
    self add_option("DLC_C", "Benjamins", ::SetCamo, 21);
    self add_option("DLC_C", "Die De Muertos", ::SetCamo, 22);
    self add_option("DLC_C", "Graffiti", ::SetCamo, 23);
    self add_option("DLC_C", "Kawaii", ::SetCamo, 24);
    self add_option("DLC_C", "Party Rock", ::SetCamo, 25);
    self add_option("DLC_C", "Zombies", ::SetCamo, 26);
    self add_option("DLC_C", "Bacon", ::SetCamo, 28);
    self add_option("DLC_C", "Cyborg", ::SetCamo, 31);
    self add_option("DLC_C", "Dragon", ::SetCamo, 32);
    self add_option("DLC_C", "Aqua", ::SetCamo, 34);
    self add_option("DLC_C", "Breach", ::SetCamo, 35);
    self add_option("DLC_C", "Coyote", ::SetCamo, 36);
    self add_option("DLC_C", "Glam", ::SetCamo, 37);
    self add_option("DLC_C", "Rogue", ::SetCamo, 38);
 
    self add_option("DLC2_C", "UK Punk", ::SetCamo, 20);
    self add_option("DLC2_C", "Paladin", ::SetCamo, 30);
    self add_option("DLC2_C", "Comics", ::SetCamo, 33);
    self add_option("DLC2_C", "Afterlife", ::SetCamo, 44);
    self add_option("DLC2_C", "Dead Man's Hand", ::SetCamo, 40);
    self add_option("DLC2_C", "Beast", ::SetCamo, 41);
    self add_option("DLC2_C", "Octance", ::SetCamo, 42);
    self add_option("DLC2_C", "Weaponized 115", ::SetCamo, 43);
   
   
 
    self add_option("Collect_C", "Elite Member", ::SetCamo, 17);
    self add_option("Collect_C", "CE Digital", ::SetCamo, 18);
    self add_option("Collect_C", "Ghosts Camo", ::SetCamo, 29);
    self add_option("Collect_C", "Advanced Warfare", ::SetCamo, 45);

JUST USE THE NUMBERS AT THE VERY END.

Weapon Codes:
MP:
You do not have permission to view link Log in or register now.

ZM:
You do not have permission to view link Log in or register now.


How to call them:
Code:
self add_option("SubMenu", "OptionName", ::bg_giveplayerweapon, "WeaponCode");
 

Harry

Certified Sick ℂunt
Premium Member
Messages
1,263
Reaction score
969
Points
973
@CabCon i want to remove this because it's been done on the site already plus this is a bad tutorial for new learners
And it got re-opened already. So quit trying.
And its only 'bad' for you because you're -sniped-.
 
Last edited by a moderator:

Harry

Certified Sick ℂunt
Premium Member
Messages
1,263
Reaction score
969
Points
973
@CabCon i want to remove this because it's been done on the site already plus this is a bad tutorial for new learners
Let me clear this up for you.
I made this thread to help new new new new coders. So people like yourself that were 1337 CoDeRs by day 1 would think this is obvious. New people don't.

I've used this thread as a tutorial to help people countless times and it's works just fine.

It's been re-opened.
As it doesn't break any of the CCM ToS or posting rules, there's is absolutely no reason for it to be closed or dis-regarded. If you disagree, you are more than welcome to copy and paste this thread into another thread and delete that one.

Thanks :grinning:
 

iTahhr

Well-Known Member
Messages
248
Reaction score
119
Points
243
Let me clear this up for you.
I made this thread to help new new new new coders. So people like yourself that were 1337 CoDeRs by day 1 would think this is obvious. New people don't.

I've used this thread as a tutorial to help people countless times and it's works just fine.

It's been re-opened.
As it doesn't break any of the CCM ToS or posting rules, there's is absolutely no reason for it to be closed or dis-regarded. If you disagree, you are more than welcome to copy and paste this thread into another thread and delete that one.

Thanks :smile:
let me make myself clear for u THIS TUT HAS ALREADY BEEN MADE ON THE SITE HENSE WHY I WANT TO DELETE IT
 
Top