| Master53 |
12-06-2010 14:58 |
Useful Stock(S) [Any Game]
these are just some useful stocks which i'v made and collected over time.
Special thanks to " McFlurry" for his weapon stocks
Added:
GetTeamCount to get the amount of clients in spesific team.
PHP Code:
static UserMsg:FadeID; static UserMsg:ShakeID;
stock SetEntityArmor(Client, Armor) {
//Set Prop Data: SetEntProp(Client, Prop_Data, "m_ArmorValue", Armor, 4); }
stock GetClientScore(Client) {
//Get Prop Data:: return GetEntProp(Client, Prop_Data, "m_iFrags"); }
stock SetClientScore(Client, score) {
//Set Prop Data: SetEntProp(Client, Prop_Data, "m_iFrags", score); }
stock HideHud(Client, Type) {
//Set Prop Data: SetEntProp(Client, Prop_Send, "m_iHideHUD", Type); }
stock SetClientDeath(Client, death) {
//Set Prop Data: SetEntProp(Client, Prop_Data, "m_iDeaths", death); }
stock GetClientDeath(Client) {
//Get Prop Data: return GetEntProp(Client, Prop_Data, "m_iDeaths"); }
stock SetEntityTimeScale(Client, Float:fSpeed) {
//Set Prop Data: SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", fSpeed); }
stock SetEntityMaxSpeed(Client, Float:Speed) {
//Declare: new SpeedOffset = -1;
//Initialize: SpeedOffset = FindSendPropOffs("CBasePlayer", "m_flMaxspeed");
//Set Speed: if(SpeedOffset > 0) SetEntData(Client, SpeedOffset, Speed, 4, true); }
stock SetEntitySkin(entity, Skin:skin) {
//Set Prop Send: SetEntProp(entity, Prop_Send, "m_nSkin", skin); }
stock GetClientConVar(Client, const String:Name[], String:Value[64]) {
//Get Client Convar Value: QueryClientConVar(Client, Name, ConVarQueryFinished:ClientConVar, Client);
//Initialize: Value = ConVarValue[Client];
//Return: return Value }
stock bool:IsAdmin(Client) {
//Declare: new Admin = GetUserFlagBits(Client);
//Not Admin: if(Admin != 0) {
//Return: return true; }
//Return: return false; }
stock GetTotalClients() {
//Declare: new count = 0;
//Loop: for(new X = 1; X <= GetMaxClients(); X++) {
//Connected: if(IsClientConnected(X) && IsClientInGame(X)) {
//Initialize: count++; } }
//Return: return count; }
stock GetTeamCount(Team) {
//Declare: new count = 0;
//Loop: for(new X = 1; i <= GetMaxClients(); i++) {
//Connected: if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == Team) {
//Initialize: count++; } }
//Return: return count; }
//Get Weapon Count: stock GetClientWeaponCount(Client) { //Declare: new count = 0;
//Loop: for(new i = 0; i <= 10; i++) {
//Declare: new wep = GetPlayerWeaponSlot(Client, i);
//Has Weapon: if(wep != -1) {
//Initialize: count++; } }
//Return: return count; }
//shake effect stock Shake(Client, Float:Length, Float:Severity) {
//Conntected: if(IsClientConnected(Client) && IsClientInGame(Client)) {
//User Messages: ShakeID = GetUserMessageId("Shake");
//Declare: new SendClient[2]; SendClient[0] = Client;
//Handle: new Handle:ViewMessage = StartMessageEx(ShakeID, SendClient, 1);
//Write Handle: BfWriteByte(ViewMessage, 0); BfWriteFloat(ViewMessage, Severity); BfWriteFloat(ViewMessage, 10.0); BfWriteFloat(ViewMessage, Length);
//Close: EndMessage(); } }
public FadeClient(Client, bool:out) {
//Conntected: if(IsClientConnected(Client) && IsClientInGame(Client)) {
//User Messages: FadeID = GetUserMessageId("Fade");
//Declare new SendClient[2]; SendClient[0] = Client;
//Handle: new Handle:ViewMessage = StartMessageEx(FadeID, SendClient, 1);
//Write Handle: BfWriteShort(ViewMessage, 3000); //fade time BfWriteShort(ViewMessage, 0); //hold time if (out) {
//Out and Stayout BfWriteShort(ViewMessage, 0x0002|0x0008); }
//Override: else {
//In Ignore Other Fades BfWriteShort(ViewMessage, 0x0001|0x0010); }
//Red BfWriteByte(ViewMessage, 25);
//Green BfWriteByte(ViewMessage, 0);
//Blue BfWriteByte(ViewMessage, 0);
//Alpha BfWriteByte(ViewMessage, 250);
//Cloose: EndMessage(); } }
//Bipass Cheats: stock CheatCommand(Client, const String:command[], const String:arguments[]) {
//Connected: if(IsClientConnected(Client) && IsClientInGame(Client)) {
//Define: new admindata = GetUserFlagBits(Client);
//Set Client Flag Bits: SetUserFlagBits(Client, ADMFLAG_ROOT);
//Define: new flags = GetCommandFlags(command);
//Set Client Flags: SetCommandFlags(command, flags & ~FCVAR_CHEAT);
//Command: ClientCommand(Client, "\"%s\" \"%s\"", command, arguments);
//Set Client Flags: SetCommandFlags(command, flags);
//Set Client Flag Bits: SetUserFlagBits(Client, admindata); }
//Return: return; }
//Stop Sound from all Channels: stock StopSoundPerm(Client, String:sound[]) {
//Stop Sound: StopSound(Client, SNDCHAN_AUTO, sound); StopSound(Client, SNDCHAN_WEAPON, sound); StopSound(Client, SNDCHAN_VOICE, sound); StopSound(Client, SNDCHAN_ITEM, sound); StopSound(Client, SNDCHAN_BODY, sound); StopSound(Client, SNDCHAN_STREAM, sound); StopSound(Client, SNDCHAN_VOICE_BASE, sound); StopSound(Client, SNDCHAN_USER_BASE, sound); }
|