ItsMods

Full Version: Basic self thread Tutorial
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
A basic self thread Tutorial.

This tutorial is for those who are just starting and have read This or This

Let's start:
so you've made a mod that give's you a gun onplayerspawned
like this
Code:
onPlayerSpawned()
{
    self endon("disconnect");

    for(;;)
    {
        self waittill("spawned_player");
                                self giveWeapon ( "famas_dualclip_mp", 0, false );
    
    }
}
and maybe you've added a perk in aswell ie
Code:
self setPerk("specialty_Lightweight");
but sometime's this can get messy so to make life easyer we are going to make a thread for all our weapon's and perk's insted, so to start we add one called Myguns in onPlayerSpawned() like so
Code:
onPlayerSpawned()
{
    self endon("disconnect");

    for(;;)
    {
        self waittill("spawned_player");

        self thread Myguns();
    
    }
}
then at the bottom of the .gsc file is our thread
Code:
Myguns()
{
    self Takeallweapons();
    self giveWeapon ( "famas_dualclip_mp", 0, false );
    self giveWeapon ( "willy_pete_mp", 0, false );
    self giveWeapon ( "frag_grenade_mp", 0, false );
    self switchToWeapon( "famas_dualclip_mp" );
    self clearPerks();
   self setPerk("specialty_Lightweight");
}
and thats the basics of a self thread, hope this help's someone xD
credit's: iAegle for helping a noob Smile
Reputation +1.
Good stuff man!
thanks guys wasnt sure if i should , glad i did
lol simple but helpful +1
yep simple is what i'm aiming for , i shall relese a nother tut soon hopefuly linking in to this one sweet,short and simple
(03-30-2011, 15:48)rotceh_dnih Wrote: [ -> ]yep simple is what i'm aiming for , i shall relese a nother tut soon hopefuly linking in to this one sweet,short and simple

maybe u should add whats the difference between level thread and self thread
Quote:maybe u should add whats the difference between level thread and self thread
i would like to but not sure that i understand it myself is this right,
a level thread would be place in init() and is used for changeing map items ie cp map's or fx in map ???
and self threads are for yourself,you,the player onconnect or spawned??

im not sure i will add it in and give credit if someone can explain it in laymans terms xD

(04-01-2011, 04:11)rotceh_dnih Wrote: [ -> ]
Quote:maybe u should add whats the difference between level thread and self thread
i would like to but not sure that i understand it myself is this right,
a level thread would be place in init() and is used for changeing map items ie cp map's or fx in map ???
and self threads are for yourself,you,the player onconnect or spawned??

im not sure i will add it in and give credit if someone can explain it in laymans terms xD

well prety much but OnPlayerConnect() you would use player thread. The only time you would use self thread is in when they joined team or spawned

and level thread init() use to create HUDs etc or making a zombie timer.
that is what i know so far. Im no hud master like iAegle
How do you find rank.gsc file....or do you create one?
Blush
Pages: 1 2