Updated cs_set_user_team to include model

This commit is contained in:
Johnny Bergström 2004-04-06 07:40:51 +00:00
parent 8ef66cee8c
commit 24791ac315
4 changed files with 108 additions and 53 deletions

View File

@ -507,11 +507,12 @@ static cell AMX_NATIVE_CALL cs_get_user_team(AMX *amx, cell *params) // cs_get_u
return (int)*((int *)pPlayer->pvPrivateData + OFFSET_TEAM); return (int)*((int *)pPlayer->pvPrivateData + OFFSET_TEAM);
} }
static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_user_team(index, team); = 2 params static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_user_team(index, team, model = 0); = 3 params
{ {
// Set user team // Set user team
// params[1] = user index // params[1] = user index
// params[2] = team // params[2] = team
// params[3] = model = 0
// Valid entity should be within range // Valid entity should be within range
if (params[1] < 1 || params[1] > gpGlobals->maxClients || !g_players[params[1]].GetOnline()) if (params[1] < 1 || params[1] > gpGlobals->maxClients || !g_players[params[1]].GetOnline())
@ -529,8 +530,12 @@ static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_u
return 0; return 0;
} }
int model = params[3];
// Just set team. Removed check of 1-2-3, because maybe scripters want to create new teams, 4, 5 etc? // Just set team. Removed check of 1-2-3, because maybe scripters want to create new teams, 4, 5 etc?
*((int *)pPlayer->pvPrivateData + OFFSET_TEAM) = params[2]; *((int *)pPlayer->pvPrivateData + OFFSET_TEAM) = params[2];
if (model != 0)
*((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = model;
/*switch (params[2]) { /*switch (params[2]) {
case TEAM_T: case TEAM_T:

View File

@ -56,7 +56,7 @@ LINK32=link.exe
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# Begin Special Build Tool # Begin Special Build Tool
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PostBuild_Cmds=echo Copying dll... copy Release\cstrike.dll K:\S\cstrike\addons\amxx\modules\cstrike_amx.dll echo Copying inc... copy ..\plugins\include\cstrike.inc K:\S\cstrike\addons\amxx\scripting\include\ PostBuild_Cmds=echo Copying dll... copy Release\cstrike.dll K:\S\cstrike\addons\amxx\modules\cstrike_amx.dll echo Copying inc... copy ..\plugins\include\cstrike.inc K:\S\cstrike\addons\amxx\scripting\include\
# End Special Build Tool # End Special Build Tool
!ELSEIF "$(CFG)" == "cstrike - Win32 Debug" !ELSEIF "$(CFG)" == "cstrike - Win32 Debug"
@ -86,7 +86,7 @@ LINK32=link.exe
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/cstrike_amx.dll" /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/cstrike_amx.dll" /pdbtype:sept
# Begin Special Build Tool # Begin Special Build Tool
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PostBuild_Cmds=copy Debug\cstrike_amx.dll k:\s\cstrike\addons\amxx\modules\ copy ..\plugins\include\cstrike.inc k:\s\cstrike\addons\amxx\scripting\include\ PostBuild_Cmds=copy Debug\cstrike_amx.dll k:\s\cstrike\addons\amxx\modules\ copy ..\plugins\include\cstrike.inc k:\s\cstrike\addons\amxx\scripting\include\
# End Special Build Tool # End Special Build Tool
!ENDIF !ENDIF

View File

@ -89,6 +89,7 @@ pfnmodule_engine_g* g_engModuleFunc;
// "player" entities // "player" entities
#define OFFSET_TEAM 114 + EXTRAOFFSET // same as STEAM #define OFFSET_TEAM 114 + EXTRAOFFSET // same as STEAM
#define OFFSET_CSMONEY 115 + EXTRAOFFSET // same as STEAM #define OFFSET_CSMONEY 115 + EXTRAOFFSET // same as STEAM
//#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET // unconfirmed with WON!
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET // same as STEAM #define OFFSET_NVGOGGLES 129 + EXTRAOFFSET // same as STEAM
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET // same as STEAM #define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET // same as STEAM
#define OFFSET_VIP 215 + EXTRAOFFSET // same as STEAM #define OFFSET_VIP 215 + EXTRAOFFSET // same as STEAM
@ -121,6 +122,7 @@ pfnmodule_engine_g* g_engModuleFunc;
// "player" entities // "player" entities
#define OFFSET_TEAM 114 + EXTRAOFFSET #define OFFSET_TEAM 114 + EXTRAOFFSET
#define OFFSET_CSMONEY 115 + EXTRAOFFSET #define OFFSET_CSMONEY 115 + EXTRAOFFSET
#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET #define OFFSET_NVGOGGLES 129 + EXTRAOFFSET
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET #define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET
#define OFFSET_VIP 215 + EXTRAOFFSET #define OFFSET_VIP 215 + EXTRAOFFSET
@ -209,7 +211,6 @@ pfnmodule_engine_g* g_engModuleFunc;
#define DEFUSER_COLOUR_B 0 #define DEFUSER_COLOUR_B 0
#define HAS_NVGOGGLES (1<<0) #define HAS_NVGOGGLES (1<<0)
#define MODELRESETTIME 1.0
// cstrike-specific defines above // cstrike-specific defines above
// Globals below // Globals below

View File

@ -10,114 +10,163 @@
#endif #endif
#define _cstrike_included #define _cstrike_included
/* Returns player deaths. */ /* Returns player deaths.
*/
native cs_get_user_deaths(index); native cs_get_user_deaths(index);
/* Sets player deaths. */ /* Sets player deaths.
*/
native cs_set_user_deaths(index, newdeaths); native cs_set_user_deaths(index, newdeaths);
/* Returns index of entity (does not have to be a player) which hostage is following. 0 is hostage doesn't follow anything. */ /* Returns index of entity (does not have to be a player) which hostage is following. 0 is hostage doesn't follow anything.
*/
native cs_get_hostage_foll(index); native cs_get_hostage_foll(index);
/* Set hostage to follow entity specified in followedindex. Does not have to be a player. If followedindex is 0 the hostage will stop following. */ /* Set hostage to follow entity specified in followedindex. Does not have to be a player. If followedindex is 0 the hostage will stop following.
*/
native cs_set_hostage_foll(index, followedindex = 0); native cs_set_hostage_foll(index, followedindex = 0);
/* Get unique hostage id. */ /* Get unique hostage id.
*/
native cs_get_hostage_id(index); native cs_get_hostage_id(index);
/* Get amount of ammo in backpack on a user for a specific weapon. /* Get amount of ammo in backpack on a user for a specific weapon.
* Look in amxconst.inc for weapon types: CSW_*. * Look in amxconst.inc for weapon types: CSW_*.
* Weapons on the same line uses the same ammo type: * Weapons on the same line uses the same ammo type:
* awm * awm
* scout, ak, g3 * scout, ak, g3
* para * para
* famas, m4a1, aug, sg550, galil, sg552 * famas, m4a1, aug, sg550, galil, sg552
* m3, xm * m3, xm
* usp, ump, mac * usp, ump, mac
* fiveseven, p90 * fiveseven, p90
* deagle * deagle
* p228 * p228
* glock, mp5, tmp, elites * glock, mp5, tmp, elites
* flash * flash
* he * he
* smoke */ * smoke
*/
native cs_get_user_bpammo(index, weapon); native cs_get_user_bpammo(index, weapon);
/* Restock/remove ammo in a user's backpack. */ /* Restock/remove ammo in a user's backpack.
*/
native cs_set_user_bpammo(index, weapon, amount); native cs_set_user_bpammo(index, weapon, amount);
/* Returns 1 if user has a defuse kit. */ /* Returns 1 if user has a defuse kit.
*/
native cs_get_user_defuse(index); native cs_get_user_defuse(index);
/* If defusekit is 1, the user will have a defuse kit. /* If defusekit is 1, the user will have a defuse kit.
* You can specify a different colour for the defuse kit icon showing on hud. Default is the normal green. * You can specify a different colour for the defuse kit icon showing on hud. Default is the normal green.
* You can specify an icon. Default is "defuser". Set flash to 1 if you want the icon to flash red. */ * You can specify an icon. Default is "defuser". Set flash to 1 if you want the icon to flash red.
*/
native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0); native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0);
/* Is user in buyzone? Returns 1 when true, 0 when false. */ /* Is user in buyzone? Returns 1 when true, 0 when false.
*/
native cs_get_user_buyzone(index); native cs_get_user_buyzone(index);
/* Get user model. */ /* Get user model.
*/
native cs_get_user_model(index, model[], len); native cs_get_user_model(index, model[], len);
/* Set user model. */ /* Set user model.
*/
native cs_set_user_model(index, const model[]); native cs_set_user_model(index, const model[]);
/* Use to reset model to standard selected model. */ /* Use to reset model to standard selected model.
*/
native cs_reset_user_model(index); native cs_reset_user_model(index);
/* Returns users money. */ /* Returns users money.
*/
native cs_get_user_money(index); native cs_get_user_money(index);
/* Gives money to user. If flash is 1, the difference between new and old amount will flash red or green. */ /* Gives money to user. If flash is 1, the difference between new and old amount will flash red or green.
*/
native cs_set_user_money(index, money, flash = 1); native cs_set_user_money(index, money, flash = 1);
/* Does user have night vision goggles? */ /* Does user have night vision goggles?
*/
native cs_get_user_nvg(index); native cs_get_user_nvg(index);
/* Set nvgoggles to 1 to give night vision goggles to index. Set it to 0 to remove them. */ /* Set nvgoggles to 1 to give night vision goggles to index. Set it to 0 to remove them.
*/
native cs_set_user_nvg(index, nvgoggles = 1); native cs_set_user_nvg(index, nvgoggles = 1);
/* Returns 1 if user has the "skill" to plant bomb, else 0. Normally this would only be true for a terrorist carrying a bomb. */ /* Returns 1 if user has the "skill" to plant bomb, else 0. Normally this would only be true for a terrorist carrying a bomb.
*/
native cs_get_user_plant(index); native cs_get_user_plant(index);
/* If plant is 1, a user will be set to be able to plant bomb within the usual bomb target areas if having one. /* If plant is 1, a user will be set to be able to plant bomb within the usual bomb target areas if having one.
* You should use this if you give a player a weapon_c4, or he won't be able to plant it * You should use this if you give a player a weapon_c4, or he won't be able to plant it
* without dropping it and picking it up again (only possible for terrorists). * without dropping it and picking it up again (only possible for terrorists).
* If showbombicon is 1, the green C4 icon will be shown on user hud (if plant "skill" was enabled). */ * If showbombicon is 1, the green C4 icon will be shown on user hud (if plant "skill" was enabled).
*/
native cs_set_user_plant(index, plant = 1, showbombicon = 1); native cs_set_user_plant(index, plant = 1, showbombicon = 1);
/* Get team directly from player's entity. /* Get team directly from player's entity.
* 1 = terrorist * 1 = terrorist
* 2 = counter-terrorist * 2 = counter-terrorist
* 3 = spectator */ * 3 = spectator
*/
enum CsTeams {
CS_TEAM_T = 1,
CS_TEAM_CT = 2,
CS_TEAM_SPECTATOR = 3
};
native cs_get_user_team(index); native cs_get_user_team(index);
/* Set user team without killing player (so you can move hostages, plant bomb etc as terrorist). */ /* Set user team without killing player (so you can move hostages, plant bomb etc as terrorist).
native cs_set_user_team(index, team); * Note: Effect may vary between different versions of CS.
* If model is anything other than 0, that will be set as player's model.
* Model updates when player spawns.
*/
enum CsInternalModel {
CS_DONTCHANGE = 0,
CS_CT_URBAN = 1,
CS_T_TERROR = 2,
CS_T_LEET = 3,
CS_T_ARCTIC = 4,
CS_CT_GSG9 = 5,
CS_CT_GIGN = 6,
CS_CT_SAS = 7,
CS_T_GUERILLA = 8,
CS_CT_VIP = 9
};
native cs_set_user_team(index, team, model = CS_DONTCHANGE);
/* Is user vip? */ /* Is user vip? Returns 1 if true, 0 if false.
*/
native cs_get_user_vip(index); native cs_get_user_vip(index);
/* If vip = 1, user is set to vip. Note that this is useful to unset vips, so they can change teams properly. /* If vip = 1, user is set to vip. Note that this is useful to unset vips, so they can change teams properly.
* This will not change the player's model to/from vip, or add/remove the "VIP" text in scoreboard. */ * This will not change the player's model to/from vip, or add/remove the "VIP" text in scoreboard.
*/
native cs_set_user_vip(index, vip = 1); native cs_set_user_vip(index, vip = 1);
/* Returns 1 if specified weapon is in burst mode. */ /* Returns 1 if specified weapon is in burst mode.
*/
native cs_get_weapon_burst(index); native cs_get_weapon_burst(index);
/* If burstmode = 1, weapon will be changed to burst mode, 0 and non-burst mode (semiautomatic/automatic) will be activated. /* If burstmode = 1, weapon will be changed to burst mode, 0 and non-burst mode (semiautomatic/automatic) will be activated.
* Only GLOCK and FAMAS can enter/leave burst mode. */ * Only GLOCK and FAMAS can enter/leave burst mode.
*/
native cs_set_weapon_burst(index, burstmode = 1); native cs_set_weapon_burst(index, burstmode = 1);
/* Returns 1 if weapon is silenced, else 0. */ /* Returns 1 if weapon is silenced, else 0.
*/
native cs_get_weapon_silen(index); native cs_get_weapon_silen(index);
/* If silence = 1, weapon will be silenced, 0 and silencer will be removed. Only USP and M4A1 can be silenced. */ /* If silence = 1, weapon will be silenced, 0 and silencer will be removed. Only USP and M4A1 can be silenced.
*/
native cs_set_weapon_silen(index, silence = 1); native cs_set_weapon_silen(index, silence = 1);
/* Returns amount of ammo in weapon's clip. */ /* Returns amount of ammo in weapon's clip.
*/
native cs_get_weapon_ammo(index); native cs_get_weapon_ammo(index);
/* Set amount of ammo in weapon's clip. */ /* Set amount of ammo in weapon's clip.
*/
native cs_set_weapon_ammo(index, newammo); native cs_set_weapon_ammo(index, newammo);