Raised This Month: $ Target: $400
 0% 

To give a Random knife from the menu Bots each spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 02-26-2018 , 10:52   To give a Random knife from the menu Bots each spawn
Reply With Quote #1

Registered I spawn for the bots

PHP Code:
new bool:g_bot_enable 

public client_authorized(id

if(
is_user_bot(id) && !g_bot_enableset_task(0.1"register_bot"id__"a"1

public 
register_bot(id

RegisterHamFromEntity(Ham_Spawnid"player_spawn"1
g_bot_enable true 

Next, on the example of OnPlayerSpawn (id) write for them to issue .Or is it wrong?Why it doesn't work...

PHP Code:
public OnPlayerSpawn(id

if(
is_user_alive(id) && get_pcvar_num(g_pAtSpawn) && !g_iKnife[id] && g_bFirstTime[id]) 

g_bFirstTime[id] = false 
ShowMenu
(id

}

public 
player_spawn(id

if(
is_user_bot(id) && !g_bot_enable && get_pcvar_num(g_pAtSpawn) && !g_iKnife[id] && g_bFirstTime[id]) 

g_bFirstTime[id] = false 
ShowMenu
(id


it's to get a random knife out of the menu.
Attached Files
File Type: sma Get Plugin or Get Source (KnifeModels.sma - 367 views - 8.3 KB)

Last edited by MayroN; 02-26-2018 at 11:00.
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
E1_531G
Senior Member
Join Date: Dec 2017
Old 02-26-2018 , 14:42   Re: To give a Random knife from the menu Bots each spawn
Reply With Quote #2

In player_spawn(id), g_bot_enable is true, because you set it in client_authorized(id).
The code is not executed.
__________________
My English is A0
E1_531G is offline
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 02-26-2018 , 16:22   Re: To give a Random knife from the menu Bots each spawn
Reply With Quote #3

Quote:
Originally Posted by E1_531G View Post
In player_spawn(id), g_bot_enable is true, because you set it in client_authorized(id).
The code is not executed.
Most likely.And how then correctly to register?
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
E1_531G
Senior Member
Join Date: Dec 2017
Old 02-26-2018 , 16:59   Re: To give a Random knife from the menu Bots each spawn
Reply With Quote #4

Quote:
Originally Posted by MayroN View Post
Most likely.And how then correctly to register?
I'm telling you that in the code below lime variable is always true (because of register_bot(id)):
Code:
public player_spawn(id)  
{  
if(is_user_bot(id) && !g_bot_enable && get_pcvar_num(g_pAtSpawn) && !g_iKnife[id] && g_bFirstTime[id])  
{  
g_bFirstTime[id] = false  
ShowMenu(id)  
}  
}
The red code will never be executed.
__________________
My English is A0
E1_531G is offline
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 02-26-2018 , 17:32   Re: To give a Random knife from the menu Bots each spawn
Reply With Quote #5

E1_531G

With This value there is no Compilation and I think you need to put it further
PHP Code:
g_iKnife[id] = random_num(0g_iKnivesNum); 
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
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 08:25.


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