Początkowy kod
#include <amxmodx> #include <amxmisc> #include <hamsandwich></hamsandwich></amxmisc></amxmodx> #define PLUGIN "Test Compile" #define AUTHOR "DarkGL" #define VERSION "1.0" public plugin_init(){ register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam( Ham_Spawn , "player" , "fwSpawnedPost" , 1 ); } public fwSpawnedPost( id ){ client_print( id , print_chat , "Spawned %d" , id ); }
wszyscy się zgodzą że jest on poprawy i oczywiście działa 🙂
a co jeśli usuniemy <> z include
#include amxmodx #include amxmisc #include hamsandwich #define PLUGIN "Test Compile" #define AUTHOR "DarkGL" #define VERSION "1.0" public plugin_init(){ register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam( Ham_Spawn , "player" , "fwSpawnedPost" , 1 ); } public fwSpawnedPost( id ){ client_print( id , print_chat , "Spawned %d" , id ); }
plugin ciągle działa i ciągle kompiluje się bez problemu
ale po co komu () możemy obejść się bez nich
include amxmodx #include amxmisc #include hamsandwich #define PLUGIN "Test Compile" #define AUTHOR "DarkGL" #define VERSION "1.0" public plugin_init(){ register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam .function = Ham_Spawn , .EntityClass = "player" ,.Callback = "fwSpawnedPost" , .Post = 1 ; } public fwSpawnedPost( id ){ client_print( id , print_chat , "Spawned %d" , id ); }
a nawet skrócić to do
#include amxmodx #include amxmisc #include hamsandwich #define PLUGIN "Test Compile" #define AUTHOR "DarkGL" #define VERSION "1.0" public plugin_init(){ register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam Ham_Spawn , "player" ,"fwSpawnedPost" , 1 ; } public fwSpawnedPost( id ){ client_print( id , print_chat , "Spawned %d" , id ); }
Z tymi ptaszkami przy include to wiedziałem, ale rejestracja funkcji bez nawiasów :O Darek czarodziej ;d
Nie ma gdzie napisać to napiszę tutaj 😉
DarkGL dodaj jakiegoś SB. I mam pytanie co optymalniejsze fakemeta_util czy hamsandwich?
Sb był i już raczej nie powróci , jeżeli chcesz się ze mną skontaktować sprawdź zakładke kontakt 😉
Dobre to jest, ale to hamsandwich robi. Jeżeli usunie się bibliotekę amxmodx, i doda się hamsandwich to dalej się skompiluje
Nie , jest to niezależne od biblioteki