Toranks
Active member
If any player spawn an entity with spawngun script, and inside that entity I use the following line:
"playerindex" always return 0 (first player), instead of the parent player. How can it be solved?
Spawngun script:
Code:
void plyr = getentityproperty(self, "playerindex");
Spawngun script:
Code:
void spawnGun5(void Name, float dx, float dy, float dz, int Num, void Ani)
{ // Spawn gun with ani animation, store it and bind it
void self = getlocalvar("self");
void Spawn;
Spawn = spawn01(Name, dx, dy, 0);
setentityvar(self, Num, Spawn); // Stores spawned gun to be killed later
bindentity(Spawn, self, dx, dz, dy, 0, 0); // Bind spawned gun
performattack(Spawn, openborconstant(Ani));
}