Raised This Month: $51 Target: $400
 12% 

[CSTRIKE] Invalid player 1


Post New Thread Reply   
 
Thread Tools Display Modes
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-14-2016 , 12:35   Re: [CSTRIKE] Invalid player 1
Reply With Quote #11

PHP Code:
if( cs_get_user_teamClient ) == CS_TEAM_CT // problem come from here 
You need to check is_user_alive and before you say you did look closer.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 09-14-2016 at 13:07.
wickedd is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-14-2016 , 12:40   Re: [CSTRIKE] Invalid player 1
Reply With Quote #12

Quote:
thank all for info, but why should i use give_item, fm_give_item better no?
No, it's worse. fm_give_item has the same code as give_item, but later is implemented in a module and should be faster. Even if the difference is trivial, using such conversions of already existing modules is stupid(that's why you should not use most of functions provided by fm util).
__________________
HamletEagle is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 09-14-2016 , 13:12   Re: [CSTRIKE] Invalid player 1
Reply With Quote #13

Quote:
Originally Posted by wickedd View Post
PHP Code:
if( cs_get_user_teamClient ) == CS_TEAM_CT // problem come from here 
You need to check is_user_alive and before you say you did look closer.
look here again:
https://forums.alliedmods.net/showpo...4&postcount=10

i already check if user alive, but maybe i check wrong should help?

maybe i will add:
Quote:
if( is_user_alive( Client ) && ( cs_get_user_team( Client ) == CS_TEAM_CT ) )
Quote:
Originally Posted by HamletEagle View Post
No, it's worse. fm_give_item has the same code as give_item, but later is implemented in a module and should be faster. Even if the difference is trivial, using such conversions of already existing modules is stupid(that's why you should not use most of functions provided by fm util).
ok, sometimes modules show error and can't find it. i will try use fun include.

remove static iPlayer?
__________________
Қазақстан Республикасы

Last edited by Snitch; 09-14-2016 at 13:15.
Snitch is offline
Send a message via Skype™ to Snitch
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-14-2016 , 13:26   Re: [CSTRIKE] Invalid player 1
Reply With Quote #14

Like I said...look closer because you didn't. The second cs_get_user_team is outside of the is_user_alive check.

PHP Code:
 if( is_user_aliveClient ) )
    {
        
PlayerClient ][ PLAYER_DOUBLEDMG ] = 0
        
        
if( g_PlayerKnivesClient ][ playerUsingknifeClient ] ] )
        {
            
set_user_healthClient, ( get_user_healthClient ) + Knife_InfoplayerUsingknifeClient ] ][ INFOKNIFE_EXTRA_HEALTH ] ) )
        }
        
        if( 
cs_get_user_teamClient ) == CS_TEAM_T )
        {
            if( 
g_PlayerSkinsClient ][ playerUsingSkinClient ] ] )
            {
                
cs_set_user_modelClientSkin_NamesplayerUsingSkinClient ] ][ DETILS_DOWN ] )
                
                new 
intRandom random_num100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_GRANDE ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_GRANDE ) >= intRandom )
                    {
                        
give_grenadeClientCSW_HEGRENADE );
                    }
                }
                
                
intRandom random_num1100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_STAMINA ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_STAMINA ) >= intRandom )
                    {
                        
give_grenadeClientCSW_FLASHBANG );
                    }
                }
            }
        }
        else 
cs_reset_user_modelClient );
        }
    
    if( 
cs_get_user_teamClient ) == CS_TEAM_CT // problem come from here
    
{
        
fm_give_itemiPlayer"weapon_m4a1" );
        
        
fm_give_itemiPlayer"weapon_deagle" );
        
        
cs_set_user_bpammoiPlayerCSW_M4A1120 );
        
        
cs_set_user_bpammoiPlayerCSW_DEAGLE70 );
        
        
cs_reset_user_modelClient );
    }

__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 09-14-2016 , 13:30   Re: [CSTRIKE] Invalid player 1
Reply With Quote #15

Quote:
Originally Posted by wickedd View Post
Like I said...look closer because you didn't. The second cs_get_user_team is outside of the is_user_alive check.

PHP Code:
 if( is_user_aliveClient ) )
    {
        
PlayerClient ][ PLAYER_DOUBLEDMG ] = 0
        
        
if( g_PlayerKnivesClient ][ playerUsingknifeClient ] ] )
        {
            
set_user_healthClient, ( get_user_healthClient ) + Knife_InfoplayerUsingknifeClient ] ][ INFOKNIFE_EXTRA_HEALTH ] ) )
        }
        
        if( 
cs_get_user_teamClient ) == CS_TEAM_T )
        {
            if( 
g_PlayerSkinsClient ][ playerUsingSkinClient ] ] )
            {
                
cs_set_user_modelClientSkin_NamesplayerUsingSkinClient ] ][ DETILS_DOWN ] )
                
                new 
intRandom random_num100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_GRANDE ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_GRANDE ) >= intRandom )
                    {
                        
give_grenadeClientCSW_HEGRENADE );
                    }
                }
                
                
intRandom random_num1100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_STAMINA ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_STAMINA ) >= intRandom )
                    {
                        
give_grenadeClientCSW_FLASHBANG );
                    }
                }
            }
        }
        else 
cs_reset_user_modelClient );
        }
    
    if( 
cs_get_user_teamClient ) == CS_TEAM_CT // problem come from here
    
{
        
fm_give_itemiPlayer"weapon_m4a1" );
        
        
fm_give_itemiPlayer"weapon_deagle" );
        
        
cs_set_user_bpammoiPlayerCSW_M4A1120 );
        
        
cs_set_user_bpammoiPlayerCSW_DEAGLE70 );
        
        
cs_reset_user_modelClient );
    }

thank, is fixed
just show example, to be sure:
Code:
public Ham_PlayerSpawn( Client )
{
    //static iPlayer;
    
    if( is_user_alive( Client ) )
    {
        Player[ Client ][ PLAYER_DOUBLEDMG ] = 0
        
        if( g_PlayerKnives[ Client ][ playerUsingknife[ Client ] ] )
        {
            set_user_health( Client, ( get_user_health( Client ) + Knife_Info[ playerUsingknife[ Client ] ][ INFOKNIFE_EXTRA_HEALTH ] ) )
        }
        
        if( cs_get_user_team( Client ) == CS_TEAM_T )
        {
            if( g_PlayerSkins[ Client ][ playerUsingSkin[ Client ] ] )
            {
                cs_set_user_model( Client, Skin_Names[ playerUsingSkin[ Client ] ][ DETILS_DOWN ] )
                
                new intRandom = random_num( 1 , 100 );
                
                if( g_PlayerUpgrade[ Client ][ playerUsingSkin[ Client ] ][ SKIN_GRANDE ] > 0 )
                {
                    if( GetUserStat( Client, playerUsingSkin[ Client ], SKIN_GRANDE ) >= intRandom )
                    {
                        give_grenade( Client, CSW_HEGRENADE );
                    }
                }
                
                intRandom = random_num( 1, 100 );
                
                if( g_PlayerUpgrade[ Client ][ playerUsingSkin[ Client ] ][ SKIN_STAMINA ] > 0 )
                {
                    if( GetUserStat( Client, playerUsingSkin[ Client ], SKIN_STAMINA ) >= intRandom )
                    {
                        give_grenade( Client, CSW_FLASHBANG );
                    }
                }
            }
        }
        else cs_reset_user_model( Client );
        }
    
    if( is_user_alive( Client ) && ( cs_get_user_team( Client ) == CS_TEAM_CT ) )
    {
        give_item( Client, "weapon_m4a1" );
        
        give_item( Client, "weapon_deagle" );
        
        cs_set_user_bpammo( Client, CSW_M4A1, 120 );
        
        cs_set_user_bpammo( Client, CSW_DEAGLE, 70 );
        
        cs_reset_user_model( Client );
    }
}
__________________
Қазақстан Республикасы
Snitch is offline
Send a message via Skype™ to Snitch
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-14-2016 , 13:48   Re: [CSTRIKE] Invalid player 1
Reply With Quote #16

PHP Code:
public Ham_PlayerSpawnClient )
{  
    if( 
is_user_aliveClient ) )
    {
        
PlayerClient ][ PLAYER_DOUBLEDMG ] = 0
        
        
if( g_PlayerKnivesClient ][ playerUsingknifeClient ] ] )
        {
            
set_user_healthClient, ( get_user_healthClient ) + Knife_InfoplayerUsingknifeClient ] ][ INFOKNIFE_EXTRA_HEALTH ] ) )
        }
        
        if( 
cs_get_user_teamClient ) == CS_TEAM_T )
        {
            if( 
g_PlayerSkinsClient ][ playerUsingSkinClient ] ] )
            {
                
cs_set_user_modelClientSkin_NamesplayerUsingSkinClient ] ][ DETILS_DOWN ] )
                
                new 
intRandom random_num100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_GRANDE ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_GRANDE ) >= intRandom )
                    {
                        
give_grenadeClientCSW_HEGRENADE );
                    }
                }
                
                
intRandom random_num1100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_STAMINA ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_STAMINA ) >= intRandom )
                    {
                        
give_grenadeClientCSW_FLASHBANG );
                    }
                }
            }
       }    
       if( 
cs_get_user_teamClient ) == CS_TEAM_CT // problem come from here
       
{
           
fm_give_itemClient"weapon_m4a1" );
        
           
fm_give_itemClient"weapon_deagle" );
        
           
cs_set_user_bpammoClientCSW_M4A1120 );
        
           
cs_set_user_bpammoClientCSW_DEAGLE70 );       
       }
       
cs_reset_user_modelClient );
    }

You can do this. Also, I deleted the static iPlayer because it's useless.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 09-14-2016 , 14:26   Re: [CSTRIKE] Invalid player 1
Reply With Quote #17

Quote:
Originally Posted by wickedd View Post
PHP Code:
public Ham_PlayerSpawnClient )
{  
    if( 
is_user_aliveClient ) )
    {
        
PlayerClient ][ PLAYER_DOUBLEDMG ] = 0
        
        
if( g_PlayerKnivesClient ][ playerUsingknifeClient ] ] )
        {
            
set_user_healthClient, ( get_user_healthClient ) + Knife_InfoplayerUsingknifeClient ] ][ INFOKNIFE_EXTRA_HEALTH ] ) )
        }
        
        if( 
cs_get_user_teamClient ) == CS_TEAM_T )
        {
            if( 
g_PlayerSkinsClient ][ playerUsingSkinClient ] ] )
            {
                
cs_set_user_modelClientSkin_NamesplayerUsingSkinClient ] ][ DETILS_DOWN ] )
                
                new 
intRandom random_num100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_GRANDE ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_GRANDE ) >= intRandom )
                    {
                        
give_grenadeClientCSW_HEGRENADE );
                    }
                }
                
                
intRandom random_num1100 );
                
                if( 
g_PlayerUpgradeClient ][ playerUsingSkinClient ] ][ SKIN_STAMINA ] > )
                {
                    if( 
GetUserStatClientplayerUsingSkinClient ], SKIN_STAMINA ) >= intRandom )
                    {
                        
give_grenadeClientCSW_FLASHBANG );
                    }
                }
            }
       }    
       if( 
cs_get_user_teamClient ) == CS_TEAM_CT // problem come from here
       
{
           
fm_give_itemClient"weapon_m4a1" );
        
           
fm_give_itemClient"weapon_deagle" );
        
           
cs_set_user_bpammoClientCSW_M4A1120 );
        
           
cs_set_user_bpammoClientCSW_DEAGLE70 );       
       }
       
cs_reset_user_modelClient );
    }

You can do this. Also, I deleted the static iPlayer because it's useless.
so i dont need check if user is alive?
Code:
 if( is_user_alive( Client ) && ( cs_get_user_team( Client ) == CS_TEAM_CT ) )
and fm_give_item to give_item?
__________________
Қазақстан Республикасы
Snitch is offline
Send a message via Skype™ to Snitch
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-14-2016 , 14:34   Re: [CSTRIKE] Invalid player 1
Reply With Quote #18

You already check at the top of the function if user is alive, so no.
Yes for the second question.
__________________
HamletEagle is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-14-2016 , 14:39   Re: [CSTRIKE] Invalid player 1
Reply With Quote #19

Quote:
Originally Posted by Snitch View Post
so i dont need check if user is alive?
Quote:
Originally Posted by HamletEagle View Post
You already check at the top of the function if user is alive, so no.
You don't need to if you use code I posted.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 09-14-2016 at 14:40.
wickedd 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 00:48.


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