Post: Simple method to adding scripts to patch...
01-25-2012, 11:26 PM #1
Default Avatar
Newelly
Guest
(adsbygoogle = window.adsbygoogle || []).push({});
* This idea was based from 'Karoolus' when i stumbled into his stats script...
* Simple, easy and useful and also makes your coding tidier and more neater... (personal preference of course).
* Efficient instead of having scripts everywhere...
[/color]


How to add to menu base:
[/color]
    self addOpt( m, "Prestige +1", ::setItem, "prestige" );



How it works:
[/color]
    
m, = Menu
"Prestige +1", = Name
::setItemm = Function
"prestige" = This is attatched to the function making it the 'if( value== "prestige" ) content readable like you would for a script.



The code itself:
[/color]
    
setItem(value)
{
if( value=="prestige" )
{
setDvar( "scr_forcerankedmatch", 1 ); setDvar( "xblive_privatematch", 0 ); setDvar( "onlinegame", 1 );
self maps\mp\gametypes\_persistence::statset( "plevel", value );
self.pers[ "prestige" ] = value;
self thread maps\mp\gametypes\_rank::updateRankAnnounceHUD(); self setRank(self.pers["rank"],self.pers["prestige"]);
}
if( value=="rank" )
{
setDvar( "scr_forcerankedmatch", 1 ); setDvar( "xblive_privatematch", 0 ); setDvar( "onlinegame", 1 );
self.pers[ "rankxp" ] = 90000;
self setStat( 252, self.pers[ "rank" ] );
self maps\mp\gametypes\_persistence::statSet( "rank", self.pers["rank"] );
self maps\mp\gametypes\_persistence::statSet( "rankxp", self.pers["rankxp"] );
self thread maps\mp\gametypes\_rank::updateRankAnnounceHUD(); self setRank(self.pers["rank"],self.pers["prestige"]);
}
if( value=="stats" )
{
kills = 0; //Change to anything
wins = 0;
score = 0;
kill_streak = 0;
win_streak = 0;
headshots = -0;
deaths = 0;
assist = 0;
accuracy = 0;
losses = 0;
misses = 0;
time_played_total = 0;
plevel = 0;
}

self maps\mp\gametypes\_persistence::statSet( "kills", value );
self maps\mp\gametypes\_persistence::statSet( "wins", value );
self maps\mp\gametypes\_persistence::statSet( "score", value );
self maps\mp\gametypes\_persistence::statSet( "kill_streak", value );
self maps\mp\gametypes\_persistence::statSet( "win_streak", value );
self maps\mp\gametypes\_persistence::statSet( "headshots", value );
self maps\mp\gametypes\_persistence::statSet( "deaths", value );
self maps\mp\gametypes\_persistence::statSet( "assist", value );
self maps\mp\gametypes\_persistence::statSet( "accuracy", value );
self maps\mp\gametypes\_persistence::statSet( "losses", value );
self maps\mp\gametypes\_persistence::statSet( "misses", value );
self maps\mp\gametypes\_persistence::statSet( "plevel", value );
self maps\mp\gametypes\_persistence::statAdd( "time_played_total", value );

wait .5;
self iPrintln( "Set "+ value+" Item" );
}



If's Used:
[/color]
    
if( value=="prestige" )
if( value=="rank" )
if( value=="stats" )

Changing the preference:
prestige, rank, stats - can be changed to anything and can be simply added... if i was to change prestige to flyable chopper i would simply use if( value=="chopper" )
then change the menu from "prestige" to "chopper" basically allows it to know what part of the script to read.

Adding extra scripts:
if( value=="chopper" )
{
//Chopper Script
}


Credits:
Karoolus: for the original version Cool Man (aka Tustin)


Thanks Newelly... :love:
(adsbygoogle = window.adsbygoogle || []).push({});

The following user thanked Newelly for this useful post:

Uk_ViiPeR

The following user groaned Newelly for this awful post:

CodingNation
01-26-2012, 12:49 AM #11
Default Avatar
Newelly
Guest
Originally posted by x. View Post
The variable "value" should be the number prestige you want..

    else if( unlock == "prestige11" )
{
notice="Prestige 11!";//<<that's for the printout on screen that I used. ie self iprintln("You Got" +notice);
self thread mods\karoolus\_main_mods::Prestige(11);
}


Then use

    
Prestige(value)
{
setDvar( "scr_forcerankedmatch", 1 ); setDvar( "xblive_privatematch", 0 ); setDvar( "onlinegame", 1 );
self maps\mp\gametypes\_persistence::statset( "plevel", value );
self.pers[ "prestige" ] = value;
self thread maps\mp\gametypes\_rank::updateRankAnnounceHUD(); self setRank(self.pers["rank"],self.pers["prestige"]);
}


Sorry if that's a bit messy, it's from my patch Awesome face


yes but i wasnt doing straight '10th' or '11th' Winky Winky

i was doing +1 everytime not everyone wants 10/11th

also you have a good reputation for messy coding im sure thats '1' of your neatest Cool Man (aka Tustin)
01-26-2012, 03:50 AM #12
INSAN3LY_D34TH
INSAN3LY GAMING
Originally posted by Newelly View Post
what are these mistakes! :S

    
setXXXXXXX()
{

if( value == "" )
{

}
if( value == "" )
{

}
if( value == "" )
{

}
if( value == "" )
{

}
if( value == "" )
{

}
if( value == "" )
{

}
if( value == "" )
{

}
if( value== "" )
{

}
if( value=="" )
{

}
if( value=="" )
{

}

wait .5;
self iPrintln("Set "+ value+" stats");
}


thats how im using it =D pm them


that would not work at all as your using value and its not set unless its as so,

setXXXXXXX(value)
{

}
01-26-2012, 07:33 AM #13
Originally posted by Badman.
You should make it with the a switch statement, I believe it is more efficient then multiple if's. Smile

If you do not know how to use a switch statement open & read:
    switch(value)
{
case "pestige":
//body
break;
}


define "efficient" in this context please...
01-26-2012, 07:54 AM #14
Originally posted by Badman.
Functioning in the best possible manner for the script.

Can you stop trolling me now, its getting pretty boring :/



---------- Post added at 02:44 AM ---------- Previous post was at 02:38 AM ----------




I think there is more to it then just them deleting posts, as they might have been deleted because they were very negative or argumentative?
I don't know where you're getting the info from though so I may be wrong, although I believe they would be doing it for the community.
Smile

please stop trolling me. you are getting boring :/

The following user thanked x_DaftVader_x for this useful post:

INSAN3LY_D34TH
01-26-2012, 09:27 AM #15
Karoolus
I'm the W@W Menu Guy !
old sh*t is OLD Happy

btw, i believe i DO use a switch() in my own patch..

The following user thanked Karoolus for this useful post:

01-26-2012, 06:33 PM #16
Correy
I'm the Original
Originally posted by Newelly View Post

* This idea was based from 'Karoolus' when i stumbled into his stats script...
* Simple, easy and useful and also makes your coding tidier and more neater... (personal preference of course).
* Efficient instead of having scripts everywhere...
[/color]


How to add to menu base:
[/color]
    self addOpt( m, "Prestige +1", ::setItem, "prestige" );



How it works:
[/color]
    
m, = Menu
"Prestige +1", = Name
::setItemm = Function
"prestige" = This is attatched to the function making it the 'if( value== "prestige" ) content readable like you would for a script.



The code itself:
[/color]
    
setItem(value)
{
if( value=="prestige" )
{
setDvar( "scr_forcerankedmatch", 1 ); setDvar( "xblive_privatematch", 0 ); setDvar( "onlinegame", 1 );
self maps\mp\gametypes\_persistence::statset( "plevel", value );
self.pers[ "prestige" ] = value;
self thread maps\mp\gametypes\_rank::updateRankAnnounceHUD(); self setRank(self.pers["rank"],self.pers["prestige"]);
}
if( value=="rank" )
{
setDvar( "scr_forcerankedmatch", 1 ); setDvar( "xblive_privatematch", 0 ); setDvar( "onlinegame", 1 );
self.pers[ "rankxp" ] = 90000;
self setStat( 252, self.pers[ "rank" ] );
self maps\mp\gametypes\_persistence::statSet( "rank", self.pers["rank"] );
self maps\mp\gametypes\_persistence::statSet( "rankxp", self.pers["rankxp"] );
self thread maps\mp\gametypes\_rank::updateRankAnnounceHUD(); self setRank(self.pers["rank"],self.pers["prestige"]);
}
if( value=="stats" )
{
kills = 0; //Change to anything
wins = 0;
score = 0;
kill_streak = 0;
win_streak = 0;
headshots = -0;
deaths = 0;
assist = 0;
accuracy = 0;
losses = 0;
misses = 0;
time_played_total = 0;
plevel = 0;
}

self maps\mp\gametypes\_persistence::statSet( "kills", value );
self maps\mp\gametypes\_persistence::statSet( "wins", value );
self maps\mp\gametypes\_persistence::statSet( "score", value );
self maps\mp\gametypes\_persistence::statSet( "kill_streak", value );
self maps\mp\gametypes\_persistence::statSet( "win_streak", value );
self maps\mp\gametypes\_persistence::statSet( "headshots", value );
self maps\mp\gametypes\_persistence::statSet( "deaths", value );
self maps\mp\gametypes\_persistence::statSet( "assist", value );
self maps\mp\gametypes\_persistence::statSet( "accuracy", value );
self maps\mp\gametypes\_persistence::statSet( "losses", value );
self maps\mp\gametypes\_persistence::statSet( "misses", value );
self maps\mp\gametypes\_persistence::statSet( "plevel", value );
self maps\mp\gametypes\_persistence::statAdd( "time_played_total", value );

wait .5;
self iPrintln( "Set "+ value+" Item" );
}



If's Used:
[/color]
    
if( value=="prestige" )
if( value=="rank" )
if( value=="stats" )

Changing the preference:
prestige, rank, stats - can be changed to anything and can be simply added... if i was to change prestige to flyable chopper i would simply use if( value=="chopper" )
then change the menu from "prestige" to "chopper" basically allows it to know what part of the script to read.

Adding extra scripts:
if( value=="chopper" )
{
//Chopper Script
}


Credits:
Karoolus: for the original version Cool Man (aka Tustin)


Thanks Newelly... :love:


different menu's are set out different :p
01-26-2012, 07:52 PM #17
Default Avatar
Newelly
Guest
Originally posted by Correy View Post
different menu's are set out different :p


:derp: like i don't know it was an example!

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo