AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple question [Still need help :( ] (https://forums.alliedmods.net/showthread.php?t=160162)

usaexelent 06-25-2011 15:57

Simple question [Still need help :( ]
 
How to make that player on other round wouldn't be crysis?

This is my code (And please don't rip this code or my idea)
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <fun>


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 bool:Crysis33 ]; // Holder for whether player is Crysis or not


public plugin_precache()
{
    
precache_model(VIEW_MODELKNIFE);
    
precache_model(VIEW_MODELAUG); 
    
precache_model(VIEW_MODELUSP); 
    
precache_model(PLAYER_MODELAUG);
}

public 
plugin_init()
{
    
register_event"CurWeapon""Event_CurWeapon""be""1=1" ); // Register curweapon
    
register_logevent("GetCrysis"2"1=Round_Start"
    
register_clcmd("say /boost""GetCrysis")
}


public 
Event_CurWeaponid )
{
    if( !
is_user_aliveid ) || !Crysisid ] )
        return 
PLUGIN_CONTINUE;
    
    switch( 
get_user_weaponid ) )
    {
        case 
CSW_KNIFE:
        {
            
set_pevidpev_viewmodel2VIEW_MODELKNIFE); // set models
            
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0// set visibility
        
}
        case 
CSW_USP:
        {
            
set_pevidpev_viewmodel2VIEW_MODELUSP); // set models
        
}
        case 
CSW_AUG:
        {
            
set_pevidpev_viewmodel2VIEW_MODELAUG); // set models
            
set_pevidpev_weaponmodel2PLAYER_MODELAUG ); // set models
        
}
        default:
        {
        
set_user_rendering(id,kRenderFxNone,255,255,255,kRenderNormal,16); 
        }
    }
}

public 
GetCrysisid )
{
Crysis[id] = false;
new 
iPlayers32 ], iNum;
get_playersiPlayersiNum );
new 
iRand randomiNum ); // Get random player

CrysisiPlayersiRand ] ] = true// Set the array index to true

client_print(iRandprint_chat"You are Crysis now!"); 



usaexelent 06-25-2011 16:06

Re: Simple question
 
I Tried this:

public GetCrysis( id )
{
Crysis[id] = false; // This line
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum );
new iRand = random( iNum ); // Get random player

Crysis[ iPlayers[ iRand ] ] = true; // Set the array index to true

client_print(iRand, print_chat, "You are Crysis now!");
}

Hunter-Digital 06-25-2011 17:45

Re: Simple question
 
RoundStart logevent doesn't parse a "id", so you're basically always setting Crysis[0] = false
You don't need an entire array if there can be only 1 player at a time, just set a variable to the player id.
Also, I don't think you're getting random player ID right... since player IDs can have gaps... meaning, 4 players are in-game... and their entity ids can be: 1,2,5 and 16, but that get_players() returns 4, and you'll have only 1-4 range which will fk up your random player.


PS: I'm quite curious what you mean by "You are Crysis", that just sounds wrong.
The suit is named "nanosuit" and "Crysis" is "crisis" (search translation), Crytek likes to use their name in every game they make.

usaexelent 06-26-2011 05:23

Re: Simple question
 
Could some one correct my mistakes because I don't know how to correct them.

2reason2kill 06-26-2011 05:59

Re: Simple question
 
Quote:

Originally Posted by usaexelent (Post 1496759)
Could some one correct my mistakes because I don't know how to correct them.

I think u must make the boolean False on round start.

usaexelent 06-26-2011 06:09

Re: Simple question [Still need help]
 
Thats what i did

ConnorMcLeod 06-26-2011 06:22

Re: Simple question [Still need help]
 
PHP Code:

#include <amxmodx> 
#include <fakemeta> 
#include <fun> 


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 bool:Crysis33 ]; // Holder for whether player is Crysis or not 


public plugin_precache() 

    
precache_model(VIEW_MODELKNIFE); 
    
precache_model(VIEW_MODELAUG);  
    
precache_model(VIEW_MODELUSP);  
    
precache_model(PLAYER_MODELAUG); 


public 
plugin_init() 

    
register_event"CurWeapon""Event_CurWeapon""be""1=1" ); // Register curweapon 
    
register_logevent("GetCrysis"2"1=Round_Start")  
    
register_clcmd("say /boost""GetCrysis"



public 
Event_CurWeaponid 

    if( !
is_user_aliveid ) || !Crysisid ] ) 
        return 
PLUGIN_CONTINUE
     
    switch( 
read_data(2) ) 
    { 
        case 
CSW_KNIFE
        { 
            
set_pevidpev_viewmodel2VIEW_MODELKNIFE); // set models 
            
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0// set visibility 
        

        case 
CSW_USP
        { 
            
set_pevidpev_viewmodel2VIEW_MODELUSP); // set models
            
set_user_rendering(id)
        } 
        case 
CSW_AUG
        { 
            
set_pevidpev_viewmodel2VIEW_MODELAUG); // set models 
            
set_pevidpev_weaponmodel2PLAYER_MODELAUG ); // set models
            
set_user_rendering(id)
        } 
        default: 
        { 
            
set_user_rendering(id);  
        } 
    } 


public 
GetCrysis( ) 
{
    
arrayset(Crysissizeof(Crysis), false);

    new 
iPlayers32 ], iNum
    
get_playersiPlayersiNum"h" ); 
    new 
iRand iPlayersrandomiNum ) ]; // Get random player 

    
CrysisiRand ] = true// Set the array index to true 

    
client_print(iRandprint_chat"You are Crysis now!");  



usaexelent 06-26-2011 06:50

Re: Simple question [Still need help]
 
It still doesn't work. On new round my skins doesn't change. That means that the Crysis array is still true and setarray didn't work. ;(

2reason2kill 06-26-2011 08:31

Re: Simple question [Still need help]
 
Quote:

Originally Posted by usaexelent (Post 1496799)
It still doesn't work. On new round my skins doesn't change. That means that the Crysis array is still true and setarray didn't work. ;(

I havent test This, I think i should work.

PHP Code:

#include <amxmodx> 
#include <fakemeta> 
#include <fun>
#include <hamsandwich>


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 bool:Crysis33 ]; // Holder for whether player is Crysis or not 


public plugin_precache() 

    
precache_model(VIEW_MODELKNIFE); 
    
precache_model(VIEW_MODELAUG);  
    
precache_model(VIEW_MODELUSP);  
    
precache_model(PLAYER_MODELAUG); 


public 
plugin_init() 

    
register_plugin("Someting","0.1","usaexelent");
    
register_event"CurWeapon""Event_CurWeapon""be""1=1" ); // Register curweapon 
    
register_logevent("GetCrysis"2"1=Round_Start")  
    
register_clcmd("say /boost""GetCrysis"
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1);



public 
Event_CurWeaponid 

    if( !
is_user_aliveid ) || !Crysisid ] ) 
        return 
PLUGIN_CONTINUE
     
    switch( 
read_data(2) ) 
    { 
        case 
CSW_KNIFE
        { 
            
set_pevidpev_viewmodel2VIEW_MODELKNIFE); // set models 
            
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0// set visibility 
        

        case 
CSW_USP
        { 
            
set_pevidpev_viewmodel2VIEW_MODELUSP); // set models
            
set_user_rendering(id)
        } 
        case 
CSW_AUG
        { 
            
set_pevidpev_viewmodel2VIEW_MODELAUG); // set models 
            
set_pevidpev_weaponmodel2PLAYER_MODELAUG ); // set models
            
set_user_rendering(id)
        } 
        default: 
        { 
            
set_user_rendering(id);  
        } 
    } 


public 
GetCrysis( ) 
{
    
arrayset(Crysissizeof(Crysis), false);

    new 
iPlayers32 ], iNum
    
get_playersiPlayersiNum"h" ); 
    new 
iRand iPlayersrandomiNum ) ]; // Get random player 

    
CrysisiRand ] = true// Set the array index to true 

    
client_print(iRandprint_chat"You are Crysis now!");  
}
public 
Player_Spawn_Post(id)
{
    
Crysis[id] = false;
}
public 
client_connect(id)
{
    
Crysis[id] = false;
}
public 
client_disconnect(id)
{
    
Crysis[id] = false;


If somthing is Wrong Plz Correct me!

usaexelent 06-26-2011 09:34

Re: Simple question [Still need help]
 
It works ! Thank you. When i finish this plugin your going to be in my credit list :)


All times are GMT -4. The time now is 23:32.

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