Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.

@legiondark:
- Bienchuot 1997 đó gọi em đi
@bienchuot:
- Tôi viết thế này đúng chưa
PHP:public fw_cmdstart(id, uc_handle, seed) { static button button = get_uc(uc_handle, UC_Buttons) if(button & IN_ATTACK) { } }
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN AWP ROF Manager"
#define VERSION "1.0"
#define AUTHOR ".........................."
#define m_pPlayer 41 // (weapon_*) owner entity
#define m_flNextPrimaryAttack 46 // (weapon_*) next prim attack
#define m_flNextSecondaryAttack 47 // (weapon_*) next sec attack
#define m_flNextAttack 83 // (player) next attack
#define DELAY_ATTACK 0.05
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "fw_Weapon_PrimaryAttack_Post", 1)
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "fw_Weapon_PrimaryAttack_Post", 1)
}
public fw_Weapon_PrimaryAttack_Post(iEnt)
{
new iPlrId = get_pdata_cbase(iEnt, m_pPlayer, 4);
if( !is_user_alive(iPlrId) ) return;
set_pdata_float(iEnt, m_flNextPrimaryAttack, DELAY_ATTACK, 4);
set_pdata_float(iEnt, m_flNextSecondaryAttack, DELAY_ATTACK, 4);
set_pdata_float(iPlrId, m_flNextAttack, DELAY_ATTACK, 5);
}

static
Thế biến động và biến tĩnh là cái j` ??
A native is a C or C++ function that can be used in Small scripts. They are one of the two ways to glue Small to your module. Take this sample native:
PHP://my native static cell AMX_NATIVE_CALL my_native(AMX *amx, cell *params) { return 1; }
This native simply returns 1 - it does nothing else. Let's analyze it.
static - You should know the static keyword.
cell - This is the base type for Small plugins. It is either a 4byte or 8byte unsigned integer depending on the architecture.
AMX_NATIVE_CALL - a macro for the calling convention (__cdecl).
AMX *amx - a pointer to the AMX structure for a plugin. This structure contains the virtual machine bytecode and state information - you rarely need to use this directly.
cell *params - an array of parameters that the plugin passed to your native. params[0] is the number of bytes following in the array, so *params/sizeof(cell) will be equal to the number of parameters. Then params[1] is the first parameter and so on.
return 1; - AMX functions should always return a value.
So, how do extract parameters? Let's say we wanted to make a simple math function that found the product of two numbers passed.
PHP:static cell AMX_NATIVE_CALL amx_biproduct(AMX *amx, cell *params) { return params[1] * params[2]; }
Simple enough, right? Well, it gets more complicated. Small plugins follow a certain calling convention.
Integers and floats are passed by value. Arrays (including strings) are passed by reference. And lastly, variable arguments are always passed by reference. For example:
Everything after b will be by reference.PHP:native sample_native(a, b, ...);
PHP://native prototype: amx_product(...); static cell AMX_NATIVE_CALL amx_product(AMX *amx, cell *params) { int i = 0; int sum = 1; cell *addr = NULL; int numParams = *params/sizeof(cell); for (i=1; i<=numParams; i++) { addr = MF_GetAmxAddr(amx, params[i]); sum *= (int)(*addr); } return sum; }
MF_GetAmxAddr is the first module function we will deal with. It takes two parameters, an AMX virtual machine and a by-reference offset in the machine. It will return the actual address where the data is stored. So here, we retrieve the cell address at which the parameter is stored and add it to our product.
What about floats? Let's say you want to make a function that multiplies two floats together.
PHP://amx_fProduct(Float:a1, Float:a2) static cell AMX_NATIVE_CALL amx_fProduct(AMX *amx, cell *params) { REAL product; product = amx_ctof(params[1]) * amx_ctof(params[2]); return amx_ftoc(product); }
Here we have the next two module functions. The AMX virtual machine has only one data type - the cell. So we have two natives to convert a cell to a float and vice versa. Because cells differ from platform to platform, we use REAL which is a float or a double depending on the cellsize. amx_ctof convers a cell to a REAL and amx_ftoc converts a REAL to a cell. Note we have to return the result as a cell, not a REAL.
Here is the variadic version using multiple parameters:
PHP://native prototype: Float:amx_fProduct({Float}:...); static cell AMX_NATIVE_CALL amx_product(AMX *amx, cell *params) { int i = 0; REAL sum = 1; cell *addr = NULL; int numParams = *params/sizeof(cell); for (i=1; i<=numParams; i++) { addr = MF_GetAmxAddr(amx, params[i]); sum *= amx_ctof(*addr); } return amx_ftoc(sum); }
Now, what about strings? There are two issues with strings. Strings are basically arrays, which means each character is a 32bit cell, not a char. To help convert there is a function called MF_GetAmxString:
PHP:char *MF_GetAmxString(AMX *amx, cell addr, int bufferId, int *length);
Buffer IDs are from 0 to 3. They copy the string to a static, non-reentrant buffer. This means you can only use this function with 4 string parameters, and that it is not thread safe!
Next, you can "set" strings using MF_SetAmxString. Let's wrap this section up with a super-example. This function will take in a vector (Float:vec[3]), a string, then multiply the vector by the integer value in the string, then set the result as a string and return a float:
PHP://Float:amx_weird(Float:vec[3], const str[], result[], maxlen) static cell AMX_NATIVE_CALL amx_weird(AMX *amx, cell *params) { int len = 0; cell *vec = MF_GetAmxAddr(amx, params[1]); char *str = MF_GetAmxString(amx, params[2], 0, &len); REAL prod = amx_ctof(vec[0]) * amx_ctof(vec[1]) * amx_ctof(vec[2]); prod *= atoi(str); char buf[20]; itoa((int)prod, buf, 10); //amx, dest addr, source, max length MF_SetAmxString(amx, params[3], buf, params[4]); return amx_ftoc(prod); }
So how do you glue your natives to small scripts? This is a two step process.
First, go to moduleconfig.h and uncomment this line:
PHP:// #define FN_AMXX_ATTACH OnAmxxAttach
Then add this somewhere into your module's main file (let's call it mymodule.cpp):
PHP:AMX_NATIVE_INFO my_Natives[] = { {"amx_fproduct", amx_fProduct}, {"amx_weird", amx_weird}, {NULL, NULL}, };
This creates a list describing what natives you want to add to Small plugins. The list is formatted as Name, Function, Name, Function, etc. Terminate the list with NULLs. Now create this function:
PHP:void OnAmxxAttach() { MF_AddNatives(my_Natives); }
Now your functions are available to plugins! The last step is to actually make an include file. Example mymodule.inc:
PHP:#if defined _mymodule_included #endinput #endif #define _mymodule_included //Multiply all the float parameters passed and return the result. native Float:amx_fproduct({Float}:...); //This function is just weird! native Float:amx_weird(Float:vec[3], const numStr[], retstr[], maxLen);
You're done!

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <zombieplague>
#include <fakemeta_util>
#include <engine>
#define PLUGIN "He Touch"
#define AUTHOR "Dias"
#define VERSION "1.0"
#define RADIUS 500.0 // Affect radius
#define MAX_PLAYERS 32
new cvar_impactexplode
new g_MaxPlayers // --> là cái này
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR )
cvar_impactexplode = register_cvar("he_impactexplode", "1")
RegisterHam(Ham_Touch, "grenade", "bacon_touch_grenade")
g_MaxPlayers = get_maxplayers ( ) // --> Và cái này nữa, dùng làm j`
}
public bacon_touch_grenade(ent, world)
{
if(!get_pcvar_num(cvar_impactexplode))
return HAM_IGNORED
static model[12]
pev(ent, pev_model, model, 11)
if(model[9] == 'h' && model[10] == 'e')
{
set_pev(ent, pev_dmgtime, 0.0)
return HAM_HANDLED
}
return HAM_IGNORED
}
Không có thân hình nào hoàn hảoNo Body Perfect...

// Phần khai báo
new cvar_fast_food
public plugin_init()
cvar_fast_food = register_cvar("wtf_is_this","1")
public use_function()
if( get_pcvar_num(cvar_fast_food) >= 1 )
// Làm gì đó
public another_function()
if( get_pcvar_float(cvar_fast_food) == 5.1 )
// Làm j tùy ý
public function_with_static()
static Float:i_am_a_static
i_am_a_static = get_pcvar_num(cvar_fast_food) // Gán 1 giá trị cho i_am_a_static
client_print(0,print_chat,"Can I get this static %0.f " ,i_am_a_static) // Không báo lỗi
public function_not_static()
client_print(0,print_chat,"Can I get this static %0.f " ,i_am_a_static) // Sẽ báo lỗi undefined !


CHo em hỏi làm sao để tạo 1 sự kiẹn sang round mới, xóa spr ở round cũ ạ?
Sang round mới thì phải xài đến module round_terminator. Sang round mới là tự động xóa sprite
Tôi ko cần module cũng làm đc
Facepalm toàn tập![]()
![]()