Author |
Topic: Give Money... My script does not work... |
scillman |
|
General Member Since: Nov 23, 2006 Posts: 360 Last: Sep 1, 2012 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Friday, Jan. 13, 2012 09:24 pm |
|
BraX writes...Quote:
@scillman
isLookingAt( ) is buit-in function and works only with trigger_lookat entities.
Good to know for next time ;). |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
|
liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Friday, Jan. 13, 2012 10:05 pm |
|
serthy writes...Quote: i might be wrong, but ive tested isLookingAt() once and it worked in MP as well as expected
yes it works for MP but its not 100% accurate thats why you will see alot of people using bullettrace instead. |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Saturday, Jan. 14, 2012 08:16 am |
|
serthy writes...Quote: i might be wrong, but ive tested isLookingAt() once and it worked in MP as well as expected
I was always under the impression that it DIDN'T work in COD2 MP. It works in COD4 MP, but in COD2 MP we had to write our own MP version of it, which went into our _utils.gsc files. This is one from Admiral mod:
Code:
IsLookingAt( gameEntity )
{
entityPos = gameEntity.origin;
playerPos = self getEye();
entityPosAngles = vectorToAngles( entityPos - playerPos );
entityPosForward = anglesToForward( entityPosAngles );
playerPosAngles = self getPlayerAngles();
playerPosForward = anglesToForward( playerPosAngles );
newDot = vectorDot( entityPosForward, playerPosForward );
if( newDot < 0.72 )
return false;
else
return true;
}
I might be wrong, or more than likely, Brax is correct that you have to be looking at a trigger with _lookat attached to it. |
|
|
|
Dobriy |
General Member Since: Mar 31, 2011 Posts: 96 Last: May 23, 2012 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Saturday, Jan. 14, 2012 09:27 am |
|
No no no BraX,IzNoGoD,Tally
Code: isLookingAt( )
Works in call of duty 2 it it is checked up personally by me, and many other people
It is a script which I used personally, time considerable quantity back, I do not know whose he, therefore I can not credit him:
Code: switch(response)
{
case "money50":
if(self.money >= 50)
{
players = getentarray("player", "classname");
aimedplayer = undefined;
for(x=0;x < players.size;x++)
{
if(self islookingat(players[x]))
{
self.spent +=50;
players[x].spent -=50;
aimedplayer = players[x];
}
}
if(isDefined(aimedplayer))
{
self iprintlnbold("^7You ^4Transfer money^1" + aimedplayer.name);
aimedplayer iprintlnbold("^7You ^4transferred the money^1" + self.name);
wait 3;
self iprintlnbold("^7Вы ^4перевели деньги^1" + aimedplayer.name);
aimedplayer iprintlnbold("^7Вам ^4перевел деньги^1" + self.name);
}
else
{
self iprintln("^7Move the target ^4on the current who want ^1to transfer money");
wait 3;
self iprintln("^7Наведите прицел ^4на того кому хотите ^1перевести деньги");
}
}
if(self.money < 50)
{
self iprintlnbold("^7You do ^4not have enough ^1money");
}
break;
}
sorry for:
Code: self iprintln("^7Наведите прицел ^4на того кому хотите ^1перевести деньги");
This is my main language,forum does not support it :DDD
edited on Jan. 14, 2012 02:33 am by Dobriy |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Saturday, Jan. 14, 2012 11:20 am |
|
Yep, it does work. I did this test on some bots:
Code: SelfTest()
{
if( demon\_bots::IsBot( self ) ) return;
for( ;; )
{
players = getEntArray( "player", "classname" );
if( isDefined( players ) )
for( i=0; i < players.size; i++ )
{
player = players[i];
if( self isLookingAt( player ) )
self iprintlnBold( "test" );
}
wait( 0.05 );
}
}
And it worked: when I didn't look at any bots, I got nothing; when I looked at any bot at a distance of about <= 80 units, I got the test iprintlnbold.
I have never had recourse to use isLookingAt() in COD2 before, so I wasn't sure. I have been scripting for over 8 years now, and only ever used the function once in COD4. I always prefer a distance check. |
|
|
|
liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Saturday, Jan. 14, 2012 08:20 pm |
|
liltc64 writes...Quote: serthy writes...Quote: i might be wrong, but ive tested isLookingAt() once and it worked in MP as well as expected
yes it works for MP but its not 100% accurate thats why you will see alot of people using bullettrace instead. |
|
|
|
Moretti |
General Member Since: Oct 11, 2011 Posts: 3 Last: Jan 20, 2012 [view latest posts] |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
|