Raised This Month: $ Target: $400
 0% 

register_clcmd with parameter UID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gameplayonline
Member
Join Date: Jun 2017
Old 06-28-2017 , 08:59   register_clcmd with parameter UID
Reply With Quote #1

Hello,
Is any solution how to do this?
I have declared variable uid and i need register_clcmd with value of this variable. If somebody say /referral 123 and variable will be set to this number do anything...
gameplayonline is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-28-2017 , 09:05   Re: register_clcmd with parameter UID
Reply With Quote #2

You can use it in this way.

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

public plugin_init() {
    
register_plugin("Say""1.0""PurposeLess")

    
register_clcmd("say""clcmd_say")
    
register_clcmd("say_team""clcmd_say")
}

public 
clcmd_say(id)
{
    new 
arg[32]
    
read_args(argsizeof(arg) - 1)
    
remove_quotes(arg)

    if(
equali(arg"/referral 123"))
    {
    }

PurposeLessx is offline
gameplayonline
Member
Join Date: Jun 2017
Old 06-28-2017 , 09:18   Re: register_clcmd with parameter UID
Reply With Quote #3

When i change
Code:
if(equali(arg, "/referral 123"))
    {
    }
to

Code:
if(equali(arg, "/referral %d", uid))
    {
    }
it will work?

Last edited by gameplayonline; 06-28-2017 at 09:19.
gameplayonline is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-28-2017 , 09:37   Re: register_clcmd with parameter UID
Reply With Quote #4

Did you try it? If you are wanting to get the 123 into a variable, you need to check that it contains "/referral" first and then parse the string to get the argument after it and convert it to a number.
__________________
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-28-2017 , 09:55   Re: register_clcmd with parameter UID
Reply With Quote #5

You can use strtok native to divide the string..

Get the left string which it will be the command
And the right is the numbers..
__________________
@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
gameplayonline
Member
Join Date: Jun 2017
Old 06-28-2017 , 10:58   Re: register_clcmd with parameter UID
Reply With Quote #6

Can you show me example please? Im new and i only start learning pawno and dont have perfect english
gameplayonline is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 06-28-2017 , 11:35   Re: register_clcmd with parameter UID
Reply With Quote #7

Or strbreak too. Anyway, search. In this section you do things by yourself.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
gameplayonline
Member
Join Date: Jun 2017
Old 06-28-2017 , 12:11   Re: register_clcmd with parameter UID
Reply With Quote #8

Ihave this but have error.
Code:
	
	new arg[32]
	read_args(arg, sizeof(arg) - 1)
	remove_quotes(arg)

	if(contain(arg, "/referral"))
	{
		parse(arg)
		str_to_num(arg)
		if (equali(arg, uid)
			client_print(id, print_chat, "test")    
	}
}
Error: Error: Argument type mismatch (argument 2) on line 83
gameplayonline is offline
gameplayonline
Member
Join Date: Jun 2017
Old 06-28-2017 , 12:22   Re: register_clcmd with parameter UID
Reply With Quote #9

I tried
Code:
uid = 123
	new arg[32]
	read_args(arg, sizeof(arg) - 1)
	remove_quotes(arg)

	if(strtok(arg, "/referral", str_to_num(arg), uid ))
	{
			client_print(id, print_chat, "test")    
	}
Still have error: Error: Argument type mismatch (argument 4) on line 79
gameplayonline is offline
gameplayonline
Member
Join Date: Jun 2017
Old 06-28-2017 , 13:13   Re: register_clcmd with parameter UID
Reply With Quote #10

Im trying many changes but i really dont know how to do can somebody help me please?
gameplayonline 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 06:23.


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