PDA

View Full Version : [CS:GO] Replace all chickens


Brrdy
03-09-2015, 12:01
new elchicken;
elchicken = GetEntPropEnt(chicken, Prop_Send, "models/chicken/chicken.mdl");
PrintToServer("Let There Be Life!");
SetEntityModel(elchicken, "models/player/ctm_sas_variantA.mdl");


I cant get it to work
Also I have tried SetEntityModel(chicken, "models/player/ctm_sas_variantA.mdl");

Mitchell
03-09-2015, 13:18
elchicken = GetEntPropEnt(chicken, Prop_Send, "models/chicken/chicken.mdl");
wut... you should do some reading of what GetEntProp actually does..
Use FindEntityByClassname (https://sm.alliedmods.net/api/index.php?fastload=show&id=43&)

Brrdy
03-09-2015, 13:30
elchicken = GetEntPropEnt(chicken, Prop_Send, "models/chicken/chicken.mdl");
wut... you should do some reading of what GetEntProp actually does..
Use FindEntityByClassname (https://sm.alliedmods.net/api/index.php?fastload=show&id=43&)

Sorry Im not at my house haha thank you Mitchell <3

Brrdy
03-09-2015, 13:46
FindEntityByClassname(startEnt, const String:classname[]); is the format so

elchicken = FindEntityByClassname(elchicken, chicken);

Or do I have to do something else?

Exolent[jNr]
03-09-2015, 14:10
You have to use that function to loop through all chicken entities.
Also, you need to specify quotes around the classname since it is a string, unless you have a variable chicken holding that string of "chicken".

Anyway, here is an example:
new entity = -1;

while ((entity = FindEntityByClassName(entity, "chicken")) > 0)
{
// Do something with entity
}

Brrdy
03-09-2015, 14:13
;2271725']You have to use that function to loop through all chicken entities.
Also, you need to specify quotes around the classname since it is a string, unless you have a variable chicken holding that string of "chicken".

Anyway, here is an example:
new entity = -1;

while ((entity = FindEntityByClassName(entity, "chicken")) > 0)
{
// Do something with entity
}

Aww I see okay thank you :P Ill make sure to comment you in if you want :P

Exolent[jNr]
03-09-2015, 14:15
Aww I see okay thank you :P Ill make sure to comment you in if you want :P

I do not require any credits. Just helping a fellow coder get better at scripting.

Brrdy
03-09-2015, 14:17
;2271730']I do not require any credits. Just helping a fellow coder get better at scripting.

Thank you ^_^ Surprisingly this is like the first thing I literally got stuck on :P I had an easier time working on super super hard velocity offset stuff xD
I guess it's just a brain fart :P

Mathias.
03-09-2015, 20:55
glow chicken snippet

public void OnEntityCreated(int entity, const char[] classname)
{
if (StrEqual(classname, "chicken", false))
SDKHook(entity, SDKHook_SpawnPost, OnChickenSpawn);
}

public void OnChickenSpawn(int entity)
{
SetEntProp(entity, Prop_Send, "m_bShouldGlow", true, 1);
}