09-18-2011, 12:24
Hello,
This is a random tutorial about some random functions.
First of all, some precaching commands, they need to go in Init() and will allow you to use different parametres in your mods:
There are a few more, but those are enough. Now Ill explain the command PlayFXonTag, it will play a certain FX in a model tag.
Example: this will play a FX called level.omafx on your head.
If you want to stop the FX from previous example use this:
You can also play a FX on tag on a certain player
Now, how to set a perk or unset it
This is a command to change player speed:
Now Ill explain the use of the command GetPersStat, this command what it does is to take a player stadistics such as the number of assists, kills or headshots. You use it like this:
self GetPersStat("stat");
Example of headshots, this could be a aimbotter kicker example:
The kick command I used in previous example works like this:
The GetEntityNumber() command what it does is to take a certain player id, like when you take them with console. Ill explain now a physics command, this one is perfect to make gravity objects.
Example:
Now a command that is really useless, is only good to annoy players, it makes a certain player get EMPed, with false you make the EMP effects stop
Now Ill explain how to play Loop sounds and how to stop them, this is a sound that will repeat all the time until you stop it:
This is a random thing I found once while editing weapons, this are weapons that IW was going to add in MW2
This is a command that allows you to fade in a shellshock, it makes the shellshock like weaker.
While looking through game code I found this different csv info commands, they already brought a info that IW left there. In BO you can use them more, in MW2 you dont need any kind of command like this.
There is also a better way to give many dvars, they will reduce your code lenght:
I cant remember very well, but I think that setDvars works like this too
Now some HUD Info, this are the different game fonts you can use:
Now the positions in screen of HUD
In X:
In Y:
In alignx you can find all this:
In aligny you can find all this:
Thats all,
This is a random tutorial about some random functions.
First of all, some precaching commands, they need to go in Init() and will allow you to use different parametres in your mods:
Code:
PrecacheTurret("turretname");
PrecacheModel("modelname");
PrecacheShader("shadername");
PrecacheMiniMapIcon("minimapiconname");
PrecacheVehicle("vehiclename"); //forget about this one, all vehicles in MP are already precached
PrecacheMenu("menuname");
PrecacheItem("itemname"); //forget about this one too
PrecacheShellShock("shellshockname");
PrecacheRumble("rumblename");
There are a few more, but those are enough. Now Ill explain the command PlayFXonTag, it will play a certain FX in a model tag.
Code:
FX = PlayFXonTag(effect name, model, tag to play effect on);
Example: this will play a FX called level.omafx on your head.
Code:
FX = PlayFXonTag(level.omafx,self,"j_head");
If you want to stop the FX from previous example use this:
Code:
FX = StopFXonTag(level.omafx,self,"j_head");
You can also play a FX on tag on a certain player
Code:
FX = PlayFXonTagForClients(level.omafx,self,"j_head",level.players[1]);
Now, how to set a perk or unset it
Code:
self _setperk("perkname");
self _unsetperk("perkname");
This is a command to change player speed:
Code:
self SetMoveSpeedScale(speed);
Now Ill explain the use of the command GetPersStat, this command what it does is to take a player stadistics such as the number of assists, kills or headshots. You use it like this:
self GetPersStat("stat");
Example of headshots, this could be a aimbotter kicker example:
Code:
if(self GetPersStat("headshots") > 10)
{
kick(self GetEntityNumber(),"PLATFORM_STEAM_KICK_CHEAT");
}
The kick command I used in previous example works like this:
Code:
kick(player,message);
The GetEntityNumber() command what it does is to take a certain player id, like when you take them with console. Ill explain now a physics command, this one is perfect to make gravity objects.
Code:
model PhysicsLaunchServer(vector,origin);
Example:
Code:
OMA PhysicsLaunchServer((0,0,0),self.origin); //this one will make the object fall, it will interact with world
Now a command that is really useless, is only good to annoy players, it makes a certain player get EMPed, with false you make the EMP effects stop
Code:
self SetEMPJammed(true);
Now Ill explain how to play Loop sounds and how to stop them, this is a sound that will repeat all the time until you stop it:
Code:
thing PlayLoopSound(sound);
thing StopLoopSound(sound); //to stop it
This is a random thing I found once while editing weapons, this are weapons that IW was going to add in MW2
Code:
[spoiler]WEAPON_MP44
WEAPON_RAPPEL_KNIFE
WEAPON_MP5_SILENCER
WEAPON_MAC10
WEAPON_G36C
WEAPON_M14
WEAPON_WINCHESTER1200
WEAPON_SAW
WEAPON_AW50
WEAPON_AG36
WEAPON_HK79
WEAPON_EGLM
WEAPON_M21_SOCOM
WEAPON_BINOCULARS
WEAPON_G3_SILENCER
WEAPON_AK74U_ACOG
WEAPON_UMP45_BURST
WEAPON_ANACONDA_SILENCER
WEAPON_ICE_AXE
WEAPON_AA12SP_HB_SILENCER
WEAPON_SCAR_ROF
WEAPON_G36_LMG
WEAPON_AUG_SCOPE
WEAPON_M14EBR
WEAPON_P90_HEARTBEAT
WEAPON_M79_BOOM
WEAPON_RPG_BLING[/spoiler]
This is a command that allows you to fade in a shellshock, it makes the shellshock like weaker.
Code:
self FadeOutShellShock();
While looking through game code I found this different csv info commands, they already brought a info that IW left there. In BO you can use them more, in MW2 you dont need any kind of command like this.
Code:
tableLookup( filename, searchColumnNum, searchValue, returnValueColumnNum )
tableLookupByRow( filename, rowNum, returnValueColumnNum )
tableLookupRowNum( filename, searchColumnNum, searchValue )
There is also a better way to give many dvars, they will reduce your code lenght:
Code:
self SetClientDvars("dvar1",dvar1 value,"dvar2",dvar2 value,"dvar3",dvar3 value, etc);
I cant remember very well, but I think that setDvars works like this too
Spoiler (Click to View)
Code:
default
objective
bigfixed
smallfixed
Now the positions in screen of HUD
In X:
Code:
Left Center Right
In Y:
Code:
Top
Middle
Bottom
In alignx you can find all this:
Code:
subleft
left
center
right
fullscreen
noscale
alignto640
center_safearea
In aligny you can find all this:
Code:
subtop
top
middle
bottom
fullscreen
noscale
alignto480
center_safearea
Thats all,