Raised This Month: $ Target: $400
 0% 

Need help with (get/set)_pdata_string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 08-06-2011 , 01:22   Need help with (get/set)_pdata_string
Reply With Quote #1

I want to get/set value from
PHP Code:
char m_szTeamName[TEAM_NAME_LENGTH]; // offset is 383 
I'm tried to use (get/set)_pdata_string, but it's not work =(

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "KORD_12.7"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say get""get")
    
register_clcmd("say set""set")
}

public 
get(id)
{
    new 
m_szTeamName[16]
    
get_pdata_string(id383m_szTeamNamecharsmax(m_szTeamName), .linux 5)
    
    
client_print(idprint_chat"m_szTeamName is ^"%s^""m_szTeamName)
}

public 
set(id)
{
    
set_pdata_string(id383"zombie", .linux 5)

Any idea?

PS
Running hldm steam server
__________________

Vi Veri Veniversum Vivus Vici
Russian Half-Life and Adrenaline Gamer community
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 08-07-2011 , 07:14   Re: Need help with (get/set)_pdata_string
Reply With Quote #2

Problem solved, please close
__________________

Vi Veri Veniversum Vivus Vici
Russian Half-Life and Adrenaline Gamer community
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-07-2011 , 07:33   Re: Need help with (get/set)_pdata_string
Reply With Quote #3

And the solution was ?
__________________
Arkshine is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 08-07-2011 , 07:33   Re: Need help with (get/set)_pdata_string
Reply With Quote #4

Can u post here, how did u solved the issue.
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-07-2011 , 08:09   Re: Need help with (get/set)_pdata_string
Reply With Quote #5

answer is here http://amx-x.ru/viewtopic.php?f=8&t=4418

( he didnt post the answer yet there )
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 01-08-2012 , 21:30   Re: Need help with (get/set)_pdata_string
Reply With Quote #6

And the solution was

PHP Code:
#define MAX_TEAMNAME_LENGTH    16

const m_szTeamName 383
const XTRA_OFS_PLAYER 5

new szTeamName[MAX_TEAMNAME_LENGTH]

get_pdata_string(iPlayerm_szTeamName 4szTeamNameMAX_TEAMNAME_LENGTH0XTRA_OFS_PLAYER)
set_pdata_string(iPlayerm_szTeamName 4szTeamName, -1XTRA_OFS_PLAYER
__________________

Vi Veri Veniversum Vivus Vici
Russian Half-Life and Adrenaline Gamer community

Last edited by KORD_12.7; 01-08-2012 at 21:38.
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-09-2012 , 00:56   Re: Need help with (get/set)_pdata_string
Reply With Quote #7

You solved my problem with
Code:
224
{
	(1<<0) m_bChangeNameAtRespawn
	( 1<<1) m_szNewName[]
}
Real offset are in reality 896 and 897 but i didn't think we could directly pass them, could you explain it please, i don't understand well russian

Test plugin :
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN ""

const XO_PLAYER 5
const m_bChangeNameAtRespawn 224
const m_szNewName 224*1

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_clcmd("drop""drop")
}

public 
drop(id)
{
    if( 
get_pdata_int(idm_bChangeNameAtRespawnXO_PLAYER) & (1<<0) )
    {
        new 
szNewName[32]
        
get_pdata_string(idm_szNewNameszNewNamecharsmax(szNewName), 0XO_PLAYER)
        
client_print(idprint_chat"New Name gonna be : %s"szNewName)
    }


Edit : Haven't tested on linux but i believe you have to do *4 with extra offset as well
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-09-2012 at 02:13.
ConnorMcLeod is offline
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 01-09-2012 , 02:30   Re: Need help with (get/set)_pdata_string
Reply With Quote #8

I will try, but my english is too bad .

Floats and integers have 4 bytes and when we access them throw (get/set)_pdata_(int/float) we have offset step with 4 bytes. Char have 1 byte, so we need to multiply offset to 4.

Quote:
Edit : Haven't tested on linux but i believe you have to do *4 with extra offset as well
Yep, i was think about this, but dont have ability to test on linux.
__________________

Vi Veri Veniversum Vivus Vici
Russian Half-Life and Adrenaline Gamer community

Last edited by KORD_12.7; 01-09-2012 at 02:32.
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7
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 03:28.


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