amxmodx/plugins/include/tsfun.inc

199 lines
5.0 KiB
SourcePawn
Raw Normal View History

// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// TSFUN Functions
//
2005-08-02 02:21:47 +04:00
2005-08-25 11:13:48 +04:00
#if defined _tsxfun_included
#endinput
2005-08-02 02:21:47 +04:00
#endif
2005-08-25 11:13:48 +04:00
#define _tsxfun_included
2005-08-02 02:21:47 +04:00
2006-02-26 11:15:12 +03:00
#include <tsx>
2005-08-02 02:21:47 +04:00
#include <tsconst>
2005-08-25 11:13:48 +04:00
/************* Shared Natives Start ********************************/
/* Forward types */
enum {
XMF_DAMAGE = 0,
XMF_DEATH,
};
2005-08-25 11:13:48 +04:00
#pragma reqlib tsfun
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib tsfun
2006-05-10 14:42:49 +04:00
#endif
2005-08-02 02:21:47 +04:00
2005-08-25 11:13:48 +04:00
/************* Shared Natives End ********************************/
2005-08-02 02:21:47 +04:00
/* Function is called just before a kung foo attack is done,
2006-02-26 11:15:12 +03:00
* damage and time length may be altered with natives.
* Return PLUGIN_HANDLED to stop attack.
* UNAVAILABLE IN 1.70
*/
forward Melee_Attack(id,Float:time,Float:damage,UNAVAILABLE);
2005-08-25 11:13:48 +04:00
// Returns when someone stunts, after they do it.
2006-02-26 11:15:12 +03:00
//UNAVAILABLE IN 1.70
forward client_stunt(id,stunttype,UNAVAILABLE);
2005-08-02 02:21:47 +04:00
/* Function is called when powerups are ran,
2006-02-26 11:15:12 +03:00
* Returns value of powerup. Use TSPWUP_*'s
* to find exactly which one it is.
* UNAVAILABLE IN 1.70
*/
forward client_powerup(id,powerup,UNAVAILABLE);
2005-08-02 02:21:47 +04:00
2005-08-25 11:13:48 +04:00
/* weapon logname to weapon name convertion */
native ts_wpnlogtoname(const logname[],name[],len);
2005-08-25 11:13:48 +04:00
/* weapon logname to weapon index convertion */
native ts_wpnlogtoid(const logname[]);
2005-08-02 02:21:47 +04:00
2006-02-26 11:15:12 +03:00
//UNAVAILABLE IN 1.70
//native Float:ts_getusertime( index ); //!
//native ts_setusertime( index, Float:time ); //!
2005-08-02 02:21:47 +04:00
2005-08-25 11:13:48 +04:00
native ts_getusercash( index );
native ts_setusercash( index, money );
2005-08-02 02:21:47 +04:00
native ts_getuserslots( index );
native ts_setuserslots( index, slots );
native ts_getuserstate( index );
native ts_getuserwpn( index,&clip=0,&ammo=0,&mode=0,&extra=0 );
2005-08-25 11:13:48 +04:00
native ts_getuserspace( index );
native ts_getuserkillflags(killer);
native ts_getkillingstreak( index );
native ts_getuserlastfrag( index );
native ts_giveweapon( index,weapon,clips,extra );
native ts_getuserpwup( index );
2015-03-11 16:19:27 +03:00
stock ts_has_slowmo(id) {
return (ts_getuserpwup(id) &TSPWUP_SLOWMO);
}
stock ts_has_infammo(id) {
return (ts_getuserpwup(id) &TSPWUP_INFAMMO);
}
stock ts_has_slowpause(id) {
return (ts_getuserpwup(id) &TSPWUP_SLOWPAUSE);
}
stock ts_has_dfirerate(id) {
return (ts_getuserpwup(id) &TSPWUP_DFIRERATE);
}
stock ts_has_grenade(id) {
return (ts_getuserpwup(id) &TSPWUP_GRENADE);
}
stock ts_has_health(id) {
return (ts_getuserpwup(id) &TSPWUP_HEALTH);
}
stock ts_has_armor(id) {
return (ts_getuserpwup(id) &TSPWUP_ARMOR);
}
2005-08-25 11:13:48 +04:00
/* Function will create pwup entity and return its index (pwupent) */
native ts_createpwup( pwup );
2005-08-02 02:21:47 +04:00
2005-08-25 11:13:48 +04:00
native ts_givepwup( index,pwupent );
2005-08-02 02:21:47 +04:00
2005-08-25 11:13:48 +04:00
native ts_setpddata( knifeoffset );
2005-08-02 02:21:47 +04:00
// Alters a fu attack. Use with fu forward
2006-02-26 11:15:12 +03:00
// UNAVAILABLE IN 1.70
// native ts_set_fuattack(id,Float:time,Float:damage); //!
2005-08-02 02:21:47 +04:00
// Changes board message
native ts_set_message(id,message);
2005-08-02 02:21:47 +04:00
// Gets the message board message
native ts_get_message(id);
2005-08-02 02:21:47 +04:00
stock ts_is_normal(id)
{
new msg = ts_get_message(id);
2005-08-02 02:21:47 +04:00
if( (msg > 11) || (msg > 6 && msg < 10) ) return 1;
return 0;
}
2015-03-11 16:19:27 +03:00
stock ts_is_waiting(id) {
return (ts_get_message(id) == TSMSG_WAITING);
}
stock ts_is_dead(id) {
return (ts_get_message(id) == TSMSG_DEAD);
}
stock ts_is_killer(id) {
return (ts_get_message(id) == TSMSG_KILLER);
}
stock ts_is_demolition(id) {
return (ts_get_message(id) == TSMSG_DEMOLITION);
}
stock ts_is_specialist(id) {
return (ts_get_message(id) == TSMSG_SPECIALIST);
}
stock ts_is_unstoppable(id) {
return (ts_get_message(id) == TSMSG_UNSTOPPABLE);
}
stock ts_is_theone(id) {
return (ts_get_message(id) == TSMSG_THEONE);
}
2005-08-02 02:21:47 +04:00
// Return one on true, 0 on false
2006-02-26 11:15:12 +03:00
// UNAVAILABLE IN 1.70
2006-03-04 14:05:59 +03:00
native ts_has_superjump(id); //!
native ts_has_fupowerup(id); //!
native ts_is_in_slowmo(id);
2005-08-02 02:21:47 +04:00
// Get and set consecutive frags
2006-02-26 11:15:12 +03:00
//UNAVAILABLE IN 1.70
//native ts_get_cons_frags(id);
//native ts_set_cons_frags(id,num);
2005-08-02 02:21:47 +04:00
// Set to see cool bullet trails. Only id will see them.
2006-02-26 11:15:12 +03:00
native ts_set_bullettrail(id,yesorno);
2005-08-02 02:21:47 +04:00
// Sets fake versions of slow mo and slow pause. Use ts_set_speed for more options.
native ts_set_fakeslowmo(id,Float:time);
native ts_set_fakeslowpause(id,Float:time);
2005-08-02 02:21:47 +04:00
/* Sets speed artificially. 1.0 is default, Go into fractions and decimals for slower
* and put in higher numbers for higher speeds. Aura is how far things around you are effected
* Time is the time until it wears off. 0.0 for speed will freeze people. Do not use negatives. */
native ts_set_speed(id,Float:speed,Float:auradist,Float:time);
2005-08-02 02:21:47 +04:00
/* Sets physics speed artificially. Things like sparks and sounds will be effected.
* Any negative number will render all physics paused. */
native ts_set_physics_speed(id,Float:speed);
2005-08-02 02:21:47 +04:00
// Returns 0 if no powerup is running. Returns the powerup type otherwise.
native ts_is_running_powerup(id);
2005-08-02 02:21:47 +04:00
// Highly experimental command which overrides powerup types.
// Use if a powerup is already running, or if a powerup is not running.
// Safe to use in powerup forward.
native ts_force_run_powerup(id,PWUP_TYPE);