Post: Save Space In Your Patch
02-01-2011, 04:42 PM #1
d7w7z
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({}); Quite a few people will already know about this but this is for the people who dont know. Smile

Almost anything with brackets that you have to repeat alot can be made shorter which means less space is used = profit? :carling:

Here is one example from my patch.
    txt(var) { self iPrintln(var);}


Basicly var gets replaced by what ever you want. So if you have the above in your patch you can do
    txt("Hello");


Instead of having to put
    self iPrintln("Hello");



Doesnt look like it saves much space but when you do it with a few different things and throughout your whole patch it can make a big difference.

Here is a list of some that I use with an example. Smile
    
txt(var) { self iPrintln(var);}
// txt("Message"); *Killfeed text*

txt2(var) { self iPrintlnBold(var);}
// txt2("Message"); *text in the middle of your screen*

doDvar(var,val){self setClientDvar(var,val);}
// doDvar( "g_gravity", "20" ); *Infections*

NPC(N, C){self notifyOnPlayerCommand( N, C );}
// NPC( "dpad_up", "+actionslot 1" ); *Binds*

GivePerk(var) { self maps\mp\perks\_perks::givePerk("specialty_"+var); }
// GivePerk("marathon"); *Give perks*

GiveKS(var){ self maps\mp\killstreaks\_killstreaks::giveKillstreak(var,false); }
// GiveKS("uav"); *Give Killstreaks*

SN(var) { self notify(var);}
// SN("StopGodMode"); *Stop Things*



Here is some posted that people may find useful ( Credits to x_DaftVader_x )
    
sa(Val) { self setPlayerAngles(self.angles + (Val)); }
// sa(0, 180, 270); *Changes players angles*

iP(text) { self iprintlnbold(text); }
// iP("Message"); *Killfeed text*

w(V) { wait(V); }
// w(0.1); *Waits so many seconds 1 = 1 second ect*

ms(text) { self thread maps\mp\gametypes\_hud_message::hintMessage(text); }
// ms("Message"); *Text in the middle of your screen*

dD(var, val) { self setClientDvar(var, val); }
// dD( "g_gravity", "20" ); *Infections*

sD(var, val) { setDvar(var, val); }
// sD("party_connectTimeout",1000); *Temp Infections*

CU(n,t){self notifyOnPlayerCommand(n,t);}
shi(t) { self notify(t);}
// Added because of the 1337 names... xD



Credits to TheUnkn0wn for doDvar and for giving me the idea to make more!

NOTE - you cannot use this for self endon

These are just examples. k thx bye Dancing

More Advanced Usage

So you can use this to make a massive reduction is the size of your coding.

I'll Just explain what I know from my short time of coding.

This is best used for things that have a lot of repeating, e.g Text.

The Letters get replaced by your input which you can later use to change small parts of the coding while keeping the main structure.
    Test( C ) 
{
if (C==1) { txt("Hey Honey"); }
else if (C==2) { txt( "GTFO" ); }
}


If I was to do
    
doMessage()
{
Test( 1 )
}


C is replaced by 1.
So the if (C==1){ is like saying if (1==1) { because we have replaced C with 1.

Thats about the best I can do to explain it to you, Be Creative!

Heres an example from my patch. Its for magic bullets
    MagicBullets( bull )
{
self endon ( "death" );
self endon ( "StopMagicBullets" );
self notify ("StopExplosives");
for (;Winky Winky {
self waittill( "weapon_fired" );
MagicBullet( bull, self getTagOrigin("tag_eye"), self GetCursorPos(), self );
wait 0.2;
} }


Then I can just do something like
    MagicBullets( "at4_mp" );


Which means that because bull has been replaced by "at4_mp"
    MagicBullet( bull, self getTagOrigin("tag_eye"), self GetCursorPos(), self );

Is now
    MagicBullet( "at4_mp", self getTagOrigin("tag_eye"), self GetCursorPos(), self );
(adsbygoogle = window.adsbygoogle || []).push({});

The following 4 users say thank you to d7w7z for this useful post:

Blackstorm, DEREKTROTTER, dogyplop, iJokaa
02-01-2011, 04:49 PM #2
Default Avatar
Newelly
Guest
Thanks..

True What They Say I Suppose 'You Learn Something New Everyday'
Your Becoming A Very Big Help In Hand For Ngu..
Especially For Me And Some Beginners To GSC Coding.. And C++

//Peace
//Newelly
02-01-2011, 04:57 PM #3
Originally posted by d7w7z View Post
Quite a few people will already know about this but this is for the people who dont know. Smile

Almost anything with brackets that you have to repeat alot can be made shorter which means less space is used = profit? :carling:

Here is one example from my patch.
    txt(var) { self iPrintln(var);}


Basicly var gets replaced what ever you want. So if you have the above in your patch you can do
    txt("Hello");


Instead of having to put
    self iPrintln("Hello");



Doesnt look like it saves much space but when you do it with a few different things and throughout your whole patch it can make a big difference.

Here is a list of some that I use with an example. Smile
    
txt(var) { self iPrintln(var);}
// txt("Message"); *Killfeed text*

txt2(var) { self iPrintlnBold(var);}
// txt2("Message"); *text in the middle of your screen*

doDvar(var,val){self setClientDvar(var,val);}
// doDvar( "g_gravity", "20" ); *Infections*

NPC(N, C){self notifyOnPlayerCommand( N, C );}
// NPC( "dpad_up", "+actionslot 1" ); *Binds*

GivePerk(var) { self maps\mp\perks\_perks::givePerk("specialty_"+var); }
// GivePerk("marathon"); *Give perks*

GiveKS(var){ self maps\mp\killstreaks\_killstreaks::giveKillstreak(var,false); }
// GiveKS("uav"); *Give Killstreaks*

SN(var) { self notify(var);}
// SN("StopGodMode"); *Stop Things*



Credits to TheUnkn0wn for doDvar and for giving me the idea to make more!

NOTE - you cannot use this for self endon

These are just examples. k thx bye Dancing



Heres a couple ive been using for a while. Its a pain when you post codes though and have to change them all :(

    sa(Val) {
self setPlayerAngles(self.angles + (Val));
}
iP(text) {
self iprintlnbold(text);
}
w(V) {
wait(V);
}
ms(text) {
self thread maps\mp\gametypes\_hud_message::hintMessage(text);

dD(var, val) {
self setClientDvar(var, val);
}
sD(var, val) {
setDvar(var, val);


Example:

    SBs() {
self endon("disconnect");
while (1) {
sa(0, 0, 90);
self VisionSetNakedForPlayer("default", .1);
self PlaySound("nuke_wave");
w(0.1);
sa(0, 90, 180);
w(0.1);
sa(0, 180, 270);
w(0.1);
sa(0, 90, 0);
w(0.1);
sa(0, 180, 270);
w(0.1);
sa(0, 0, 180);
w(0.1);
sa(0, 90, 90);
self PlaySound("nuke_wave");
w(0.1);
sa(0, 180, 0);
w(0.1);
}
}
02-01-2011, 05:01 PM #4
d7w7z
Bounty hunter
Originally posted by Newelly View Post

Your Becoming A Very Big Help In Hand For Ngu..

Thanks. Smile

---------- Post added at 05:01 PM ---------- Previous post was at 04:58 PM ----------

Originally posted by x View Post
Heres a couple ive been using for a while. Its a pain when you post codes though and have to change them all :(


I'll Add the ones I dont have to the OP. I seem to release a lot of things people have but didnt release. :whistle:
02-01-2011, 05:04 PM #5
Originally posted by d7w7z View Post
Thanks. Smile

---------- Post added at 05:01 PM ---------- Previous post was at 04:58 PM ----------



I'll Add the ones I dont have to the OP. I seem to release a lot of things people have but didnt release. :whistle:


Well, we don't give everthing away do we Smile

You should try and explain that these are "variables" because I get quite a few messages from people who don't understand them ...

The following user thanked x_DaftVader_x for this useful post:

02-01-2011, 05:07 PM #6
Default Avatar
haa
Guest
thanks lot
02-01-2011, 05:14 PM #7
Default Avatar
Newelly
Guest
Originally posted by x View Post
Well, we don't give everthing away do we Smile

You should try and explain that these are "variables" because I get quite a few messages from people who don't understand them ...


Like Me Happy
02-01-2011, 05:19 PM #8
iJokaa
Haters Keep Me Going Winky Winky
Originally posted by d7w7z View Post
k thx bye Dancing


ha that bit made me laugh Happy
02-01-2011, 05:22 PM #9
EliteMossy
TheDigitalBoard.com
Originally posted by d7w7z View Post
Quite a few people will already know about this but this is for the people who dont know. Smile

Almost anything with brackets that you have to repeat alot can be made shorter which means less space is used = profit? :carling:

Here is one example from my patch.
    txt(var) { self iPrintln(var);}


Basicly var gets replaced by what ever you want. So if you have the above in your patch you can do
    txt("Hello");


Instead of having to put
    self iPrintln("Hello");



Doesnt look like it saves much space but when you do it with a few different things and throughout your whole patch it can make a big difference.

Here is a list of some that I use with an example. Smile
    
txt(var) { self iPrintln(var);}
// txt("Message"); *Killfeed text*

txt2(var) { self iPrintlnBold(var);}
// txt2("Message"); *text in the middle of your screen*

doDvar(var,val){self setClientDvar(var,val);}
// doDvar( "g_gravity", "20" ); *Infections*

NPC(N, C){self notifyOnPlayerCommand( N, C );}
// NPC( "dpad_up", "+actionslot 1" ); *Binds*

GivePerk(var) { self maps\mp\perks\_perks::givePerk("specialty_"+var); }
// GivePerk("marathon"); *Give perks*

GiveKS(var){ self maps\mp\killstreaks\_killstreaks::giveKillstreak(var,false); }
// GiveKS("uav"); *Give Killstreaks*

SN(var) { self notify(var);}
// SN("StopGodMode"); *Stop Things*



Here is some posted that people may find useful ( Credits to x_DaftVader_x )
    
sa(Val) { self setPlayerAngles(self.angles + (Val)); }
// sa(0, 180, 270); *Changes players angles*

iP(text) { self iprintlnbold(text); }
// iP("Message"); *Killfeed text*

w(V) { wait(V); }
// w(0.1); *Waits so many seconds 1 = 1 second ect*

ms(text) { self thread maps\mp\gametypes\_hud_message::hintMessage(text); }
// ms("Message"); *Text in the middle of your screen*

dD(var, val) { self setClientDvar(var, val); }
// dD( "g_gravity", "20" ); *Infections*

sD(var, val) { setDvar(var, val); }
// sD("party_connectTimeout",1000); *Temp Infections*



Credits to TheUnkn0wn for doDvar and for giving me the idea to make more!

NOTE - you cannot use this for self endon

These are just examples. k thx bye Dancing


Similar to how i did it in my Private Patch Winky Winky

---------- Post added at 12:22 PM ---------- Previous post was at 12:20 PM ----------

It is a shame i have not released my PPv2, you could have seen how advanced the coding is, and how i fit so much into the patch, without loosing any functionality in the game.

The following user thanked EliteMossy for this useful post:

jonnyman69
02-01-2011, 05:25 PM #10
d7w7z
Bounty hunter
Originally posted by x View Post
Well, we don't give everthing away do we Smile

You should try and explain that these are "variables" because I get quite a few messages from people who don't understand them ...

Haha, I would have I wasnt sure what they were called. I just learned from looking at Mossys Coloured class names in his v8 :whistle:

---------- Post added at 05:25 PM ---------- Previous post was at 05:23 PM ----------

Originally posted by TheEliteMossy View Post
It is a shame i have not released my PPv2, you could have seen how advanced the coding is, and how i fit so much into the patch, without loosing any functionality in the game.

You'll release it some day and then I'll see Happy

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo