„Magia” include i wywoływania funkcji

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 );
}

5 komentarzy o “„Magia” include i wywoływania funkcji

  1. Nie ma gdzie napisać to napiszę tutaj 😉

    DarkGL dodaj jakiegoś SB. I mam pytanie co optymalniejsze fakemeta_util czy hamsandwich?

    0
    0
  2. Dobre to jest, ale to hamsandwich robi. Jeżeli usunie się bibliotekę amxmodx, i doda się hamsandwich to dalej się skompiluje

    0
    0

Dodaj komentarz

Witryna wykorzystuje Akismet, aby ograniczyć spam. Dowiedz się więcej jak przetwarzane są dane komentarzy.