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

send any params to native


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andre neves
Junior Member
Join Date: Mar 2011
Old 08-23-2011 , 16:50   send any params to native
Reply With Quote #1

I'm creating a plugin, and wanted to put the method colorchat as native, so I used:

.inc
PHP Code:
native print_color_chat(idColor:type, const msg[], any:...) 
plugin:
PHP Code:
public native_print_chat(iPluginiParams)
{
    if( !
get_playersnum() ) return;
    
    new 
idColor:typemsg[256], format_params
    
    id         
get_param(1)
    
type         Color:get_param(2)
    
format_params     get_param(4)
    
get_string(3msg255)
    
    new 
message[256];

    switch(
type)
    {
        case 
NORMAL:
        {
            
message[0] = 0x01;
        }
        case 
GREEN:
        {
            
message[0] = 0x04;
        }
        default:
        {
            
message[0] = 0x03;
        }
    }
    
formatex(message[1], 255msgformat_params
in this case normal works if I use only one parameter, example:
PHP Code:
print_color_chat(idGREEN"%s""string"
more does not work use this:
PHP Code:
print_color_chat(idGREEN"%s %i""string"integer
how do I send all the parameters?
andre neves is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-23-2011 , 16:51   Re: send any params to native
Reply With Quote #2

Use vdformat().
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
andre neves
Junior Member
Join Date: Mar 2011
Old 08-23-2011 , 16:59   Re: send any params to native
Reply With Quote #3

so is right:
PHP Code:
vdformat(message[1], 255format_params3
andre neves is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-23-2011 , 17:05   Re: send any params to native
Reply With Quote #4

No.

Here's your native:
print_color_chat(id, Color:type, const msg[], any:...)
id --- param1
type - param2
msg -- param3
... -- param4 (start of formatting params)


Here is how vdformat works:
vdformat(buffer[], bufferLen, formatStringParamNumber, formatArgsStartParamNumber)

In your case, "msg" is your format string, and "..." is your formatting args.

See if you can piece that together.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
andre neves
Junior Member
Join Date: Mar 2011
Old 08-24-2011 , 15:28   Re: send any params to native
Reply With Quote #5

resolved, can lock
andre neves 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 05:06.


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