Raised This Month: $ Target: $400
 0% 

Simple question [Still need help :( ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-27-2011 , 17:53   Re: Simple question [Solved]
Reply With Quote #1

I mean hook "HLTV" event as roundstart, when players spawn.
Still, I dunno for sure if it triggers before any player spawn... so you might want to set_task(0.1, ...) on player_spawn()
__________________
Hunter-Digital is offline
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 06-27-2011 , 17:59   Re: Simple question [Solved]
Reply With Quote #2

But if i trigger it on GetCrysis the first round will be passed and crisis will only start from round two (I don't know why but it only Triggers round two and so on)And i wanted to ask you is there player id 0 ?

Last edited by usaexelent; 06-27-2011 at 18:14.
usaexelent is offline
Send a message via Skype™ to usaexelent
FoxueR
Senior Member
Join Date: Jun 2011
Old 06-27-2011 , 18:53   Re: Simple question [Solved]
Reply With Quote #3

To loop through all players, use:

PHP Code:
new gMaxPlayers

// ...

public plugin_init()
{
    
gMaxPlayers get_maxplayers()
}

// ...

for ( new player 1player <= gMaxPlayersplayer++ )
{
    if ( 
is_user_connectedplayer ) )
    {
        
// do something
    
}

Player id 0 is either the server itself or, in some cases (such as for client_print()) a dummy number that instructs a function to perform the operation on all clients. This doesn't apply to cs_set_user_team().
__________________
¯\_(ツ)_/¯
FoxueR is offline
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 06-28-2011 , 04:32   Re: Simple question [Solved]
Reply With Quote #4

It seems that CurWeapon event doesn't work and every body has Crisis skins.THIS IS MY CODE:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <fakemeta> 
#include <hamsandwich>


// Define player models

#define CTMDL "models/player/CTMDL/CTMDL.mdl"
#define TMDL "models/player/TMDL/TMDL.mdl"

// Define T player models

#define CTMDLT "models/player/CTMDL/CTMDLT.mdl"
#define TMDLT "models/player/TMDL/TMDLT.mdl"

// Create arrays that will hold location to weapon models

new VIEW_MODELKNIFE[]    = "models/CRYSMOD/c_v_knife.mdl"  
new VIEW_MODELAUG[]    = "models/CRYSMOD/c_v_aug.mdl" 
new VIEW_MODELUSP[]    = "models/CRYSMOD/c_v_usp.mdl" 
new PLAYER_MODELAUG[]    = "models/CRYSMOD/c_p_aug.mdl"  


new Crysis// Holder for Crisis player id
new iRand// The random player id

// Precache models and sounds for alter use

public plugin_precache() 

    
precache_model(CTMDL)
    
precache_model(TMDL)
    
precache_model(CTMDLT)
    
precache_model(TMDLT)
    
precache_model(VIEW_MODELKNIFE); 
    
precache_model(VIEW_MODELAUG);  
    
precache_model(VIEW_MODELUSP);  
    
precache_model(PLAYER_MODELAUG);
    
precache_sound("boost.wav");
}


public 
plugin_init() 

    
register_plugin("Someting","0.1","usaexelent"); // Register plugin info
    
    
    
register_event"CurWeapon""Event_CurWeapon""be""1=1" ); // Register curweapon 
    
register_event("HLTV""GetCrysis""a""1=0""2=0")  //Register new round
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1); //Register spawn
    
RegisterHam(Ham_Killed"player""Player_Death"1//0 = before death 1 = after 



public 
Event_CurWeaponid 

if(
is_user_aliveid ) || Crysis == id  

    

    switch( 
read_data(2) ) 
    { 
        case 
CSW_KNIFE
        { 
            
set_pevidpev_viewmodel2VIEW_MODELKNIFE); // set models 
            
set_user_rendering(idkRenderFxGlowShell211kRenderTransTexture50// set visibility 
            
set_user_maxspeed(id, -1.0)
        } 
        case 
CSW_USP
        { 
            
set_pevidpev_viewmodel2VIEW_MODELUSP); // set models
            
set_user_rendering(id)
            
set_user_maxspeed(id, -1.0)
        } 
        case 
CSW_AUG
        { 
            
set_pevidpev_viewmodel2VIEW_MODELAUG); // set models 
            
set_pevidpev_weaponmodel2PLAYER_MODELAUG ); // set models
            
set_user_rendering(id)
            
set_user_maxspeed(id, -1.0)
        } 
        default: 
    { 
    
set_user_rendering(id);  
    } 
     }
}
return 
PLUGIN_CONTINUE;


public 
GetCrysis( ) 
{
    new 
iPlayers32 ], iNum
    
get_playersiPlayersiNum"h" ); 
    
iRand iPlayersrandomiNum ) ]; // Get random player 
    
Crysis iRand;  // Set the randplayer to be crisis :) 




public 
Player_Spawn_Post(id)
{
    if(
Crysis == id)
    {
                if(
is_user_alive(id))
           {
            
cs_set_user_team(idCS_TEAM_CT)
           }
                else
           {
            
cs_set_user_team(idCS_TEAM_T)
           }
    }
}

public 
player_death(idkillergib// callback for Ham_Killed hook
{
    if(
Crysis == id// if "crysis" died, clear his flag
    
{
        
Crysis 0

        
// and other stuff
    
}
}

public 
client_disconnect(id)
{
    if(
Crysis == id)
    {
    
GetCrysis()
    }


Last edited by usaexelent; 06-28-2011 at 05:09.
usaexelent is offline
Send a message via Skype™ to usaexelent
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-28-2011 , 06:21   Re: Simple question [Still need help :( ]
Reply With Quote #5

PHP Code:
if(is_user_aliveid ) || Crysis == id  
=>
PHP Code:
if(  Crysis == id && is_user_aliveid )  ) 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 06-28-2011 , 06:26   Re: Simple question [Still need help :( ]
Reply With Quote #6

I'll try.
usaexelent is offline
Send a message via Skype™ to usaexelent
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 06-28-2011 , 06:34   Re: Simple question [Still need help :( ]
Reply With Quote #7

it works.
usaexelent is offline
Send a message via Skype™ to usaexelent
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 23:32.


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