Raised This Month: $51 Target: $400
 12% 

Plugin snow doesn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 12-13-2015 , 15:12   Plugin snow doesn't work
Reply With Quote #1

I have this plugin of snow and didn't work, not just for me.
Give me this in console this:
Server tried to send invalid command:"cl_weather 2"

Code:
/* AMX Mod X Script
*
* eXtreamCS Dev Team
*
* ======---===========
* © 2012 by CryWolf
*  www.eXtreamCS.com
* ======---===========
*
* This file is intended to be used with AMX Mod X.
*
*   This program is free software: you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation, either version 3 of the License, or
*   (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*/

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >

#pragma semicolon 1

#define gz_VERSION    "0.0.3"

new snowoffon, snowmode, msjshow;
new g_snow [ 33 ];
new skyadd;
new g_weather [ 33 ];
new names [ 33 ];

public plugin_init ( )
{
    register_plugin ( "AMXX Advanced Snow", gz_VERSION, "CryWolf" );
    
    snowmode = register_cvar ( "amx_snow_density", "1", ADMIN_BAN );
    msjshow = register_cvar ( "amx_snow_msj", "1", ADMIN_BAN );
    
    register_clcmd ( "say /snowmenu", "snowmenu" );
    register_clcmd ( "say_team /snowmenu", "snowmenu" );
    
    register_event ( "HLTV", "event_round_start", "a", "1=0", "2=0" );
}

public client_putinserver ( id )
{
    set_task ( 3.0, "p_snow" );
}

public p_snow ( id )
{
    if ( get_pcvar_num ( snowmode ) == 1 )
    {
        client_cmd ( id, "cl_weather 1" );
    }
    else
    {
        client_cmd ( id, "cl_weather 2" );
    }
    
    if ( get_pcvar_num ( snowmode ) == 0 )
    {
        client_cmd ( id, "cl_weather 0" );
    }
}
    
public snowmenu ( id )
{
    static menu, string [ 128 ], on_off [ 10 ];
    formatex ( string, sizeof ( string ), "\y [AMXX] Snow Menu" );
    menu = menu_create ( string, "s_menu_handle" );
    
    // Snow Off / On
    if ( g_snow [ id ] )
    {
        formatex ( on_off, sizeof ( on_off ) -1, "\yYes" );
    }
    else
    {
        formatex ( on_off, sizeof ( on_off )-1, "\dNo" );
    }
    formatex ( string, sizeof ( string ) -1, "Snow: %s", on_off );
    
    menu_additem ( menu, string, "1", 0 );
    
    // Weather 1 / 2
    if ( g_weather [ id ] )
    {
        formatex ( on_off, sizeof ( on_off ) -1, "\y1" );
    }
    else
    {
        formatex ( on_off, sizeof ( on_off ) -1, "\r2" );
    }
    formatex ( string, sizeof ( string ) -1, "Weather: %s", on_off );
    
    menu_additem ( menu, string, "2", 0 );
    
    menu_setprop ( menu, MPROP_NUMBER_COLOR, "\r" );
    menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL );
    menu_display ( id, menu, 0 );
}

public s_menu_handle ( id, menu, item )
{
    if ( !is_user_connected ( id ) )
        return PLUGIN_HANDLED;
    
    if ( item == MENU_EXIT )
    {
        menu_destroy ( menu );
        return PLUGIN_HANDLED;
    }
    
    new data [ 6 ], szName [ 64 ];
    new access, callback;
    
    menu_item_getinfo ( menu, item, access, data, charsmax ( data ), szName, charsmax ( szName ), callback );
    new key = str_to_num ( data );
    
    switch ( key )
    {
        case 1: // Snow Off / On
        {
            if ( g_snow [ id ] )
            {
                g_snow [ id ] = 0;
                client_cmd ( id, "cl_weather 0" );
                get_user_name ( id, names, charsmax ( names ) );
                client_print ( id, print_chat, "[SNOW] %s Snow has been turned off for you!", names );
            }
            else
            {
                g_snow [ id ] = 1;
                client_cmd ( id, "cl_weather 1" );
                get_user_name ( id, names, charsmax ( names ) );
                client_print ( id, print_chat, "[SNOW] %s Snow has been turned on for You!", names );
            }
        }
        
        case 2: // Weather 1 / 2
        {
            if ( g_weather [ id ] )
            {
                g_weather [ id ] = 0;
                client_cmd ( id, "cl_weather 2" );
                get_user_name ( id, names, charsmax ( names ) );
                client_print ( id, print_chat, "[SNOW] %s I will snow more for you!", names );
            }
            else
            {
                g_weather [ id ] = 1;
                client_cmd ( id, "cl_weather 1" );
                get_user_name ( id, names, charsmax ( names ) );
                client_print ( id, print_chat, "[SNOW] %s I will snow a little for you!", names );
            }
        }
    }
    snowmenu ( id );
    
    return PLUGIN_CONTINUE;
}

public plugin_precache ( )
{
    skyadd = register_cvar ( "amx_sky", "1", ADMIN_RCON );
    snowoffon = register_cvar ( "amx_snow", "1", ADMIN_KICK );
    
    precache_generic ( "sprites/snow.spr" );
    
    if ( get_pcvar_num ( skyadd ) == 1 )
    {
        precache_generic ( "gfx/env/spaceup.tga" );
        precache_generic ( "gfx/env/spacedn.tga" );
        precache_generic ( "gfx/env/spaceft.tga" );
        precache_generic ( "gfx/env/spacelf.tga" );
        precache_generic ( "gfx/env/spacert.tga" );
        precache_generic ( "gfx/env/spacebk.tga" );
        
        server_cmd ( "sv_skyname space" );
    }
    if ( get_pcvar_num ( skyadd ) == 2 )
    {
        precache_generic ( "gfx/env/nightup.tga" );
        precache_generic ( "gfx/env/nightdn.tga" );
        precache_generic ( "gfx/env/nightft.tga" );
        precache_generic ( "gfx/env/nightlf.tga" );
        precache_generic ( "gfx/env/nightrt.tga" );
        precache_generic ( "gfx/env/nightbk.tga" );
        
        server_cmd ( "sv_skyname night" );
    }
    else
    {
        return 1;
    }
    
    if ( get_pcvar_num ( snowoffon ) == 1 )
    {
        // Snow using Engine
        // create_entity ( "env_snow" );
        // Snow using Fakemeta
        engfunc ( EngFunc_CreateNamedEntity, engfunc ( EngFunc_AllocString, "env_snow" ) );
    }
    else
    {
        return 1;
    }

    return -1;
}

public event_round_start ( )
{
    if ( get_pcvar_num ( snowmode ) == 1 )
    {
        client_cmd ( 0, "cl_weather 1" );
    }
    
    if ( get_pcvar_num ( snowmode ) == 2 )
    {
        client_cmd ( 0, "cl_weather 2" );
    }
    
    if ( get_pcvar_num ( snowoffon ) == 0 )
    {
        client_cmd ( 0, "cl_weather 0" );
    }
    
    if ( get_pcvar_num ( snowoffon ) == 1 )
    {
        client_cmd ( 0, "cl_weather 1" );
    }
    
    if ( get_pcvar_num ( msjshow ) == 1 )
    {
        client_print ( 0, print_chat, "[SNOW] Type /snowmenu to start/stop the snow or to select weather!" );
    }
    
    if ( get_pcvar_num ( msjshow ) == 0 )
    {
        return PLUGIN_HANDLED;
    }
    
    return PLUGIN_CONTINUE;
}

smiley92 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-13-2015 , 16:02   Re: Plugin snow doesn't work
Reply With Quote #2

That plugin is not allowed here.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 12-13-2015 , 16:03   Re: Plugin snow doesn't work
Reply With Quote #3

Why?Nothing is not allowed here?
smiley92 is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-13-2015 , 18:01   Re: Plugin snow doesn't work
Reply With Quote #4

● You posted in the wrong section
● If he says that It's not allowed then It's not allowed for a reason
● You didn't even look at the code yourself, you expect others to do everything for you

If you look at the code, you can see why It's not allowed here
redivcram is offline
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 12-14-2015 , 02:11   Re: Plugin snow doesn't work
Reply With Quote #5

Make it to be allowed on this forum.I know client_cmd is considered slowhacking.Please code this plugin to work without slowhack, to be with density etc.

I don't think snow is not allowed, just make it to work!


@redivcram, Where to post this if not here?!At scripting help?I don't know to script a plugin, I just request here to someone make it to work.
smiley92 is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-14-2015 , 04:53   Re: Plugin snow doesn't work
Reply With Quote #6

This section is for requesting plugins you can't find. No, find the plugin's thread and post there, it doesn't matter if It's not on alliedmodders. You said it yourself, you will follow the rules, remember?
redivcram is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 12-14-2015 , 06:10   Re: Plugin snow doesn't work
Reply With Quote #7

if you ask the user and let him decide what weather cvar to chose it is not slowhacking and it is allowed. read the forum rules again
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 12-14-2015 , 06:19   Re: Plugin snow doesn't work
Reply With Quote #8

Yes dude, but if post in Scripting help is not good because I`m not a scripter and changes/problems must to be posted here.What to understand?

I think I followed the rules...Someone says here another rules, each make rules here to not help me and have excuse.

Just know to say is not allowed, not must to make thread here, not to post here, is slowhack is WTF with this rules?!When someone try to help me with this plugin of snow will comming summer.
smiley92 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-14-2015 , 08:11   Re: Plugin snow doesn't work
Reply With Quote #9

You can simply use a plugin that adds snow on the map - that's all. No need to add menus and options for client's to control the density. They can do it without all of those stuff. This plugin will automatically make your server snowy in the months that you choose, or December and January by default:

PHP Code:
#include <amxmodx>
#include <engine>

#define PLUGIN_VERSION "1.0"

new const g_iSnowyMonths[] = { 112 }
new 
g_szMonth[3], g_iMonth

public plugin_init()
{
    
register_plugin("Let it Snow!"PLUGIN_VERSION"OciXCrom")
    
register_cvar("LetitSnow"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
}

public 
plugin_precache()
{
    
get_time("%m"g_szMonthcharsmax(g_szMonth))
    
g_iMonth str_to_num(g_szMonth)
        
    for(new 
0sizeof(g_iSnowyMonths); i++)
    {
        if(
g_iSnowyMonths[i] == g_iMonth)
            
create_entity("env_snow")
    }

It's that simple.

You can also use this, that will simply add snow without any checks:

PHP Code:
#include <amxmodx>
#include <engine>

public plugin_init()
    
register_plugin("Simple Snow""1.0""OciXCrom")

public 
plugin_precache()
    
create_entity("env_snow"

Last edited by OciXCrom; 12-14-2015 at 08:14.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 12-14-2015 , 11:28   Re: Plugin snow doesn't work
Reply With Quote #10

I want to be with density, for that I want to use that plugin.Have sky, light, fog etc.Please understand, I don't want for slowhack, especially that I use this few months, when is winter outside.

Make something changes in that plugin to work that plugin with density.I don't want another plugin like that, I want that to be chanced code to work without slowhack if si possible. Damn -_-

Last edited by smiley92; 12-14-2015 at 11:28.
smiley92 is offline
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 09:20.


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