Raised This Month: $ Target: $400
 0% 

How to send an array with natives?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 06-21-2006 , 10:11   How to send an array with natives?
Reply With Quote #1

I want send the origin of a player from one Plugin to another with a native,but it dont work.

First Plugin:
Code:
native Protectornative(Float:_origin[3])

public eCountdown(){
 new Float:origin[3]
 entity_get_vector(1,EV_VEC_origin,origin)
 client_print(0,print_chat,"send:%d,%d,%d",origin[0],origin[1],origin[2])
 Protectornative(origin)
}
Second Plugin:
Code:
public plugin_natives(){
 register_native ( "Protectornative", "Pnative")
}

public Pnative(Float:torigin[]){
 client_print(0,print_chat,"native:%f,%f,%f",torigin[0],torigin[1],torigin[2])
}
I get as Floats 0.0.
__________________
schnitzelmaker is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 06-21-2006 , 12:13  
Reply With Quote #2

You registered a native with the style 0 while you use style 1 so should be:
Code:
register_native ( "Protectornative", "Pnative", 1)

You passing an array. Arrays in Pawn always passed by reference. For style-1 natives you should perform param_convert for every parameter which passed by reference:
Code:
public Pnative(Float:torigin[]){     param_convert(1) // we convert 1st parameter     client_print(0,print_chat,"native:%f,%f,%f",torigin[0],torigin[1],torigin[2]) }
VEN is offline
Reply


Thread Tools
Display Modes

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 07:58.


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