AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] get_pdata_int and StatusText (https://forums.alliedmods.net/showthread.php?t=168642)

keyblade 10-02-2011 02:04

[HELP] get_pdata_int and StatusText
 
2 problems

1.if i use this:
PHP Code:

new name[32]
new 
TEAM get_pdata_int(id1145)
if( 
TEAM == )
{
    
pev(idpev_netnamename31)
    
client_print(idprint_chat"%s"name)


or

PHP Code:

new name[32]
new 
TEAM get_pdata_int(id1145)
if( 
TEAM == )
{
    
pev(idpev_netnamename31)
    
client_print(idprint_chat"%s"name)


when i am T or CT, these two codes both don't work(i can't get the name)

where is wrong?

2.how to change the StatusText properly?

i use this:
PHP Code:

register_event("StatusText""StatusText_Event""b"
public 
StatusText_Event(id)
{
    new 
text[64]
    
format(text63"AAAABBBBCCCC")
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("StatusText"), {000}, id)
    
write_byte(0)
    
write_string(text)
    
message_end()


when i aim player, the text(AAAABBBBCCCC) will display forever....

can anyone give me an example?


thank you for your help

ConnorMcLeod 10-02-2011 06:13

Re: [HELP] get_pdata_int and StatusText
 
1. Use cs_get_user_team(id) and CS_TEAM_T and CS_TEAM_CT and get_user_name.
2. StatusText is not sent every new player if the text doesn't need to be changed, so it's better to hook StatusValue and to send it there, have a look at xPaw aim country plugin for code example.

keyblade 10-02-2011 07:26

Re: [HELP] get_pdata_int and StatusText
 
all of the codes are under Round_Start_Event

PHP Code:

register_logevent("Round_Start_Event"2"1=Round_Start"

cs_get_user_team(id) also don't work. in the game it says native error(cs_get_user_team)

i use
new TEAM = get_pdata_int(id, 114, 5)
client_print(id, print_chat, "%d", TEAM)

and i see the number 31660448 in print_chat

how can i handle it...



and if i use register_clcmd and make the codes under its function, it works fine

ConnorMcLeod 10-02-2011 09:58

Re: [HELP] get_pdata_int and StatusText
 
Show your code.

keyblade 10-02-2011 10:10

Re: [HELP] get_pdata_int and StatusText
 
PHP Code:

#include <amxmodx>
#include <fakemeta>
 
#define PLUGIN "TEST"
#define VERSION "1.0"
#define AUTHOR "Ice-Action |#KeyBlade"
 
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("Round_Start_Event"2"1=Round_Start")
}
 
public 
Round_Start_Event(id)
{
    new 
TEAM get_pdata_int(id1145)
    
client_print(idprint_chat"%d"TEAM)



abdul-rehman 10-02-2011 10:31

Re: [HELP] get_pdata_int and StatusText
 
Quote:

Originally Posted by keyblade (Post 1567069)
PHP Code:

#include <amxmodx>
#include <fakemeta>
 
#define PLUGIN "TEST"
#define VERSION "1.0"
#define AUTHOR "Ice-Action |#KeyBlade"
 
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("Round_Start_Event"2"1=Round_Start")
}
 
public 
Round_Start_Event(id)
{
    new 
TEAM get_pdata_int(id1145)
    
client_print(idprint_chat"%d"TEAM)



Round start event doesnt provide you with a player id, you have to loop throught them manually

keyblade 10-02-2011 10:42

Re: [HELP] get_pdata_int and StatusText
 
Quote:

Originally Posted by abdul-rehman (Post 1567079)
Round start event doesnt provide you with a player id, you have to loop throught them manually

really?if so,why can i see the client_print?

drekes 10-02-2011 10:45

Re: [HELP] get_pdata_int and StatusText
 
Quote:

Originally Posted by keyblade (Post 1567086)
really?if so,why can i see the client_print?

because the value of id = 0, so it's printed to everyone.

keyblade 10-02-2011 11:06

Re: [HELP] get_pdata_int and StatusText
 
Quote:

Originally Posted by drekes (Post 1567087)
because the value of id = 0, so it's printed to everyone.

i see...

how can i know what information does a event provide?

Hunter-Digital 10-02-2011 11:12

Re: [HELP] get_pdata_int and StatusText
 
Game event messages with their arguemnts: http://wiki.amxmodx.org/Half-Life_1_Game_Events

For logevents, you can see arguments in the console when the event happens while having "log on".

And to get a player entity id from a logevent, you need to get the name from the log message by using parse_loguser() and then use that name on get_user_index().


All times are GMT -4. The time now is 19:31.

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