Raised This Month: $ Target: $400
 0% 

Set players view


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-04-2013 , 16:18   Set players view
Reply With Quote #1

Hello. I have a 2 questions..
Help me please with this:

1. how can i set view of ALL dead players \ spectators to FORCECHASECAM of last 2 alive players on map?

There are 2 alive players on map remaining (1 in TERR team, 1 - in CT team).
PHP Code:
for(new <= g_iMaxPlayers i++) {
if(!
is_user_alive(i) || cs_get_user_team == CS_TEAM_SPECTATOR || cs_get_user_team == CS_TEAM_UNASSIGNED) {

/*..there is command to change view mode to free chase cam of 2 alive players (dead CT -> to last alive CT, dead T - to last alive T, spectators - randomly (to T or CT) 
2. Is possible to dropping bomb (when alive player drop the bomb or dead player drop the bomb) directly perpendicular of the floor? Without range..
Attached Thumbnails
Click image for larger version

Name:	01.jpg
Views:	305
Size:	16.4 KB
ID:	114100   Click image for larger version

Name:	2.jpg
Views:	189
Size:	16.3 KB
ID:	114101  
__________________
sorry my bad english...

Last edited by alonelive; 01-04-2013 at 16:26.
alonelive is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-04-2013 , 17:05   Re: Set players view
Reply With Quote #2

add to 1st question:
i have a code which calculate those 2 last alive players (ex. iPlayerLastT and iPlayerLastCT. I need only a command to set camera view to this players (free chase cam).

PHP Code:
for(new <= g_iMaxPlayers i++) {
   if(!
is_user_alive(i)) {

      if(
cs_get_user_team(i) == CS_TEAM_T) {
      
set_camera(iforcechasecam,  iPlayerLastT)
      } else

      if(
cs_get_user_team(i) == CS_TEAM_T) {
      
set_camera(iforcechasecam,  iPlayerLastCT)
      } else

      if(
cs_get_user_team(i) == CS_TEAM_SPECTATOR) {
      
set_camera(iforcechasecamrandom[iPlayerLastCTiPlayerLastT])
      }
   }

something like this..
__________________
sorry my bad english...

Last edited by alonelive; 01-04-2013 at 17:07.
alonelive is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-05-2013 , 06:07   Re: Set players view
Reply With Quote #3

First question i solve.
Help me with c4 code please (q. № 2)
__________________
sorry my bad english...
alonelive is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-05-2013 , 06:23   Re: Set players view
Reply With Quote #4

You can show how you have resolved it, so others can also see it.
I will try todo something with the c4 and will post later.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-05-2013 , 07:56   Re: Set players view
Reply With Quote #5

Alright I tried todo something. It will for sure give you the idea what I have done or make it better since I just used natives from all modules. Not that it is bad, just use the right natives and it is fine.

In that code I basically removed the c4 drop from a player and c4 drop by dieing. It creates an entity with the c4 model and hooks the touch and gives the c4 to that player.

Keep in mind, that I have added a code that the owner of the last thrower of the c4 can't pickup it anymore, since he would pick it right up if he drops it.

PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "C4 Drop"
#define VERSION "1.0"
#define AUTHOR "AMXX Community"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Killed"player""Ham_CBasePlayer_Killed_Pre"0)
    
    
register_touch("weapon_c4_custom""player""TouchBomb")
    
    
register_clcmd("drop""DropBomb")
}

public 
Ham_CBasePlayer_Killed_Pre(iVictim)
{
    if(
user_has_weapon(iVictimCSW_C4))
    {
        new 
Float:origin[3]
        
pev(iVictim,pev_origin,origin)
        
        
ham_strip_c4(iVictim"weapon_c4")
        
create_c4(iVictimorigin)
    }
}

public 
DropBomb(id)
{
    if(
is_user_alive(id) && get_user_weapon(id) == CSW_C4)
    {
        new 
Float:iOrigin[3]
        
pev(idpev_originiOrigin)
        
        
ham_strip_c4(id"weapon_c4")
        
create_c4(idiOrigin)
        
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

create_c4(idFloat:iOrigin[3])
{
    new 
C4 create_entity("func_wall")
    
    
entity_set_string(C4EV_SZ_classname"weapon_c4_custom")
    
entity_set_model(C4"models/w_backpack.mdl")
    
entity_set_int(C4EV_INT_solidSOLID_TRIGGER)
    
entity_set_size(C4Float:{-2.0,-2.0,-2.0}, Float:{2.0,2.0,2.0})
    
entity_set_edict(C4EV_ENT_ownerid)
    
    
entity_set_origin(C4iOrigin)
    
    
drop_to_floor(C4)
}

public 
TouchBomb(C4id)
{
    new 
owner entity_get_edict(C4EV_ENT_owner)
    
    if(
owner == id)
        return
   
    
give_item(id"weapon_c4")
    
remove_entity(C4)
}

ham_strip_c4(id,weapon[])
{
    new 
wId get_weaponid(weapon);
    if(!
wId) return 0;

    new 
wEnt;
    while((
wEnt engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    if(!
wEnt) return 0;

    if(
get_user_weapon(id) == wIdExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);

    if(!
ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
    
ExecuteHamB(Ham_Item_Kill,wEnt);

    
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));

    
cs_set_user_plant(id,0,0);
    
cs_set_user_bpammo(id,CSW_C4,0);
    
    return 
1;

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-05-2013 , 11:58   Re: Set players view
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
//#include <cstrike>

// "weaponbox"
const XO_CWEAPONBOX 4
const m_rgpWeaponBoxItems_Slot0 34

const PDATA_SAFE 2

public plugin_init() 
{
    
register_plugin("Drop C4 perpendicular to floor""0.1""meTaLiCroSS")
    
    
register_forward(FM_SetModel"fw_SetModel")
}

public 
fw_SetModel(iEntId, const szModel[])
{
    if(
pev_valid(iEntId) != PDATA_SAFE)
        return;
        
    new 
szClassName[32]
    
pev(iEntIdpev_classnameszClassNamecharsmax(szClassName))
    
    if(
equal(szClassName"weaponbox"))
    {
        new 
iWeaponEntId get_pdata_cbase(iEntIdm_rgpWeaponBoxItems_Slot0 5XO_CWEAPONBOX)
        
        if(
pev_valid(iWeaponEntId/* == 2 && cs_get_weapon_id(iWeaponEntId) == CSW_C4 */// no need to check pvPrivateData because we are just going to modify an entvar
            
set_pev(iEntIdpev_velocityFloat:{ 0.00.0, -2.0 })
    } 
}

// cstrike commented because the C4 is the unique weapon which uses the 5th slot 
Try that one.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross

Last edited by meTaLiCroSS; 01-05-2013 at 11:59.
meTaLiCroSS is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-05-2013 , 12:28   Re: Set players view
Reply With Quote #7

Quote:
Originally Posted by bibu View Post
You can show how you have resolved it, so others can also see it.
I will try todo something with the c4 and will post later.
Of course This is a very simple way(without fakemeta, set_camera, etc):


PHP Code:
server_cmd("mp_forcechasecam 1"//(dead CT can view ONLY alive CT, dead T - only alive T. No need to search users in CS_TEAM_T, CS_TEAM_CT, etc)
client_cmd(0"spec_mode 2")  // all dead \ spec players switch their modes to Free Chase Cam 
about c4:
bibu: thank you for work, but bomb falls so far (see screenshot);
meTaLiCroSS: thank you too, works fine.
Attached Thumbnails
Click image for larger version

Name:	de_dust20014.jpg
Views:	133
Size:	98.2 KB
ID:	114117  
__________________
sorry my bad english...

Last edited by alonelive; 01-05-2013 at 12:29.
alonelive is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-05-2013 , 15:29   Re: Set players view
Reply With Quote #8

My code should work fine, I tested it. But just use metalicross' version, since it is much more better.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-06-2013 , 03:52   Re: Set players view
Reply With Quote #9

Quote:
Originally Posted by bibu View Post
My code should work fine, I tested it. But just use metalicross' version, since it is much more better.
Your code is also useful to me, but for other project (in future) ) Thnk
__________________
sorry my bad english...
alonelive is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode