Merged in original TSFun
This commit is contained in:
parent
ea05af9fe8
commit
a17b879380
|
@ -32,7 +32,6 @@
|
|||
#include "amxxmodule.h"
|
||||
#include "tsfun.h"
|
||||
|
||||
|
||||
void Client_ResetHUD_End(void* mValue)
|
||||
{
|
||||
if ( mPlayer->IsAlive() )
|
||||
|
|
|
@ -44,6 +44,137 @@
|
|||
#define TSPWUP_ARMOR 128
|
||||
#define TSPWUP_SUPERJUMP 256
|
||||
|
||||
static cell AMX_NATIVE_CALL get_weapon_name(AMX *amx, cell *params)
|
||||
{ // from id to name 3 params id, name, len
|
||||
|
||||
int id = params[1];
|
||||
if (id<0 || id>=TSMAX_WEAPONS)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||
return 0;
|
||||
}
|
||||
return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL wpnlog_to_name(AMX *amx, cell *params)
|
||||
{ // from log to name
|
||||
|
||||
int iLen;
|
||||
char *log = MF_GetAmxString(amx,params[1],0,&iLen);
|
||||
int i;
|
||||
for ( i=1; i<TSMAX_WEAPONS; i++ )
|
||||
{
|
||||
if ( strcmp(log,weaponData[i].logname ) == 0 )
|
||||
return MF_SetAmxString(amx,params[2],weaponData[i].name,params[3]);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL wpnlog_to_id(AMX *amx, cell *params)
|
||||
{ // from log to id
|
||||
int iLen;
|
||||
char *log = MF_GetAmxString(amx,params[1],0,&iLen);
|
||||
|
||||
int i;
|
||||
for ( i=1; i<TSMAX_WEAPONS; i++ )
|
||||
{
|
||||
if ( strcmp(log,weaponData[i].logname) == 0 )
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_weapon_logname(AMX *amx, cell *params)
|
||||
{ // from id to log
|
||||
int id = params[1];
|
||||
if (id<0 || id>=TSMAX_WEAPONS)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||
return 0;
|
||||
}
|
||||
return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
if (id<1 || id>=TSMAX_WEAPONS)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( weaponData[id].melee )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL ts_get_user_weapon(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
int wpn = pPlayer->current;
|
||||
|
||||
cell *cpTemp = MF_GetAmxAddr(amx,params[2]);
|
||||
*cpTemp = pPlayer->weapons[wpn].clip;
|
||||
|
||||
cpTemp = MF_GetAmxAddr(amx,params[3]);
|
||||
*cpTemp = pPlayer->weapons[wpn].ammo;
|
||||
|
||||
cpTemp = MF_GetAmxAddr(amx,params[4]);
|
||||
*cpTemp = pPlayer->weapons[wpn].mode;
|
||||
|
||||
cpTemp = MF_GetAmxAddr(amx,params[5]);
|
||||
*cpTemp = pPlayer->weapons[wpn].attach;
|
||||
|
||||
return wpn;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
int wpn = pPlayer->current;
|
||||
|
||||
cell *cpTemp = MF_GetAmxAddr(amx,params[2]);
|
||||
*cpTemp = pPlayer->weapons[wpn].clip;
|
||||
|
||||
cpTemp = MF_GetAmxAddr(amx,params[3]);
|
||||
*cpTemp = pPlayer->weapons[wpn].ammo;
|
||||
|
||||
return wpn;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_user_cash(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
pPlayer->SetMoney(params[2]);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_cash(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
return pPlayer->GetMoney();
|
||||
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL set_user_slots(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
|
@ -63,6 +194,231 @@ static cell AMX_NATIVE_CALL get_user_slots(AMX *amx, cell *params)
|
|||
return pPlayer->GetSlots();
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_space(AMX *amx, cell *params){
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
return pPlayer->space;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_pwup(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
cell *cpTemp = MF_GetAmxAddr(amx,params[2]);
|
||||
*cpTemp = pPlayer->PwUpValue;
|
||||
|
||||
return pPlayer->PwUp;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_user_items(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
return pPlayer->items;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_killingStreak(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
return pPlayer->killingSpree;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_lastFrag(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
return pPlayer->lastFrag;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_killflags(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
return pPlayer->killFlags;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL give_weapon(AMX *amx, cell *params)
|
||||
{
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
if ( !pPlayer->IsAlive() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// can he carry this weapon check ?
|
||||
|
||||
string_t item = MAKE_STRING("ts_groundweapon");
|
||||
edict_t *pent = CREATE_NAMED_ENTITY( item );
|
||||
if ( FNullEnt( pent ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
KeyValueData pkvd;
|
||||
char szTemp[16];
|
||||
|
||||
sprintf(szTemp,"%d",(int)params[2]);
|
||||
|
||||
pkvd.szClassName = (char *)STRING(pent->v.classname);
|
||||
pkvd.szKeyName = "tsweaponid"; // weapon
|
||||
pkvd.szValue = szTemp;
|
||||
pkvd.fHandled = false;
|
||||
MDLL_KeyValue(pent, &pkvd);
|
||||
|
||||
pkvd.szClassName = (char *)STRING(pent->v.classname);
|
||||
pkvd.szKeyName = "wduration"; // duration
|
||||
pkvd.szValue = "180";
|
||||
pkvd.fHandled = false;
|
||||
MDLL_KeyValue(pent, &pkvd);
|
||||
|
||||
sprintf(szTemp,"%d",(int)params[3]);
|
||||
|
||||
pkvd.szClassName = (char *)STRING(pent->v.classname);
|
||||
pkvd.szKeyName = "wextraclip"; // clips
|
||||
pkvd.szValue = szTemp;
|
||||
pkvd.fHandled = false;
|
||||
MDLL_KeyValue(pent, &pkvd);
|
||||
|
||||
sprintf(szTemp,"%d",(int)params[4]);
|
||||
|
||||
pkvd.szClassName = (char *)STRING(pent->v.classname);
|
||||
pkvd.szKeyName = "spawnflags"; // attachements :flashlight,lasersight,scope..
|
||||
pkvd.szValue = szTemp;
|
||||
pkvd.fHandled = false;
|
||||
MDLL_KeyValue(pent, &pkvd);
|
||||
|
||||
/*
|
||||
pkvd.szClassName = "ts_groundweapon";
|
||||
pkvd.szKeyName = "message";
|
||||
pkvd.szValue = "";
|
||||
pMDLL_KeyValue(pEntity, &pkvd);
|
||||
*/
|
||||
|
||||
MDLL_Spawn(pent);
|
||||
|
||||
pent->v.origin = pPlayer->pEdict->v.origin;
|
||||
|
||||
MDLL_Use(pent, pPlayer->pEdict);
|
||||
|
||||
REMOVE_ENTITY(pent);
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL create_pwup(AMX *amx, cell *params)
|
||||
{
|
||||
|
||||
string_t item = MAKE_STRING("ts_powerup");
|
||||
edict_t *pent = CREATE_NAMED_ENTITY( item );
|
||||
if ( FNullEnt( pent ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
KeyValueData pkvd;
|
||||
char szTemp[16];
|
||||
|
||||
sprintf(szTemp,"%d",(int)params[1]);
|
||||
|
||||
pkvd.szClassName = (char *)STRING(pent->v.classname);
|
||||
pkvd.szKeyName = "pwuptype"; // type
|
||||
pkvd.szValue = szTemp;
|
||||
pkvd.fHandled = false;
|
||||
MDLL_KeyValue(pent, &pkvd);
|
||||
|
||||
pkvd.szClassName = (char *)STRING(pent->v.classname);
|
||||
pkvd.szKeyName = "pwupduration"; // duration
|
||||
pkvd.szValue = "60";
|
||||
pkvd.fHandled = false;
|
||||
MDLL_KeyValue(pent, &pkvd);
|
||||
|
||||
/*
|
||||
pkvd.szClassName = (char *)STRING(pent->v.classname);
|
||||
pkvd.szKeyName = "message";
|
||||
pkvd.szValue = "";
|
||||
pMDLL_KeyValue(pEntity, &pkvd);
|
||||
*/
|
||||
cell *vInput = MF_GetAmxAddr(amx,params[2]);
|
||||
|
||||
float fNewX = *(float *)((void *)&vInput[0]);
|
||||
float fNewY = *(float *)((void *)&vInput[1]);
|
||||
float fNewZ = *(float *)((void *)&vInput[2]);
|
||||
|
||||
vec3_t vNewValue = vec3_t(fNewX, fNewY, fNewZ);
|
||||
|
||||
MDLL_Spawn(pent);
|
||||
pent->v.origin = vNewValue;
|
||||
|
||||
return ENTINDEX(pent);
|
||||
}
|
||||
|
||||
// create_pwup -> !wait! -> give_pwup
|
||||
static cell AMX_NATIVE_CALL give_pwup(AMX *amx, cell *params)
|
||||
{
|
||||
|
||||
edict_t* pent = INDEXENT(params[2]);
|
||||
if ( FNullEnt( pent ) || strcmp("ts_powerup",STRING(pent->v.classname))!=0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int id = params[1];
|
||||
CHECK_PLAYER(id);
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
|
||||
if ( !pPlayer->IsAlive() )
|
||||
{
|
||||
REMOVE_ENTITY(pent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pent->v.origin = pPlayer->pEdict->v.origin;
|
||||
|
||||
MDLL_Touch(pent, pPlayer->pEdict);
|
||||
|
||||
REMOVE_ENTITY(pent);
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_maxweapons(AMX *amx, cell *params)
|
||||
{
|
||||
return TSMAX_WEAPONS;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL is_custom(AMX *amx, cell *params)
|
||||
{
|
||||
int weapon = params[1];
|
||||
if ( weapon < TSMAX_WEAPONS-TSMAX_CUSTOMWPNS )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// set_fuattack(Float:time,Float:damage)
|
||||
static cell AMX_NATIVE_CALL set_fuattack(AMX *amx, cell *params)
|
||||
{
|
||||
|
@ -303,12 +659,47 @@ static cell AMX_NATIVE_CALL force_powerup_run(AMX *amx, cell *params)
|
|||
|
||||
|
||||
AMX_NATIVE_INFO base_Natives[] = {
|
||||
|
||||
{ "xmod_get_wpnname", get_weapon_name },
|
||||
{ "xmod_get_wpnlogname", get_weapon_logname },
|
||||
{ "xmod_is_melee_wpn", is_melee },
|
||||
{ "xmod_get_maxweapons", get_maxweapons },
|
||||
{ "xmod_is_custom_wpn", is_custom },
|
||||
|
||||
//****************************************
|
||||
|
||||
{ "ts_giveweapon",give_weapon },
|
||||
{ "ts_createpwup",create_pwup },
|
||||
{ "ts_givepwup",give_pwup },
|
||||
|
||||
{ "get_weaponname", get_weapon_name },
|
||||
{ "get_user_weapon", get_user_weapon },
|
||||
|
||||
{ "ts_wpnlogtoname", wpnlog_to_name },
|
||||
{ "ts_wpnlogtoid", wpnlog_to_id },
|
||||
{ "ts_getuserwpn", ts_get_user_weapon },
|
||||
|
||||
//****************************************
|
||||
|
||||
{ "ts_getusercash", get_user_cash },
|
||||
{ "ts_setusercash", set_user_cash },
|
||||
|
||||
{ "ts_getuserslots", get_user_slots },
|
||||
{ "ts_setuserslots", set_user_slots },
|
||||
|
||||
{ "ts_getusertime",get_usertime },
|
||||
{ "ts_setusertime",set_usertime},
|
||||
|
||||
{ "ts_getuserspace", get_user_space },
|
||||
{ "ts_getuserpwup",get_user_pwup },
|
||||
{ "ts_getuseritems",get_user_items },
|
||||
|
||||
{ "ts_getkillingstreak",get_killingStreak },
|
||||
{ "ts_getuserlastfrag",get_lastFrag },
|
||||
{ "ts_getuserkillflags",get_killflags },
|
||||
|
||||
//****************************************
|
||||
|
||||
{ "ts_set_fuattack", set_fuattack },
|
||||
{ "ts_set_message", set_user_message },
|
||||
{ "ts_get_message", get_user_message },
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
#define __MODULECONFIG_H__
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "TSFUN"
|
||||
#define MODULE_VERSION "1.00"
|
||||
#define MODULE_NAME "TSFun"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "Twilight Suzuka"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "TSFUN"
|
||||
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
|
||||
// #define MODULE_RELOAD_ON_MAPCHANGE
|
||||
#define MODULE_RELOAD_ON_MAPCHANGE
|
||||
|
||||
#ifdef __DATE__
|
||||
#define MODULE_DATE __DATE__
|
||||
|
|
|
@ -297,7 +297,8 @@ void OnAmxxAttach() {
|
|||
gKnifeOffset = TSKNIFE_OFFSET;
|
||||
|
||||
MF_AddNatives( stats_Natives );
|
||||
MF_AddNatives( base_Natives );
|
||||
//TSFun does these now
|
||||
//MF_AddNatives( base_Natives );
|
||||
|
||||
const char* path = get_localinfo("tsstats_score","addons/amxmodx/data/tsstats.amxx");
|
||||
if ( path && *path )
|
||||
|
|
Loading…
Reference in New Issue
Block a user