Raised This Month: $ Target: $400
 0% 

invalid player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KamiN
Senior Member
Join Date: Jun 2011
Old 06-16-2012 , 20:59   invalid player
Reply With Quote #1

Code:
public beacon(id)
{
    
    if(cs_get_user_team(id) == CS_TEAM_CT)
    {
        if(is_user_alive(id))
        {
            static origin[3]
            get_user_origin(id, origin)
            message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
            write_byte(TE_BEAMCYLINDER)    // TE id
            write_coord(origin[0])         // x
            write_coord(origin[1])        // y
            write_coord(origin[2]-20)    // z
            write_coord(origin[0])        // x axis
            write_coord(origin[1])        // y axis
            write_coord(origin[2]+200)    // z axis
            write_short(beacon_sprite)    // sprite
            write_byte(0)            // startframe   
            write_byte(1)            // framerate   
            write_byte(6)            // life
            write_byte(2)              // width
            write_byte(1)               // noise    
            write_byte(0)              // red  
            write_byte(0)               // green 
            write_byte(250)         // blue
            write_byte(200)            // brightness
            write_byte(0)            // speed
            message_end()
        }
    }
    else
    {
        if(is_user_alive(id))
        {
            static origin[3]
            get_user_origin(id, origin)
            message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
            write_byte(TE_BEAMCYLINDER)    // TE id
            write_coord(origin[0])         // x
            write_coord(origin[1])        // y
            write_coord(origin[2]-20)    // z
            write_coord(origin[0])        // x axis
            write_coord(origin[1])        // y axis
            write_coord(origin[2]+200)    // z axis
            write_short(beacon_sprite)    // sprite
            write_byte(0)            // startframe   
            write_byte(1)            // framerate   
            write_byte(6)            // life
            write_byte(2)              // width
            write_byte(1)               // noise    
            write_byte(250)            // red  
            write_byte(0)               // green 
            write_byte(0)             // blue
            write_byte(200)            // brightness
            write_byte(0)            // speed
            message_end()
        }
    }

    set_task(1.0, "beacon", id)
        
}
Code:
L 06/17/2012 - 03:31:44: [CSTRIKE] Invalid player 1
L 06/17/2012 - 03:31:44: [AMXX] Displaying debug trace (plugin "jb_days_lr.amxx")
L 06/17/2012 - 03:31:44: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 06/17/2012 - 03:31:44: [AMXX]    [0] jb_days_lr.sma::beacon (line 706)
I saw this warning in logs, so i added to code that is_user_alive(id) thing, but even after that i have same problem. So how do i fix this?


this code is a part of this plugin http://forums.alliedmods.net/showthread.php?t=117992

Last edited by KamiN; 06-16-2012 at 21:02.
KamiN is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-16-2012 , 21:35   Re: invalid player
Reply With Quote #2

The attachment doesn't exactly help. Show where your actually calling the function beacon from.

Also you should optimize this to remove some checks and make it more efficient:
Code:
public beacon(id) {     if(is_user_alive(id))     {         static origin[3]         get_user_origin(id, origin)         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)         write_byte(TE_BEAMCYLINDER)    // TE id         write_coord(origin[0])         // x         write_coord(origin[1])        // y         write_coord(origin[2]-20)    // z         write_coord(origin[0])        // x axis         write_coord(origin[1])        // y axis         write_coord(origin[2]+200)    // z axis         write_short(beacon_sprite)    // sprite         write_byte(0)            // startframe           write_byte(1)            // framerate           write_byte(6)            // life         write_byte(2)              // width         write_byte(1)               // noise                 switch( cs_get_user_team( id ) )         {             case CS_TEAM_T:             {                 write_byte(250)            // red                   write_byte(0)               // green                 write_byte(0)             // blue             }                         case CS_TEAM_CT:             {                 write_byte(0)              // red                   write_byte(0)               // green                 write_byte(250)         // blue             }         }                 write_byte(200)            // brightness         write_byte(0)            // speed         message_end()     }     set_task(1.0, "beacon", id)     }
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
KamiN
Senior Member
Join Date: Jun 2011
Old 06-17-2012 , 06:15   Re: invalid player
Reply With Quote #3

I dont know how to get correct line, but beacon is called in
Code:
public sub_choose_enemy
Code:
    switch (get_pcvar_num(cvar_effect))
    {
        case 0: // glow
        {
            set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)    
            set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
        }
        case 1: // beacon
        {
            set_task(1.0, "beacon", id)
            set_task(1.0, "beacon", tempid)
        }
        case 2: // glow n' beacon
        {
            set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)    
            set_task(1.0, "beacon", id)
            set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
            set_task(1.0, "beacon", tempid)
        }
    }
Please use CSTRL + F and type beacon or sub_choose_enemy

Last edited by KamiN; 06-17-2012 at 06:16.
KamiN is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-17-2012 , 06:22   Re: invalid player
Reply With Quote #4

Do what hornet said.
Backstabnoob is offline
KamiN
Senior Member
Join Date: Jun 2011
Old 06-17-2012 , 06:44   Re: invalid player
Reply With Quote #5

is there someway how to copy code without lately correction? :O Becouse now when i copy and paste this code it writes in 2 lines? :O
http://youtu.be/-76l4v1txqw

Last edited by KamiN; 06-17-2012 at 06:45.
KamiN is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-17-2012 , 06:56   Re: invalid player
Reply With Quote #6

Use some real text editor ;)
Backstabnoob is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-17-2012 , 06:58   Re: invalid player
Reply With Quote #7

Notepad suck!
Use your AMX Studio to open .sma or pasting code.....
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-17-2012 , 07:00   Re: invalid player
Reply With Quote #8

It is pasting in notepad as it is,Might be some problem in your text editor or you can:

Select full code,
Right Click and select copy,
Then Past it!
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-17-2012 , 07:36   Re: invalid player
Reply With Quote #9

Quote:
Originally Posted by KamiN View Post
is there someway how to copy code without lately correction? :O Becouse now when i copy and paste this code it writes in 2 lines? :O
http://youtu.be/-76l4v1txqw
Realistically you should be using AMXX Studio so you can test compile for warnings and errors - you'll also receive autocomplete help for constants aswell as functions and their arguments.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2012 , 12:37   Re: invalid player
Reply With Quote #10

Quote:
Originally Posted by Waleed View Post
It is pasting in notepad as it is,Might be some problem in your text editor or you can:

Select full code,
Right Click and select copy,
Then Past it!
No, the problem is that notepad is not smart enough to interpret various return characters. Use Notepad++.
__________________
fysiks is offline
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 06:11.


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