Counter-Strike Federation Welcome , Leecher | RSS | Friday, 27 December 24
A Place Where Player Becomes Developer Home | Sign Up | Log In
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
[Basic] Forward, Native and Function
Grade: Commander DavidJrDate: Monday, 19 January 15, 3:16 PM | Message # 1
Commander
Clan: Executive
Experience: 2256
Status: Offline
Kali ini kita belajar forward, native dan function.

Forward

Forward adalah dimana sebuah wadah untuk menjalankan beberapa native. Contoh dari forward pada pawn adalah plugin_init

forward plugin_init() [amxmodx.org]
Code
public plugin_init()
{
     // Code execution
}


Pada public plugin_init kita bebas memanggil native ataupun function yang ingin dikendalikan.

Native

Native adalah sebuah sub-forward yang digunakan pada forward untuk menjalankan perintah. Contoh dari native pada pawn adalah register_plugin

native register_plugin(plugin, version, author) [amxmodx.org]
Code
public plugin_init()
{
     register_plugin(PLUGIN, VERSION, AUTHOR)
     // Next code execution
}

Function

Function adalah sebuah native yang dipanggil dan mengembalikan hasil. Contohnya pada pawn adalah get_user_weapon
native get_user_weapon(id, clip, ammo)
[code]public plugin_init()
{
     register_event("CurWeapon", "Event_CurWeapon", "b") // register forward
}

public Event_CurWeapon(id)
{
     new iWpn = get_user_weapon(id);
}


get_user_weapon(id) akan mengembalikan result yang ada pada get_user_weapon(id) lalu menyimpannya pada iWpn

Sekian lagi dari saya biggrin


posted via BlackBerry

Personal Site | CSF Website
 
Grade: Copral anko()love()leilingDate: Friday, 05 June 15, 11:43 AM | Message # 2
Copral
Clan: Member
Experience: 13
Status: Offline
a simple question,

what is read_data() function?

read_data(1/2/3)


work, learn, think, explore, research

 
Grade: Commander DavidJrDate: Friday, 05 June 15, 5:43 PM | Message # 3
Commander
Clan: Executive
Experience: 2256
Status: Offline
Quote anko()love()leiling ()
a simple question,what is read_data() function?

read_data(1/2/3)
read_data used to get the parameter of a message, such DeathMsg. When DeathMsg is sent, it sends 4 parameters as I remember. First parameter is the killer's index, second is victim's index, third is headshot state, fourth is the weapon. So to get the killer's index you need to do read_data(1), read_data(2) for victim's index, and so on.


posted via BlackBerry

Personal Site | CSF Website
 
Grade: Copral anko()love()leilingDate: Friday, 05 June 15, 8:57 PM | Message # 4
Copral
Clan: Member
Experience: 13
Status: Offline
thanks smile

Quote
if it WORKS then, it's not stupid.-


work, learn, think, explore, research

 
  • Page 1 of 1
  • 1
Search:

Mirum
sample map