AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help fixing an old script (https://forums.alliedmods.net/showthread.php?t=134933)

BurningCa007 08-10-2010 10:57

Help fixing an old script
 
I've only been in the amxmodx bussiness for 3 hours :) and already got 66 plugins for my cs 1.6 lan server. I don't know how to make a script or what the hecks in them, just kinda figured out how to make the plugins work lolz. The flashy colors are nice tho XD

Anyway, I kinda found this plugin in the thread Police! Put your Hands Up! thread and there were comments on the addition of things to the script like to make the terrorist drop his weapons, more falshy colors YAY!, and theres no final version and I don't know how to add the stuff.

But I tried

And I gots web compiler errors and warnings:

/home/groups/amxmodx/tmp3/php6tYaGA.sma(45) : warning 200: symbol "call_scream_police_stuff_functi" is truncated to 31 characters
/home/groups/amxmodx/tmp3/php6tYaGA.sma(45) : error 017: undefined symbol "call_scream_police_stuff_functi"
/home/groups/amxmodx/tmp3/php6tYaGA.sma(48) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/php6tYaGA.sma(50) : error 017: undefined symbol "strip_user_weapons"


now for the script: (All credit goes to Anssik, I did not make this just need help to make it work)

/* AMX Mod X Script
*
* ============
* Police! v1.1
* by Anssik
* ============
*
* Made for request by NemesisDelta
* Sounds from SWAT4 :P
*
* When using console command "police" with appropiate user rights, it
* will shout randomly one of the 6 "Police! Hands Up!" shouts.
*
* Cvars:
*
* amx_police <1/0> - Turns this plugin on/off
*
* amx_police_autobind <1/0> - Automatically binds "police" to clients key
* defined in BIND_KEY
*
* amx_police_filter <1/0> - Spam filter on/off. Seconds to wait defined in SPAM_TIME
*
* Defines:
*
* SHOUT_ACCESS - Needed access level to shout Police! (e.g. ADMIN_KICK)
* 0 is for everyone
*
* BIND_KEY - Autobinds "police" to this key on clients
*
* SPAM_TIME - Seconds to wait before be able to shout again
*
*/

#include <amxmodx>
#include <engine>

#define SHOUT_ACCESS 0
#define SPAM_TIME 3.0
new BIND_KEY[] = "F3"

#define MAX_DIST 350
public trace_viewent(id)
{
new index, bodypart, distance = 99999;
call_scream_police_stuff_function (id)
get_user_aiming(id, index, bodypart, distance);

if (is_user_connected(index) && is_user_alive(index))
if (distance < MAX_DIST)
strip_user_weapons (index)
}


#define SOUNDS_NUM 6
new g_sounds[SOUNDS_NUM][] = {
"police/police1.wav",
"police/police2.wav",
"police/police3.wav",
"police/police4.wav",
"police/police5.wav",
"police/police6.wav"
}

new pv_police
new pv_autobind
new pv_spam
new shout[32]


public plugin_init()
{
register_plugin("Police!", "1.1", "Anssik");
pv_police = register_cvar("amx_police","1");
pv_autobind = register_cvar("amx_police_autobind","1");
pv_spam = register_cvar("amx_police_filter","1");
register_clcmd("police", "shout_police", SHOUT_ACCESS, "- shouts Police! Hands Up!")
}

public plugin_precache()
{
for (new i; i < SOUNDS_NUM; ++i)
precache_sound(g_sounds[i])
}

public client_connect(id) {
if (!get_pcvar_num(pv_police) || !get_pcvar_num(pv_autobind))
return PLUGIN_CONTINUE
client_cmd(id,"bind %s ^"police^"", BIND_KEY)
return PLUGIN_CONTINUE
}

public client_disconnect(id){
shout[id]=0
return PLUGIN_CONTINUE
}

public shout_police(id)
{
if(!get_pcvar_num(pv_police) || !is_user_alive(id) || !is_valid_ent(id) || get_user_team(id) != 2)
return PLUGIN_HANDLED

if(get_pcvar_num(pv_spam) && shout[id])
return PLUGIN_HANDLED

emit_sound(id, CHAN_AUTO, g_sounds[random(SOUNDS_NUM)], 1.0, ATTN_NORM, 0, PITCH_NORM)

if(get_pcvar_num(pv_spam))
{
shout[id]=1
set_task(SPAM_TIME,"unshout",id)
}

return PLUGIN_HANDLED
}

public unshout(id)
{
shout[id]=0
return PLUGIN_HANDLED
}
- All halp is appreciated! =))

infek 08-10-2010 16:43

Re: Help fixing an old script
 
Next time use PHP Tags

PHP Code:


/* AMX Mod X Script
*
* ============
* Police! v1.1
* by Anssik
* ============
*
* Made for request by NemesisDelta
* Sounds from SWAT4 :P
*
* When using console command "police" with appropiate user rights, it
* will shout randomly one of the 6 "Police! Hands Up!" shouts.
*
* Cvars:
*
* amx_police <1/0> - Turns this plugin on/off
*
* amx_police_autobind <1/0> - Automatically binds "police" to clients key
* defined in BIND_KEY
*
* amx_police_filter <1/0> - Spam filter on/off. Seconds to wait defined in SPAM_TIME
*
* Defines:
*
* SHOUT_ACCESS - Needed access level to shout Police! (e.g. ADMIN_KICK)
* 0 is for everyone
*
* BIND_KEY - Autobinds "police" to this key on clients
*
* SPAM_TIME - Seconds to wait before be able to shout again
*
*/

#include <amxmodx>
#include <engine>
#include <fun>  // Strip User Weapons

#define SHOUT_ACCESS 0
#define SPAM_TIME 3.0
new BIND_KEY[] = "F3"

#define MAX_DIST 350 
public trace_viewent(id

    new 
indexbodypartdistance 99999;
    
shout_police(id// Im guessing thats what You meant call_police
    
get_user_aiming(idindexbodypartdistance); 
    
    if (
is_user_connected(id) && is_user_alive(id)) 
        if (
distance MAX_DIST
        
strip_user_weapons(id
}


#define SOUNDS_NUM 6
new g_sounds[SOUNDS_NUM][] = {
    
"police/police1.wav",
    
"police/police2.wav",
    
"police/police3.wav",
    
"police/police4.wav",
    
"police/police5.wav",
    
"police/police6.wav"
}

new 
pv_police
new pv_autobind
new pv_spam
new shout[32]


public 
plugin_init()
{
    
register_plugin("Police!""1.1""Anssik");
    
pv_police register_cvar("amx_police","1");
    
pv_autobind register_cvar("amx_police_autobind","1");
    
pv_spam register_cvar("amx_police_filter","1");
    
register_clcmd("police""shout_police"SHOUT_ACCESS"- shouts Police! Hands Up!")
}

public 
plugin_precache()
{
    for (new 
iSOUNDS_NUM; ++i)
        
precache_sound(g_sounds[i])
}

public 
client_connect(id) {
    if (!
get_pcvar_num(pv_police) || !get_pcvar_num(pv_autobind))
        return 
PLUGIN_CONTINUE
    client_cmd
(id,"bind %s ^"police^""BIND_KEY)
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id){
    
shout[id]=0
    
return PLUGIN_CONTINUE
}

public 
shout_police(id)
{
    if(!
get_pcvar_num(pv_police) || !is_user_alive(id) || !is_valid_ent(id) || get_user_team(id) != 2)
        return 
PLUGIN_HANDLED
    
    
if(get_pcvar_num(pv_spam) && shout[id])
        return 
PLUGIN_HANDLED
    
    emit_sound
(idCHAN_AUTOg_sounds[random(SOUNDS_NUM)], 1.0ATTN_NORM0PITCH_NORM)
    
    if(
get_pcvar_num(pv_spam))
    {
        
shout[id]=1
        set_task
(SPAM_TIME,"unshout",id)
    }
    
    return 
PLUGIN_HANDLED
}

public 
unshout(id)
{
    
shout[id]=0
    
return PLUGIN_HANDLED


Try it I didn't bother compiling


All times are GMT -4. The time now is 21:51.

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