Raised This Month: $ Target: $400
 0% 

NC-Laser code snippet


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 07-15-2012 , 11:33   NC-Laser code snippet
Reply With Quote #1

Spoiler


I attached the working code (all ct's have lasersight, easy changable)
Attached Files
File Type: sma Get Plugin or Get Source (NC-Lasers.sma - 441 views - 2.9 KB)
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 10-27-2012 at 16:45.
striker07 is offline
CS-A-Roland
Member
Join Date: Jul 2009
Old 07-15-2012 , 12:45   Re: NC-Laser code snippet
Reply With Quote #2

Never use buggy code!!! Use existing working code...
In this Nightcrawler script it is an item, this could be the reason why it dont work for you..

try this here, it is exactly what you need ->>> Laser Sight
__________________
oOOOoooh it's www.Cs-Attack.de
New World of Warcraft Mod Beta 0.5(based on WC3FT 3.5)
Counterstrike 1.6 SERVER:
Server IP: 193.192.58.154:27200

CONDITION ZERO SERVER:
Server IP: 193.192.58.154:27016
CS-A-Roland is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 07-15-2012 , 13:34   Re: NC-Laser code snippet
Reply With Quote #3

I have that one, it fails to have my purposes.
The Nightcrawler laser fits my needs perfect with minor modifictations, I just removed the boolean that makes it an item to not make it an item

and I fail to see the buggy code, thats why i asked help ;)
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 07-15-2012 at 13:36.
striker07 is offline
CS-A-Roland
Member
Join Date: Jul 2009
Old 07-15-2012 , 13:42   Re: NC-Laser code snippet
Reply With Quote #4

the buggy code is there, that this laser just the "best" the "first" and the "last" player became... But it dont work as it should!
If the players connect and the item menu pops up, they got it all...
if they turn later to another item then its disabled for "this time", but if you take a weapon of a teammate wich have it you got both items...

dont understand me wrong, if you wan to use it, do it but you should know it dont works like it should so there can come complications later if the server iss full maybe!
I also looking for this problem, because it should work in the right way... without any bugs

By the way... i think you have not all what you need...
Code:
        enum _:ItemsInfo
        {
            ITEM_LASER, // Done
            ITEM_SUICIDE, // Done
            ITEM_POISON, // Done
            ITEM_ADRENALINE, // Done
            ITEM_MEDKIT // Done
        };

//and later.....

g_hItemsMenu = menu_create( "Choose an Item:", "ItemsMenu_Handler" );
        
        for( new i = 0; i < ItemsInfo; i++ )
        {
            num_to_str( i, szInfo, charsmax( szInfo ) );
            
            if( i == ITEM_LASER )
            {
                menu_additem( g_hItemsMenu, g_szItemNames[ i ], szInfo, _, menu_makecallback( "LaserItem_Callback" ) );
            }
            
            else menu_additem( g_hItemsMenu, g_szItemNames[ i ], szInfo );
        }
    }    
    
    public LaserItem_Callback( id, hMenu, iItem )
    {
        if( g_iCurrentRound == 0 )
            return ITEM_DISABLED;
            
        new iFrags = get_user_frags( id );
        new iDeaths = get_user_deaths( id );

        new iPlayerFrags;
        
        new iPlayers[ 32 ], iNum;
        get_players( iPlayers, iNum, "ae", "CT" );
        
        if( iNum == 1 )
            return ITEM_DISABLED;
            
        for( new i = 0, iPlayer; i < iNum; i++ )
        {
            iPlayer = iPlayers[ i ];
            
            if( !is_user_alive( iPlayer ) || iPlayer == id )
                continue;
                
            iPlayerFrags = get_user_frags( iPlayer );
            
            if( iPlayerFrags > iFrags )
                return ITEM_DISABLED;
                
            else if( iPlayerFrags == iFrags )
            {
                if( get_user_deaths( iPlayer ) < iDeaths )
                    return ITEM_DISABLED;
            }
        }
        
        return ITEM_ENABLED;
        
    }
Look at the "Laser" functions and lock them out of the item menu if you dont want use items... but dont ask me how, i'm new at this...
__________________
oOOOoooh it's www.Cs-Attack.de
New World of Warcraft Mod Beta 0.5(based on WC3FT 3.5)
Counterstrike 1.6 SERVER:
Server IP: 193.192.58.154:27200

CONDITION ZERO SERVER:
Server IP: 193.192.58.154:27016

Last edited by CS-A-Roland; 07-15-2012 at 13:52.
CS-A-Roland is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 07-15-2012 , 16:13   Re: NC-Laser code snippet
Reply With Quote #5

that's what i did, in client prethink, what you see is the function what is giving you the lasers so in my case everybody of ct team should have the laser so i removed the boolean that became true once you choosed the item in nc. this way i removed it as an item and made it always active for the ct team

for the bug, thats a bug in the coding of the nc mod but not in the part that i took.
also this snippet comes out of the nc_new sma so i'm not sure if that version has that bug too
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]
striker07 is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-15-2012 , 18:57   Re: NC-Laser code snippet
Reply With Quote #6

Put this line:
PHP Code:
g_iLaserSprite precache_modelg_szLaserSprite ); 
into a function called public plugin_precache()

so it'd be

PHP Code:

public plugin_precache()
{
     
g_iLaserSprite precache_modelg_szLaserSprite );

See if that works.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 07-16-2012 , 07:49   Re: NC-Laser code snippet
Reply With Quote #7

omg unbelievable that that was the problem :s i use plugin init allot to precache and this is the first time this happend any way thx nikhil, it works now but i got one more question

is it possible to fix this problem? (lasers don't start out of the weapon but from you're body)=>
http://img12.**************/img12/897/2012071600001.jpg

this happens mostly with pistol I havent spotted this bug with primary weapons, any idea's what might cause this? i had the same problem with the lasersight plugin but thne for all weapons
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 07-16-2012 at 07:51.
striker07 is offline
CS-A-Roland
Member
Join Date: Jul 2009
Old 07-16-2012 , 09:05   Re: NC-Laser code snippet
Reply With Quote #8

Mhm, i have the problem too but not so often in the nc script...
If i take a look at both versions (yours and the lasersight orginal) there are 2 differences

First the orginal:
Code:
if(get_pcvar_num(ls_line) != 0)
    {
      write_byte (TE_BEAMENTPOINT)
      write_short(id | 0x1000)
      write_coord (e[0])
      write_coord (e[1])
      write_coord (e[2])
    }
    else
    {
      write_byte (0)
      write_coord (e[0] + 1)
      write_coord (e[1] + 1)
      write_coord (e[2] + 1)
      write_coord (e[0] - 1)
      write_coord (e[1] - 1)
      write_coord (e[2] - 1)
    }
    
    write_short(sprite)
    write_byte (0)                              
    write_byte (10)                             
    write_byte (1)
    write_byte (5)                           
    write_byte (0)
here yours
Code:
write_byte( TE_BEAMENTPOINT );
   write_short( id | 0x1000 );
   write_coord( iOrigin[ 0 ] );
   write_coord( iOrigin[ 1 ] );
   write_coord( iOrigin[ 2 ] );
   write_short( g_iLaserSprite );
   write_byte( 1 );
   write_byte( 10 );
   write_byte( 1 );
   write_byte( 5 );
   write_byte( 0 );
The difference maybe can the bug on the original plugin and also there you can find the reason i think how to fix. I hope it help to find it out!
for explanation, i think the bug is in the original harder because there will use an else every time there is something not "clear" or "wrong" ...
__________________
oOOOoooh it's www.Cs-Attack.de
New World of Warcraft Mod Beta 0.5(based on WC3FT 3.5)
Counterstrike 1.6 SERVER:
Server IP: 193.192.58.154:27200

CONDITION ZERO SERVER:
Server IP: 193.192.58.154:27016

Last edited by CS-A-Roland; 07-16-2012 at 09:08.
CS-A-Roland is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 07-16-2012 , 10:08   Re: NC-Laser code snippet
Reply With Quote #9

have you seen the dot function in lasersight.amxx? it sucks bigtime its like lines but 500 m further, big fail if you ask me. so i wouldt even think about checking diffrences between the lasersight and nc laser.

and the lasersight plugin is even worse then the nc laser so i wouldnt recommend camparing those 2 with each other we should compare the nc with a perfectly working copy that does not have this bug

Quote:
Originally Posted by CS-A-Roland View Post
for explanation, i think the bug is in the original harder because there will use an else every time there is something not "clear" or "wrong" ...
nono, the else function will happen everytime this check: if(get_pcvar_num(ls_line) != 0)
is false so when the cvar is 0 then the else function will come into play
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 07-16-2012 at 10:11.
striker07 is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-16-2012 , 19:29   Re: NC-Laser code snippet
Reply With Quote #10

Quote:
Originally Posted by striker07 View Post
omg unbelievable that that was the problem :s i use plugin init allot to precache and this is the first time this happend any way thx nikhil, it works now but i got one more question

is it possible to fix this problem? (lasers don't start out of the weapon but from you're body)=>
http://img12.**************/img12/897/2012071600001.jpg

this happens mostly with pistol I havent spotted this bug with primary weapons, any idea's what might cause this? i had the same problem with the lasersight plugin but thne for all weapons
I'm almost positive there's no way to fix that, sorry.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:16.


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