Post: Installing codes in a patch
01-28-2011, 12:15 AM #1
CraZoY
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); Well I have this problem that I tried to do and failed. Well basically I wanted to put the random box code in but I got stuck to the part when Elitemossy say to put the self thread doRandomBox thing in somewhere that I dont know. Can some explain what is self thread and where to put it.

RANDOM WEAPON BOX
Simply call self thread CreateWepBox();

Code:

CreateWepBox()
{
T=self.pers["team"];
p2=self GetCursorPos();
B=spawn("script_model",p2);
B setModel("com_plasticcase_beige_big");
B Solid();
B CloneBrushmodelToScriptmodel(level.airDropCrateCollision);
W=spawn("script_model",p2);
W Solid();
RM=randomint(9999);
for(;Winky Winky
{
foreach(P in level.players)
{
wait 0.05;
if(P.pers["team"]!=T)continue;
D=distance(p2,P.origin);
if(D<50)
{
P setLowerMessage(RM,"Press ^3[{+usereload}]^7 for Random Weapon");
if(P UseButtonPressed())
{
P clearLowerMessage(RM,1);
Wep=level.weaponList[randomint(level.weaponList.size)];
W setModel(getWeaponModel(Wep));
W MoveTo(p2+(0,0,55),0.9);
wait 0.8;
if(P GetWeaponsListPrimaries().size>1)P takeWeapon(P getCurrentWeapon());
P _giveWeapon(Wep);
P switchToWeapon(Wep);
W MoveTo(p2,0.01);
:hitman:
(adsbygoogle = window.adsbygoogle || []).push({});
01-28-2011, 12:32 AM #2
xNiicademus
Bounty hunter
RANDOM WEAPON BOX
Simply call self thread CreateWepBox();


If you want to call the weapon box from a menu then it would look something like this
menu.function[1]=::CreateWepBox;

It depends on how the menu code was written in the patch you are using. Just look at the menu code and see where other threads (functions) are called. If you put the CreateWePBox() function in the same .gsc as the menu then it will be
::CreateWepBox;
If the function is located in another .gsc then calling it from the menu would need to include the path (unless you use #include at the top of the .gsc the menu is in.
with the path it would look something like this
menu.function[1]=maps\mp\killstreaks\flyableheli::CreateWepBox;

To use it as stated:
self thread CreateWepBox();

it would need to be called from another function. Such as, onPlayerSpawn()
then you would just add
self thread CreateWepBox(); in between the { and } in onPlayerSpawn() (sorry don't remember off hand if onPlayerSpawn is correct, it could be onPlayerSpawned() )

p.s. I'm not an expert so maybe someone with more experience in coding the patches can help you more.

The following user thanked xNiicademus for this useful post:

CraZoY

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo