AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Little Help (https://forums.alliedmods.net/showthread.php?t=252633)

Obada 12-06-2014 12:02

Little Help
 
Hello,

Sorry For Requesting Help Multiple Times Today, Anyways, I was adding a plugin made by pokemonmaster, Which is Ghost Walking Mode. This One.

The Plugin was made for Admins, Golden Players, Silver Players. So I Decided To Add Diamond and Bronze Players into the code, but since I Don't know that much in Coding AMXX Plugins, I had Two Errors Which are :
  • (209 -- 210) : error 001: expected token ")", but found ";"
  • (209 -- 210) : error 001: expected token ",", but found ";"

Here is The Code Originally Made By Pokemonmaster:

PHP Code:

#include <amxmodx>   
#include <cstrike>      
#include <fun>  
#include <engine>     

/* ------------------- EDIT STUFF ------------------ */  
// If you want a big HUD message, just remove the // before #define  
//#define BIG_HUD  

// if you want to completely remove sounds, just put // before #define  
#define WITH_SOUNDS  

#define ADMIN        ADMIN_BAN  
#define SILVER       ADMIN_LEVEL_G  
#define GOLDEN       ADMIN_LEVEL_H  
/* ------------- No editing below this point ------- */  


new g_max_clients   
new CsTeams:g_iActivatorTeam   
new bool:g_bGhostRunning false   

#if defined BIG_HUD   
#include <dhudmessage>    
#endif   

// DO NOT EDIT THIS    
#define FINAL        (ADMIN|SILVER|GOLDEN)  
#define IsValidPlayer(%1)    (1 <= %1 <= g_max_clients)  

#if defined WITH_SOUNDS  

#define oooo_TASKID    142715  

enum  
{  
    
PIANO 0,  
    
KILL,  
    
oooo  
}  

new 
g_szGhostSounds[][] = {  
    
"piano",  
    
"ghost_kill",  
    
"ooo0ooo"  
}  
new 
Float:g_fWooOooODuration  
#endif  

new g_pBlockWeaponPickUp 

new const gsz_MODELNAME[] = "dpt_ghost2"  


public plugin_precache()  
{  
    new 
szFilePath[100]  
    
formatex(szFilePathcharsmax(szFilePath), "models/player/%s/%s.mdl"gsz_MODELNAMEgsz_MODELNAME)  
    
precache_model(szFilePath)  
     
    
#if defined WITH_SOUNDS  
    
for(new isizeof(g_szGhostSounds); i++)  
    {  
        
formatex(szFilePathcharsmax(szFilePath), "ghost/%s.wav"g_szGhostSounds[i])  
        
precache_sound(szFilePath)  
    }  
    
#endif  
}  

public 
plugin_init()      
{      
    
register_plugin"Ghost WaLKING MOD""0.0.5""Freestyle/pokemonmaster" );      
    
register_concmd("amx_ghostwalker""gwm", FINAL, "*- Activates ghostwalking mode")  
    
register_event("HLTV""NewRound""a""1=0""2=0")  
     
    
#if defined WITH_SOUNDS  
    
register_event("DeathMsg""eDeath""a")  
    
#endif  
     
    
register_touch("armoury_entity""player""fw_PickUp"
    
register_touch("weaponbox""player""fw_PickUp"
     
    
g_pBlockWeaponPickUp register_cvar("gw_block_weapon_pickup""1"
     
    
g_max_clients get_maxplayers()  
}  

public 
fw_PickUp(iEntid

    if(
g_bGhostRunning && is_user_alive(id) && cs_get_user_team(id) == g_iActivatorTeam && get_pcvar_num(g_pBlockWeaponPickUp)) 
        return 
PLUGIN_HANDLED 
         
    
return PLUGIN_CONTINUE 


#if defined WITH_SOUNDS  
public plugin_cfg()  
{  
    new 
szFilePath[101]  
    
formatex(szFilePath100"sound/ghost/%s.wav"g_szGhostSounds[oooo])  
    
g_fWooOooODuration GetWavDuration(szFilePath)  
}  
#endif  

//public event_round_end()  
public NewRound()   
{   
    if(
g_bGhostRunning)   
    {   
        for(new 
1<= g_max_clientsi++)   
        {   
            if(
is_user_connected(i))  
            {  
                if(
cs_get_user_team(i) == g_iActivatorTeam)  
                {  
                    
cs_reset_user_model(i)  
                    
set_user_noclip(i0)  
                    
#if defined WITH_SOUNDS                      
                    
if(task_exists(oooo_TASKID i))  
                        
remove_task(oooo_TASKID i)  
                        
#endif  
                
}  
            }  
        }  
         
        
g_bGhostRunning false  
        client_cmd
(0"stopsound")  
        
set_lights("#OFF")  
    }  
}  

public 
client_putinserver(id)  
{  
     
    if(
g_bGhostRunning)  
    {  
        
set_lights("d")  
        
#if defined WITH_SOUNDS  
        
set_task(g_fWooOooODuration"Ghost_Woo"oooo_TASKID id, .flags="b")  
        
#endif  
    
}  
}  

#if defined WITH_SOUNDS  
public client_disconnect(id)  

    if(
g_bGhostRunning)  
    { 
        if(
task_exists(oooo_TASKID id))  
        { 
            
remove_task(oooo_TASKID id)  
        } 
    } 

#endif  

#if defined WITH_SOUNDS  
public eDeath()  
{  
    if(
g_bGhostRunning)  
    {  
        new 
iKiller read_data(1)  
         
        if(
IsValidPlayer(iKiller) && cs_get_user_team(iKiller) == g_iActivatorTeam)  
            
client_cmd(0"spk ^"ghost/%s^""g_szGhostSounds[KILL])  
    }  
}  
#endif  

public gwm(idlevel)  
{      
    new 
iFlags get_user_flags(id)    
    
#if defined BIG_HUD   
    
set_dhudmessage01600, -1.00.2526.03.00.11.5 );   
    
#else   
    
set_hudmessage01600, -1.00.2526.03.00.11.5 );   
    
#endif   
     
    
if(!(iFlags level))    
    {    
        
#if defined BIG_HUD   
        
show_dhudmessage(id "You don't have acess to this command.");   
        
#else   
        
show_hudmessage(id "You don't have acess to this command.");   
        
#endif   
        
return PLUGIN_HANDLED    
    
}    
     
    
g_iActivatorTeam cs_get_user_team(id)   
     
    if( 
g_iActivatorTeam == CS_TEAM_SPECTATOR || g_iActivatorTeam == CS_TEAM_UNASSIGNED )   
    {    
        
#if defined BIG_HUD   
        
show_dhudmessage(id "You must join to a Team.");   
        
#else   
        
show_hudmessage(id "You must join to a Team.");   
        
#endif   
        
return PLUGIN_HANDLED    
    
}   
     
    
ghost_features()   
     
    new 
szName[32]  
    
get_user_name(idszNamecharsmax(szName))   
     
    
#if defined BIG_HUD   
    
show_dhudmessage(0"%s %s activated Ghost Walking Mode^nAll the %s team will be Ghosts", ( iFlags ADMIN "Admin" : ( iFlags SILVER "Silver Player" "Golden Player" ) ), szName, ( g_iActivatorTeam == CS_TEAM_T "Terrorist" "Counter-Terrorist" ) )   
    
#else   
    
show_hudmessage(0"%s %s activated Ghost Walking Mode^nAll the %s team will be Ghosts", ( iFlags ADMIN "Admin" : ( iFlags SILVER "Silver Player" "Golden Player" ) ), szName, ( g_iActivatorTeam == CS_TEAM_T "Terrorist" "Counter-Terrorist" ) )   
    
#endif  
     
    #if defined WITH_SOUNDS  
    
client_cmd(0"spk ^"ghost/%s^""g_szGhostSounds[PIANO])  
    
#endif  
     
    
set_lights("d")  
    
g_bGhostRunning true   
     
    
return PLUGIN_HANDLED    
}    

ghost_features()   
{      
    for(new 
1g_max_clients 1i++)   
    {   
        if(
is_user_alive(i))   
        {  
            if(
cs_get_user_team) == g_iActivatorTeam)     
            {    
                
strip_user_weapons(i)     
                
give_item(i,"weapon_usp")     
                
give_item(i,"weapon_knife")     
                
cs_set_user_bpammo(iCSW_USP250)     
                 
                
set_user_noclip(i1)     
                
cs_set_user_model(igsz_MODELNAME)  
            }   
             
            else    
cs_set_user_money(i160001)  
        }   
         
        
#if defined WITH_SOUNDS  
        
if(is_user_connected(i))  
            
Ghost_Woo(oooo_TASKID i)  
        
#endif  
    
}   
}  
#if defined WITH_SOUNDS  
public Ghost_Woo(taskid)  
{  
    new 
id taskid oooo_TASKID  
    client_cmd
(id"spk ^"ghost/%s^""g_szGhostSounds[oooo])  
     
    if(!
task_exists(taskid))  
        
set_task(g_fWooOooODuration"Ghost_Woo"taskid, .flags="b")  
}  

stock Float:GetWavDuration( const WavFile[] )  
{  
    new 
Frequence ];  
    new 
Bitrate   ];  
    new 
DataLength];  
    new 
File;  
     
    
// --| Open the file.  
    
File fopenWavFile"rb" );  
     
    
// --| Get the frequence from offset 24. ( Read 4 bytes )  
    
fseekFile24SEEK_SET );  
    
fread_blocksFileFrequence4BLOCK_INT );  
     
    
// --| Get the bitrate from offset 34. ( read 2 bytes )  
    
fseekFile34SEEK_SET );   
    
fread_blocksFileBitrate2BLOCK_BYTE );  
     
    
// --| Search 'data'. If the 'd' not on the offset 40, we search it.  
    
if ( fgetcFile ) != 'd' ) while( fgetcFile ) != 'd' && !feofFile ) ) {}  
     
    
// --| Get the data length from offset 44. ( after 'data', read 4 bytes )  
    
fseekFile3SEEK_CUR );   
    
fread_blocksFileDataLength4BLOCK_INT );  
     
    
// --| Close file.  
    
fcloseFile );  
     
    
// --| Calculate the time. ( Data length / ( frequence * bitrate ) / 8 ).  
    
return floatDataLength] ) / ( floatFrequence] * Bitrate] ) / 8.0 );  
}    
#endif 



And This One That I Edit It:

PHP Code:

#include <amxmodx>   
#include <cstrike>      
#include <fun>  
#include <engine>     

/* ------------------- EDIT STUFF ------------------ */  
// If you want a big HUD message, just remove the // before #define  
#define BIG_HUD  

// if you want to completely remove sounds, just put // before #define  
#define WITH_SOUNDS  

#define ADMIN        ADMIN_BAN  
#define DIAMOND      ADMIN_LEVEL_D
#define SILVER       ADMIN_LEVEL_G  
#define GOLDEN       ADMIN_LEVEL_H 
#define BRONZE       ADMIN_LEVEL_F 
/* ------------- No editing below this point ------- */  


new g_max_clients   
new CsTeams:g_iActivatorTeam   
new bool:g_bGhostRunning false   

#if defined BIG_HUD   
#include <dhudmessage>    
#endif   

// DO NOT EDIT THIS    
#define FINAL        (ADMIN|DIAMOND|SILVER|GOLDEN|BRONZE)  
#define IsValidPlayer(%1)    (1 <= %1 <= g_max_clients)  

#if defined WITH_SOUNDS  

#define oooo_TASKID    142715  

enum  
{  
    
PIANO 0,  
    
KILL,  
    
oooo  
}  

new 
g_szGhostSounds[][] = {  
    
"piano",  
    
"ghost_kill",  
    
"ooo0ooo"  
}  
new 
Float:g_fWooOooODuration  
#endif  

new g_pBlockWeaponPickUp 

new const gsz_MODELNAME[] = "dpt_ghost2"  


public plugin_precache()  
{  
    new 
szFilePath[100]  
    
formatex(szFilePathcharsmax(szFilePath), "models/player/%s/%s.mdl"gsz_MODELNAMEgsz_MODELNAME)  
    
precache_model(szFilePath)  
     
    
#if defined WITH_SOUNDS  
    
for(new isizeof(g_szGhostSounds); i++)  
    {  
        
formatex(szFilePathcharsmax(szFilePath), "ghost/%s.wav"g_szGhostSounds[i])  
        
precache_sound(szFilePath)  
    }  
    
#endif  
}  

public 
plugin_init()      
{      
    
register_plugin"Ghost WaLKING MOD""0.0.5""Freestyle/pokemonmaster" );      
    
register_concmd("ad_ghosts""gwm", FINAL, "*- Activates ghostwalking mode")  
    
register_event("HLTV""NewRound""a""1=0""2=0")  
     
    
#if defined WITH_SOUNDS  
    
register_event("DeathMsg""eDeath""a")  
    
#endif  
     
    
register_touch("armoury_entity""player""fw_PickUp"
    
register_touch("weaponbox""player""fw_PickUp"
     
    
g_pBlockWeaponPickUp register_cvar("gw_block_weapon_pickup""1"
     
    
g_max_clients get_maxplayers()  
}  

public 
fw_PickUp(iEntid

    if(
g_bGhostRunning && is_user_alive(id) && cs_get_user_team(id) == g_iActivatorTeam && get_pcvar_num(g_pBlockWeaponPickUp)) 
        return 
PLUGIN_HANDLED 
         
    
return PLUGIN_CONTINUE 


#if defined WITH_SOUNDS  
public plugin_cfg()  
{  
    new 
szFilePath[101]  
    
formatex(szFilePath100"sound/ghost/%s.wav"g_szGhostSounds[oooo])  
    
g_fWooOooODuration GetWavDuration(szFilePath)  
}  
#endif  

//public event_round_end()  
public NewRound()   
{   
    if(
g_bGhostRunning)   
    {   
        for(new 
1<= g_max_clientsi++)   
        {   
            if(
is_user_connected(i))  
            {  
                if(
cs_get_user_team(i) == g_iActivatorTeam)  
                {  
                    
cs_reset_user_model(i)  
                    
set_user_noclip(i0)  
                    
#if defined WITH_SOUNDS                      
                    
if(task_exists(oooo_TASKID i))  
                        
remove_task(oooo_TASKID i)  
                        
#endif  
                
}  
            }  
        }  
         
        
g_bGhostRunning false  
        client_cmd
(0"stopsound")  
        
set_lights("#OFF")  
    }  
}  

public 
client_putinserver(id)  
{  
     
    if(
g_bGhostRunning)  
    {  
        
set_lights("d")  
        
#if defined WITH_SOUNDS  
        
set_task(g_fWooOooODuration"Ghost_Woo"oooo_TASKID id, .flags="b")  
        
#endif  
    
}  
}  

#if defined WITH_SOUNDS  
public client_disconnect(id)  

    if(
g_bGhostRunning)  
    { 
        if(
task_exists(oooo_TASKID id))  
        { 
            
remove_task(oooo_TASKID id)  
        } 
    } 

#endif  

#if defined WITH_SOUNDS  
public eDeath()  
{  
    if(
g_bGhostRunning)  
    {  
        new 
iKiller read_data(1)  
         
        if(
IsValidPlayer(iKiller) && cs_get_user_team(iKiller) == g_iActivatorTeam)  
            
client_cmd(0"spk ^"ghost/%s^""g_szGhostSounds[KILL])  
    }  
}  
#endif  

public gwm(idlevel)  
{      
    new 
iFlags get_user_flags(id)    
    
#if defined BIG_HUD   
    
set_dhudmessage01600, -1.00.2526.03.00.11.5 );   
    
#else   
    
set_hudmessage01600, -1.00.2526.03.00.11.5 );   
    
#endif   
     
    
if(!(iFlags level))    
    {    
        
#if defined BIG_HUD   
        
show_dhudmessage(id "You don't have acess to this command.");   
        
#else   
        
show_hudmessage(id "You don't have acess to this command.");   
        
#endif   
        
return PLUGIN_HANDLED    
    
}    
     
    
g_iActivatorTeam cs_get_user_team(id)   
     
    if( 
g_iActivatorTeam == CS_TEAM_SPECTATOR || g_iActivatorTeam == CS_TEAM_UNASSIGNED )   
    {    
        
#if defined BIG_HUD   
        
show_dhudmessage(id "You must join to a Team.");   
        
#else   
        
show_hudmessage(id "You must join to a Team.");   
        
#endif   
        
return PLUGIN_HANDLED    
    
}   
     
    
ghost_features()   
     
    new 
szName[32]  
    
get_user_name(idszNamecharsmax(szName))   
     
    
#if defined BIG_HUD   
    
show_dhudmessage(0"%s %s activated Ghost Walking Mode^nAll the %s team will be Ghosts", ( iFlags ADMIN "Admin" : ( iFlags SILVER "Silver Player" : ( iFlags DIAMOND "Diamond Player" : ( iFlags BRONZE "Bronze Player" "Golden Player" ) ), szName, ( g_iActivatorTeam == CS_TEAM_T "Terrorist" "Counter-Terrorist" ) )   
    
#else   
    
show_hudmessage(0"%s %s activated Ghost Walking Mode^nAll the %s team will be Ghosts", ( iFlags ADMIN "Admin" : ( iFlags SILVER "Silver Player" "Golden Player" ) ), szName, ( g_iActivatorTeam == CS_TEAM_T "Terrorist" "Counter-Terrorist" ) )   
    
#endif  
     
    #if defined WITH_SOUNDS  
    
client_cmd(0"spk ^"ghost/%s^""g_szGhostSounds[PIANO])  
    
#endif  
     
    
set_lights("d")  
    
g_bGhostRunning true   
     
    
return PLUGIN_HANDLED    
}    

ghost_features()   
{      
    for(new 
1g_max_clients 1i++)   
    {   
        if(
is_user_alive(i))   
        {  
            if(
cs_get_user_team) == g_iActivatorTeam)     
            {    
                
strip_user_weapons(i)     
                
give_item(i,"weapon_usp")     
                
give_item(i,"weapon_knife")     
                
cs_set_user_bpammo(iCSW_USP250)     
                 
                
set_user_noclip(i1)     
                
cs_set_user_model(igsz_MODELNAME)  
            }   
             
            else    
cs_set_user_money(i160001)  
        }   
         
        
#if defined WITH_SOUNDS  
        
if(is_user_connected(i))  
            
Ghost_Woo(oooo_TASKID i)  
        
#endif  
    
}   
}  
#if defined WITH_SOUNDS  
public Ghost_Woo(taskid)  
{  
    new 
id taskid oooo_TASKID  
    client_cmd
(id"spk ^"ghost/%s^""g_szGhostSounds[oooo])  
     
    if(!
task_exists(taskid))  
        
set_task(g_fWooOooODuration"Ghost_Woo"taskid, .flags="b")  
}  

stock Float:GetWavDuration( const WavFile[] )  
{  
    new 
Frequence ];  
    new 
Bitrate   ];  
    new 
DataLength];  
    new 
File;  
     
    
// --| Open the file.  
    
File fopenWavFile"rb" );  
     
    
// --| Get the frequence from offset 24. ( Read 4 bytes )  
    
fseekFile24SEEK_SET );  
    
fread_blocksFileFrequence4BLOCK_INT );  
     
    
// --| Get the bitrate from offset 34. ( read 2 bytes )  
    
fseekFile34SEEK_SET );   
    
fread_blocksFileBitrate2BLOCK_BYTE );  
     
    
// --| Search 'data'. If the 'd' not on the offset 40, we search it.  
    
if ( fgetcFile ) != 'd' ) while( fgetcFile ) != 'd' && !feofFile ) ) {}  
     
    
// --| Get the data length from offset 44. ( after 'data', read 4 bytes )  
    
fseekFile3SEEK_CUR );   
    
fread_blocksFileDataLength4BLOCK_INT );  
     
    
// --| Close file.  
    
fcloseFile );  
     
    
// --| Calculate the time. ( Data length / ( frequence * bitrate ) / 8 ).  
    
return floatDataLength] ) / ( floatFrequence] * Bitrate] ) / 8.0 );  
}    
#endif 

Sorry If I may sound stupid, but I'm Learning. Thank You.

wickedd 12-06-2014 12:16

Re: Little Help
 
Place 2 ")" at the end of line 209, then you should be able to compile it.

Obada 12-06-2014 12:43

Re: Little Help
 
Quote:

Originally Posted by wickedd (Post 2231864)
Place 2 ")" at the end of line 209, then you should be able to compile it.

It's already there.

If I'm Wrong, Edit It For Me And Post The Code.

YamiKaitou 12-06-2014 12:44

Re: Little Help
 
Quote:

Originally Posted by Obada (Post 2231870)
It's already there.

If I'm Wrong, Edit It For Me And Post The Code.

Then add 2 more

Obada 12-06-2014 12:47

Re: Little Help
 
Thanks Both Of You, It Worked.

Obada 12-06-2014 14:30

Re: Little Help
 
I connected to the server using a Bronze Player, and when I activated the ghost mode, it said Golden Player Instead Of Bronze Player. Any Idea? :/


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

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