AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HELP|with plugin 2 (https://forums.alliedmods.net/showthread.php?t=167868)

Mr_Boris 09-21-2011 07:25

HELP|with plugin 2
 
i have in my JB mod Zombie Day :


PHP Code:

public ZombieDay(id)
{
    new 
iPlayers[32]
    
zombie_day true
    
new iNum
    
new id
 
    get_players
iPlayersiNum )
    
server_cmd("bh_enabled 0")
    for( new 
0iNumi++ )
    {
        
id iPlayers[i]
        if( !
is_user_aliveid ) )
        {
            continue;
        }
      
        
ColorChat(0RED"^4%s Today Is Zombie"PREFIX)
        
g_ZMCount ZMCount;
        
set_task1.0 "ZombieCount" "a" g_ZMCount );
        
jail_open()
  
        if (
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
strip_user_weapons(id)
            
give_item(id"weapon_knife")
            
set_user_health(id30000)
            
cs_set_user_model(id,"zombie")
        }
        
        if (
cs_get_user_team(id) == CS_TEAM_T)
        {
               
            
strip_user_weapons(id)
            
give_item(id"weapon_m4a1")
            
give_item(id"weapon_ak47")
            
give_item(id"weapon_deagle")
            
cs_set_user_bpammo(idCSW_M4A19999)
            
cs_set_user_bpammo(idCSW_AK479999)
            
cs_set_user_bpammo(idCSW_DEAGLE9999)
            
set_user_health(id100)
        }
    }



i want in that day if CT player have weapon that not aknife tath will do to hem strip weapon and give a knife



Sorry for the bad English

e12harry 09-21-2011 07:52

Re: HELP|with plugin 2
 
I don't know anything about Zombie Mod but:
1. You pass id as a parameter to a fuction:
PHP Code:

public ZombieDay(id
{ ... 

and than you create new variable with the same name:
PHP Code:

 new id 

You can not do that. My sugestion is to change
PHP Code:

public ZombieDay(id

to
PHP Code:

public ZombieDay(callingId

where callingId will be id of a player who uses the command

2. Also I don't get this:
PHP Code:

 ColorChat(0RED"^4%s Today Is Zombie"PREFIX
 
g_ZMCount ZMCount
 
set_task1.0 "ZombieCount" "a" g_ZMCount ); 
 
jail_open() 



this will be executed for each alive player :
if you have 10 alive players ColorChat will be printed 10 times to all players
you will have 10 tasks
you will call jail_open() 10 times.
g_ZMCount and ZMCount are always the same. You are not changing them inside the loop

Maybe it should be after the for loop?

Mr_Boris 09-21-2011 08:13

Re: HELP|with plugin 2
 
can you just help me with my REQ?

e12harry 09-21-2011 08:33

Re: HELP|with plugin 2
 
You could try this:
PHP Code:

public ZombieDay(callerId)
{
    new 
iPlayers[32]
    
zombie_day true
    
new iNum
    
new id
    
new CsTeams:team;
    
get_playersiPlayersiNum )
    
server_cmd("bh_enabled 0")
    for( new 
0iNumi++ )
    {
        
id iPlayers[i]
        if( !
is_user_aliveid ) )
        {
            continue;
        }
        
team cs_get_user_team(id);
        switch(
team)
        {
            case 
CS_TEAM_CT:
            {
                
strip_user_weapons(id)
                
give_item(id"weapon_knife")
                
set_user_health(id30000)
                
cs_set_user_model(id,"zombie")
            }
            case 
CS_TEAM_T:
            {
                
strip_user_weapons(id)
                
give_item(id"weapon_m4a1")
                
give_item(id"weapon_ak47")
                
give_item(id"weapon_deagle")
                
cs_set_user_bpammo(idCSW_M4A19999)
                
cs_set_user_bpammo(idCSW_AK479999)
                
cs_set_user_bpammo(idCSW_DEAGLE9999)
                
set_user_health(id100)
            }
        }
    }
    
ColorChat(0RED"^4%s Today Is Zombie"PREFIX)
    
g_ZMCount ZMCount;
    
set_task1.0 "ZombieCount" "a" g_ZMCount );
    
jail_open()


but still I don't know what is this:

PHP Code:

ColorChat(0RED"^4%s Today Is Zombie"PREFIX)
g_ZMCount ZMCount;
set_task1.0 "ZombieCount" "a" g_ZMCount );
jail_open() 

Tell me what you want to display with CororChat, what are g_ZMCount and ZMCount,
what do functions ZombieCount and jail_open do,


All times are GMT -4. The time now is 19:43.

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