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

How to make "a = b" in AMXX scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Eyup
Junior Member
Join Date: Apr 2022
Old 04-23-2022 , 08:49   How to make "a = b" in AMXX scripting
Reply With Quote #1

Hello, I'm new at amxx scripting, How can I make "a = b"
I was a bash scripter. In bash language, when you make
Code:
a=b
echo ${b}
It gives me this output "a". How can I make this in amxx?

Last edited by Eyup; 04-23-2022 at 09:00. Reason: Title changing.
Eyup is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-23-2022 , 09:11   Re: How to make "a = b" in AMXX scripting
Reply With Quote #2

Code:
new a, b; b = 7; a = b; server_cmd("echo a : %d  | b : %d", a, b);
__________________
@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
Eyup
Junior Member
Join Date: Apr 2022
Old 04-23-2022 , 10:34   Re: How to make "a = b" in AMXX scripting
Reply With Quote #3

How can I use "a" parameter in get_user_info?
For example lets say I have this code;

PHP Code:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "Client Configs"
#define AUTHOR    "kramesa"
#define VERSION    "v1.0"

new a;

r;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /rates""CmdRates");
}

public 
CmdRates(id)
{
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum"ch"
    for(--
iNumiNum>=0iNum--)
    {
        new 
UserName[9], UserRate[9], UserCmdRate[9], UserUpdRate[9], UserInterp[9];
        
        
get_user_info(iPlayers[iNum], "name"UserName8);
        
get_user_info(iPlayers[iNum], "'%s'ate"aUserRate8);
        
get_user_info(iPlayers[iNum], "cl_cmdrate"UserCmdRate8);
        
get_user_info(iPlayers[iNum], "cl_updaterate"UserUpdRate8);
        
get_user_info(iPlayers[iNum], "ex_interp"UserInterp8);
        
        new 
MsgOnMotd[500];
        
formatex(MsgOnMotd499"Name: %s | Rate %s | Cmd: %s | Upd: %s | Interp: %s"UserNameUserRateUserCmdRateUserUpdRateUserInterp);
        
        
show_motd(idMsgOnMotd"Users Configs");
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;

Look at the 30th line, How can I use "a" in get_user_info?
Eyup is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-23-2022 , 10:46   Re: How to make "a = b" in AMXX scripting
Reply With Quote #4

a & b = number
a2[ 32 ] & b2[ 32 ] = string

new a;
a = b
get_user_info( a, "name", a2, charsmax( a2 ) );
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 04-23-2022 at 10:48.
Supremache is offline
Eyup
Junior Member
Join Date: Apr 2022
Old 04-23-2022 , 11:02   Re: How to make "a = b" in AMXX scripting
Reply With Quote #5

I guess you didn't understand my question, Or I didn't understand your code.
The problem is, my st*p*d host is banned some codes like "rate,ip" and other stuff. So I can't use these words in my code. I'm trying to bypass it. So I wan't to use "%s" instead of "rate". I hope I could described my problem.
Eyup is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-23-2022 , 11:16   Re: How to make "a = b" in AMXX scripting
Reply With Quote #6

Are u talking about this line:
'a' is numeric variable so you should use number field '%d or %i'

Code:
if you are using amx modx v1.8.3 or highter then use fmt
 get_user_info(iPlayers[iNum], fmt( "'%d'ate", a ), UserRate, 8);
 Or use this way
formatex(MsgOnMotd, 499, "Name: %s | Rate %d%s | Cmd: %s | Upd: %s | Interp: %s", UserName, a, UserRate, UserCmdRate, UserUpdRate, UserInterp);
 if you means u want to add the number as string then use num_to_str
new szNum[ 10 ]; num_to_str( a,  szNum, charsmax(  szNum) ) get_user_info(iPlayers[iNum], fmt( "'%s'ate", szNum ), UserRate, 8);
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
zXCaptainXz
Member
Join Date: May 2017
Old 04-23-2022 , 11:22   Re: How to make "a = b" in AMXX scripting
Reply With Quote #7

You can do it like this
PHP Code:
new Info[] = "fate"
Info[0] = 'r' // single quote
get_user_info(iPlayers[iNum], InfoUserRate8); 

Last edited by zXCaptainXz; 04-23-2022 at 11:30. Reason: coding on mobile is frustrating
zXCaptainXz is offline
Eyup
Junior Member
Join Date: Apr 2022
Old 04-23-2022 , 12:20   Re: How to make "a = b" in AMXX scripting
Reply With Quote #8

Quote:
Originally Posted by Supremache View Post
Are u talking about this line:
'a' is numeric variable so you should use number field '%d or %i'

Code:
if you are using amx modx v1.8.3 or highter then use fmt
 get_user_info(iPlayers[iNum], fmt( "'%d'ate", a ), UserRate, 8);
 Or use this way
formatex(MsgOnMotd, 499, "Name: %s | Rate %d%s | Cmd: %s | Upd: %s | Interp: %s", UserName, a, UserRate, UserCmdRate, UserUpdRate, UserInterp);
 if you means u want to add the number as string then use num_to_str
new szNum[ 10 ]; num_to_str( a,  szNum, charsmax(  szNum) ) get_user_info(iPlayers[iNum], fmt( "'%s'ate", szNum ), UserRate, 8);
Tried fmt way and it show's the all player's rate as a blank. It doesn't shows anything.
Eyup is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2022 , 12:25   Re: How to make "a = b" in AMXX scripting
Reply With Quote #9

Try
PHP Code:
new const LetterI[] = "i";
new const 
LetterP[] = "p";

new const 
LettersRA[] = "ra";
new const 
LettersTE[] = "te";

new 
szRate];
formatexszRate charsmaxszRate ) , "%s%s" LettersRA LettersTE );

get_user_info(iPlayers[iNum], szRateUserRate8); 
__________________
Bugsy is offline
Eyup
Junior Member
Join Date: Apr 2022
Old 04-23-2022 , 12:25   Re: How to make "a = b" in AMXX scripting
Reply With Quote #10

Quote:
Originally Posted by zXCaptainXz View Post
You can do it like this
PHP Code:
new Info[] = "fate"
Info[0] = 'r' // single quote
get_user_info(iPlayers[iNum], InfoUserRate8); 
I tried this one too and this one shows blank either.
Eyup 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 02:51.


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