Raised This Month: $32 Target: $400
 8% 

Print_chat to specs only?


Post New Thread Reply   
 
Thread Tools Display Modes
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-03-2017 , 04:13   Re: Print_chat to specs only?
Reply With Quote #11

My way is a bit long but I hope this will work

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

new g_Joined[33], g_Connected[33]
new 
g_maxplayer

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled_Post"1)

    
g_maxplayer get_maxplayers()
}

public 
client_connect(id)
{
    
//Safety
    
g_Joined[id] = 0
}

public 
client_putinserver(id)
{
    
//Safety
    
g_Connected[id] = 1
}

public 
client_disconnect(id)
{
    
//Remove when they Disconnect
    
g_Joined[id] = 0
    g_Connected
[id] = 0
}

public 
fw_PlayerSpawn_Post(id)
{
    if(!
g_Connected[id]) return
    
    
//If they spam which mean they are in either CT or TS
    
g_Joined[id] = 1
}

public 
fw_PlayerKilled_Post(VictimAttacker)
{
    
//If they change team, they will dead. Take g_Joined from them
    
g_Joined[Victim] = 0
}

public 
yourfunc(id)
{
    for(new 
i=0i<g_maxplayer;i++)
    {
        if(!
g_Connected[id]) continue
        if(
g_Joined[id]) continue
        
client_print(iprint_chat"type your message here")
    }

I am not sure if using DeathMsg is better than killed or not but I usually use Ham_Killed more
__________________
My plugin:

Last edited by Celena Luna; 06-03-2017 at 04:17.
Celena Luna is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 06-03-2017 , 04:52   Re: Print_chat to specs only?
Reply With Quote #12

Quote:
Originally Posted by Celena Luna View Post
My way is a bit long but I hope this will work

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

new g_Joined[33], g_Connected[33]
new 
g_maxplayer

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled_Post"1)

    
g_maxplayer get_maxplayers()
}

public 
client_connect(id)
{
    
//Safety
    
g_Joined[id] = 0
}

public 
client_putinserver(id)
{
    
//Safety
    
g_Connected[id] = 1
}

public 
client_disconnect(id)
{
    
//Remove when they Disconnect
    
g_Joined[id] = 0
    g_Connected
[id] = 0
}

public 
fw_PlayerSpawn_Post(id)
{
    if(!
g_Connected[id]) return
    
    
//If they spam which mean they are in either CT or TS
    
g_Joined[id] = 1
}

public 
fw_PlayerKilled_Post(VictimAttacker)
{
    
//If they change team, they will dead. Take g_Joined from them
    
g_Joined[Victim] = 0
}

public 
yourfunc(id)
{
    for(new 
i=0i<g_maxplayer;i++)
    {
        if(!
g_Connected[id]) continue
        if(
g_Joined[id]) continue
        
client_print(iprint_chat"type your message here")
    }

I am not sure if using DeathMsg is better than killed or not but I usually use Ham_Killed more
No...it will not work.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-03-2017 , 06:25   Re: Print_chat to specs only?
Reply With Quote #13

Why not
__________________
My plugin:
Celena Luna is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-03-2017 , 07:29   Re: Print_chat to specs only?
Reply With Quote #14

Quote:
Originally Posted by jimaway View Post
it wont even work properly, so yeah, not really that effective
Made some changes. Edited the post.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
wickedd
Veteran Member
Join Date: Nov 2009
Old 06-03-2017 , 10:18   Re: Print_chat to specs only?
Reply With Quote #15

Quote:
Originally Posted by Celena Luna View Post
Why not
PHP Code:
 public yourfunc(id
You never used it.

PHP Code:
public fw_PlayerKilled_Post(VictimAttacker)
{
    
//If they change team, they will dead. Take g_Joined from them
    
g_Joined[Victim] = 0

You set g_Joined to 0 when the player dies. Just because you're dead doesn't mean you're a spectator.

Plus the correct answer was already given in the 4th post.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
woooow
Member
Join Date: Mar 2017
Old 06-04-2017 , 01:44   Re: Print_chat to specs only?
Reply With Quote #16

Quote:
Originally Posted by jimaway View Post
it wont even work properly, so yeah, not really that effective
actually my code will work without any problems lol
but like i said before there is a better method for sure.
woooow is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-04-2017 , 02:37   Re: Print_chat to specs only?
Reply With Quote #17

Quote:
Originally Posted by woooow View Post
actually my code will work without any problems lol
but like i said before there is a better method for sure.

It wont work because it will returns how many players are connected and it wont loop throw all slots,so it will miss some slots are connected higher than players connected number
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
woooow
Member
Join Date: Mar 2017
Old 06-04-2017 , 03:08   Re: Print_chat to specs only?
Reply With Quote #18

Quote:
Originally Posted by Natsheh View Post
It wont work because it will returns how many players are connected and it wont loop throw all slots,so it will miss some slots are connected higher than players connected number
lol this too big info for my small mind
in this way i will never learn amxx

but at least i still trying

Thanks‬‏
woooow is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 06-04-2017 , 04:33   Re: Print_chat to specs only?
Reply With Quote #19

Quote:
Originally Posted by Natsheh View Post
It wont work because it will returns how many players are connected and it wont loop throw all slots,so it will miss some slots are connected higher than players connected number
lemme explain that more detailed.
PHP Code:
get_playersnum/* returns the amount of players what are in the server.
but it doesnt mean that the player indexes are in correct order form 1 to maxplayers (32)
so if you go like this:*/
for(new i=1get_playersnumi++ {
    
client_print(iprint_chat"message")// it doesnt mean that player i is connected.
// if player id: 28 is online, then the loop doesn`t get to it if there are less than 6 players online.
}
/* if player joins server when its almost full and half of the players disconnect, then player id:28 doesn`t get reindexed to lower id. in example: id:28 doesnt become id:16 if there are only 16 players in the server. */ 
DjSoftero is offline
Reply


Thread Tools
Display Modes

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 21:19.


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