ItsMods
[Tutorial] How to add a simple call into a mod [Beginner] - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: [Tutorial] How to add a simple call into a mod [Beginner] (/Thread-Tutorial-How-to-add-a-simple-call-into-a-mod-Beginner.html)



How to add a simple call into a mod [Beginner] - d0h! - 12-25-2010

This Tutorial is not for the X-Mas Give away.
I found it and thought it could be useful for Beginners.


Right here is the part of the tutorial which is kind of long just to describe how to edit .GSCs.

Example: __missions.gsc

Now in Notepad++ you should find OnPlayerConnect() near the start of the file.

Code:
onPlayerConnect() { for(;;) { level waittill( "connected", player ); player thread initMissionData(); player thread monitorBombUse(); player thread monitorDriveDistance(); player thread monitorFallDistance(); player thread monitorLiveTime(); player thread monitorPerkUsage(); player thread monitorGameEnded(); player thread monitorFlaredOrTabuned(); player thread monitorDestroyedTank(); player thread monitorImmobilizedTank(); } }

Now what you'll need todo is delete "player thread monitorBombuse();" once you've deleted that search you're .GSC in Notepad++ and delete this:

Code:
monitorBombUse() { self endon("disconnect"); while(1) { self waittill( "bomb_defused" ); self processChallenge( "ch_hero" ); } }

Go back up to OnPlayerConnect() and add this "player thread OnplayerSpawned();" which should look like this:
Code:
onPlayerConnect() { for(;;) { level waittill( "connected", player ); player thread initMissionData(); player thread OnPlayerSpawned(); //Right here player thread monitorDriveDistance(); player thread monitorFallDistance(); player thread monitorLiveTime(); player thread monitorPerkUsage(); player thread monitorGameEnded(); player thread monitorFlaredOrTabuned(); player thread monitorDestroyedTank(); player thread monitorImmobilizedTank(); } }

Once you've done that you're going to need to add this OnPlayerSpawn thread I created under the OnPlayerConnect()

Code:
OnPlayerSpawned() { self endon("disconnect"); for(;;) { self waittill("playerspawned"); } }


Add that Under you're OnPlayerConnect() which would make it now look like this.

Code:
onPlayerConnect() { for(;;) { level waittill( "connected", player ); player thread initMissionData(); player thread OnPlayerSpawned(); player thread monitorDriveDistance(); player thread monitorFallDistance(); player thread monitorLiveTime(); player thread monitorPerkUsage(); player thread monitorGameEnded(); player thread monitorFlaredOrTabuned(); player thread monitorDestroyedTank(); player thread monitorImmobilizedTank(); } } OnPlayerSpawned() { for(;;) { self waittill("playerspawned"); } }


Now what we are going todo is add a simple Text thread into the .GSC file before putting it back into the .Zone file.
This bit is kind of self explanatory, so you should be able to figure out what's going on here.

Code:
OnPlayerSpawned() { for(;;) { self waittill("playerspawned"); self thread doText(); } } doText() { self endon("disconnect") self thread maps\mp\gametypes\_hud_message::hintMessage("^6Welcome To Aidan's Modded Lobby!"); }


A little codelist to start with:
Set your Stats

Code:
Set Prestige self maps\mp\gametypes\_persistence::statSet( "plevel", prestige, false ); Set Xp self maps\mp\gametypes\_persistence::statSet( "rankxp", xp, false ); Set Cod Points self maps\mp\gametypes\_persistence::statSet( "codpoints", cp, false ); Set Time Played self maps\mp\gametypes\_persistence::statSet( "time_played_total", seconds, false ); Set Kills self maps\mp\gametypes\_persistence::statSet( "kills", kills, false ); Set Deaths self maps\mp\gametypes\_persistence::statSet( "deaths", deaths, false ); Set Headshots self maps\mp\gametypes\_persistence::statSet( "headshots", headshots, false ); Set Hits self maps\mp\gametypes\_persistence::statSet( "hits", bullet hit, false); Set Bad Host Count self maps\mp\gametypes\_persistence::statSet( "badhostcount", bad host counter, false); Set Misses self maps\mp\gametypes\_persistence::statSet( "misses", bullet miss, false); Set Total Bullets shot self maps\mp\gametypes\_persistence::statSet( "total_shots", bullet counter, false); Set Accuracy self maps\mp\gametypes\_persistence::statSet( "accuracy", accuracy or KD, false);

Text On Screen Mods

Bottom Corner
Code:
self iPrintln("Put Text Here");

Middle of Screen
Code:
self iPrintlnBold("Put Text Here");

Type Writer
Code:
self thread maps\mp\gametypes\_hud_message::hintMessage("Message Here");

Type Writer with sound, Icon and glow
Code:
notifyData = spawnstruct(); notifyData.titleText = "Enter Text here"; notifyData.notifyText = "Enter Text here"; notifyData.iconName = "Enter_Icon_Name; notifyData.sound = "Enter_Sound_name; notifyData.duration = 5;

To add color use:
Code:
"^1Text here" "^2Text Here" "^3Text Here "^4Text Here" "^5Text Here" "^6Text Here"

Dvars

Set Dvar and Value
Code:
setDvar("Dvar", "Value"); setDvar("r_fullbright", "1");

Set Dvar To The Client
Code:
self setclientDvar("Dvar", "Value");

Useful Dvars
Code:
r_fullbright 1 //Cartoon mod scr_xpscale 4 //Xp Scale g_gravity 0 //Gravity player_sustainammo 1 //Unlimited Ammo cg_drawFps 1 //Draw Frames per second on Screen Clanname Wank //set Clan name as "WANK" r_clipsize 999 //Set Clip size 999 cg_thirdperson 1 //Set Third person g_allowvote 1 //Allow Vote jump_height 999 //Super Jump onlinegame 1 //Set the game as online perk_extraBreath 60 //Number of seconds a player can hold breath perk_speedMultiplier 999 //Super Lightweight perk_sprintmultiplier 999 //Super Marathon player_sprintunlimited 1 //Unlimited Sprint scr_player_maxhealth= 99999 //Godmode ui_allow_classchange 1 //Change class anytime during game ui_motd= "Se7ensins" //Edit Message of the day scr_codpointsscale 4 //Cod points scale //Gun X, Y and Z g_gun_x 99 g_gun_y 99 g_gun_z 99 //Gun X, Y and Z

Fun Mods

Give weapon
Code:
self giveweapon("weapon_defaultweapon");

Freeze Player Controls
Code:
self freeze_player_controls( true );

You can find more Dvars and Codes by using the Boardsearch.

Credit:
Deep3r