AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set tricky origin for 2 ents (https://forums.alliedmods.net/showthread.php?t=250306)

avril-lavigne 10-21-2014 21:03

set tricky origin for 2 ents
 
PHP Code:

                          new ent = -1,count                         
                          
while((ent find_ent_by_class(entmedalclass)))
                          {
                                if(
owner(ent) != id) continue
                
                                new 
FloatplayerOrigin];
                                
pevidpev_originplayerOrigin ); 
                   
                                
count++
                                
playerOrigin] += 45.0;
                                if(
count++ > 1)  playerOrigin] += 85.0    // xample
                 
                            // how to change origin for FIRST ent (which += 45 we set before)
                 
                                
engfuncEngFunc_SetOriginplayerBarplayerOrigin );              
                          } 

What I want If he has 2 ents I want change origin for BOTH, previous and current


PHP Code:

if(count == 1playerOrigin] += 45.0;
if(
count == 2)
{
   
// SET FIRST ENT TO
    
playerOrigin] -= 20.0;
    
playerOrigin] += 45.0;

    
// SET SECOND ENT TO
  
    
playerOrigin] += 20.0;
    
playerOrigin] += 45.0;



its stupid to find first ent id again after loop end ......

RateX 10-22-2014 01:29

Re: set tricky origin for 2 ents
 
What about a global var?

claudiuhks 10-22-2014 10:12

Re: set tricky origin for 2 ents
 
No idea what you're trying do to.
Plus, you don't even check whether or not the entity's owner is in-game (is_user_connected), or out of range (< 1 or > maxPlayers).

hleV 10-23-2014 08:10

Re: set tricky origin for 2 ents
 
PHP Code:

new firstEnt find_ent_by_class(...);
// Get firstEnt origin.

for (ent find_ent_by_class(...))
{
    
// Set ent origin.
    // Set firstEnt origin.



avril-lavigne 10-23-2014 10:18

Re: set tricky origin for 2 ents
 
edit

http://s019.radikal.ru/i632/1410/03/2dd3543e352b.png

they both calculated in prethink
Im getting position of player [0] += 45.0
then put spr first and scond time -30 left.

I cant change first sprite position because set origin set it first always


All times are GMT -4. The time now is 17:36.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.