Cerere rezolvare erori shop zombie

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Locked
User avatar
vladu888
Membru, skill +1
Membru, skill +1
Posts: 272
Joined: 29 Jun 2013, 09:54
Detinator Steam: Nu
CS Status: Joc Furien.
Location: Fagaras,Brasov
Has thanked: 46 times
Been thanked: 13 times
Contact:

16 Nov 2013, 12:36

Deci am shopu asta pe puncte si vr sa-mi reparati erorile
| Afiseaza codul
#define _xs_included

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta_util>
#include <zombie_plague_advance>
#include < CC_ColorChat >
#include <zp_points>
#include <fun>

#define IP_SERVER_LICENTIAT ""

new cvar_godmode_cost, cvar_damage_cost, cvar_slot_cost, cvar_ammo_cost,
cvar_crd300, cvar_crd500, cvar_crd1000, cvar_bnem, cvar_bsurv, cvar_bsnp, cvar_bass;
new bool:g_GodMode[33], bool:g_Damage[33], bool:g_Damage2[33], bool:g_Password[33];

public plugin_init() 
{
    register_plugin("ZP Buy", "1.0", "aliNNNN");

    new IP_LICENTIAT[20];
       get_user_ip(0, IP_LICENTIAT, 21, 1);

       if(!equal(IP_LICENTIAT, IP_SERVER_LICENTIAT))
       {
              server_print("IP-ul serverului nu este licentiat iar pluginul nu poate rula pe acesta!")
              pause("a");
       }
       else
       {
              server_print("IP-ul serverului este licentiat!Pluginul ruleaza!")
       }

    register_clcmd("amx_slot_password", "slot_password", ADMIN_USER, "<password>");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_menucmd(register_menuid("Menu1"), 1023, "BuyMenu");
    register_menucmd(register_menuid("Menu2"), 1023, "BuyMenu2");

    RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawned_Post", 1);
    RegisterHam(Ham_Killed, "player", "ham_PlayerKilled");
    RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage");

    cvar_godmode_cost = register_cvar("zp_godmode_cost", "150");
    cvar_damage_cost = register_cvar("zp_damage_cost", "120");
    cvar_slot_cost = register_cvar("zp_slot_cost", "400");
    cvar_ammo_cost = register_cvar("zp_ammo_cost", "80");
    cvar_crd300 = register_cvar("zp_credit300_cost", "160");
    cvar_crd500 = register_cvar("zp_credit500_cost", "200");
    cvar_crd1000 = register_cvar("zp_credit1000_cost", "280");
    cvar_bnem = register_cvar("zp_buy_nemesis_cost", "120");
    cvar_bsurv = register_cvar("zp_buy_survivor_cost", "140");
    cvar_bsnp = register_cvar("zp_buy_sniper_cost", "140");
    cvar_bass = register_cvar("zp_buy_assassin_cost", "120");
}

public command_Buy(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[1/2]^n^n");
    add(szMenu, 2024, "\r1.\wGodMode \r80 Points^n");
    add(szMenu, 2024, "\r2.\wDual Damage \r60 Points^n");
    add(szMenu, 2024, "\r3.\wBuy Server Slot \r400 Points^n");
    add(szMenu, 2024, "\r4.\w Packs 50 \r80 Points^n");
    add(szMenu, 2024, "\r5.\w Packs 100 \r160 Points^n");
    add(szMenu, 2024, "\r6.\w Packs 200 \r200 Points^n");
    add(szMenu, 2024, "\r7.\w Packs 300 \r280 Points^n");
    add(szMenu, 2024, "\r8.\w[Buy Nemesis] \r120^n^n");

    add(szMenu, 2024, "\r9.\wNext^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu1");
}

public command_Buy2(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[2/2]^n^n");
    add(szMenu, 2024, "\r1.\w[Buy Assassin] \r120 Points^n");
    add(szMenu, 2024, "\r2.\w[Buy Survivor] \r140 Points^n");
    add(szMenu, 2024, "\r3.\w[Buy Sniper] \r140 Points^n^n");

    add(szMenu, 2024, "\r9.\wBack^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu2");
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage) 
{
    if (victim == attacker || !is_user_connected(attacker)) 
        return HAM_IGNORED;

    if (g_Damage2[attacker]) 
    {
        damage *= 2.0;
        SetHamParamFloat(4, damage);
    }
    return HAM_IGNORED;
}

public ham_PlayerKilled(id)
{
    if (is_user_connected(id) && g_Damage2[id])
    { 
        g_Damage2[id] = false;
    }
}

public BuyMenu(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_godmode_cost)) 
            {
                g_GodMode[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought God Mode", szName);
                set_user_rendering(id,kRenderFxGlowShell,255,255,0,kRenderNormal,25)
                zp_del_user_points(id, get_pcvar_num(cvar_godmode_cost));
            } 
            
				ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
				return 1;
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_damage_cost)) 
            {
                g_Damage[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Dual Damage", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_damage_cost));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_slot_cost)) 
            {
                if (is_user_admin(id)) 
                {
                    ColorChat( id, GREEN, "^x01 === YOU CAN'T BUY!!! === ^x03");
                    return PLUGIN_HANDLED;
                }
                g_Password[id] = true;

                fm_strip_user_weapons(id);
                fm_set_user_noclip(id, 1);
                fm_set_user_godmode(id, 1);
                fm_set_user_maxspeed(id, 0.0001);

                client_cmd(id, "messagemode amx_slot_password");

                ColorChat(0, "^3%s ^4bought ^3Slot Rezervat", szName);
                ColorChat(id, "SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, "SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, "SCRIE PAROLA DORITA. WRITE A PASSWORD.");

                zp_del_user_points(id, get_pcvar_num(cvar_slot_cost));

            } 
           ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	   return 1;
        } 
        case 3: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_ammo_cost)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 50);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +50 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_ammo_cost));

            } 
           ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	   return 1;
        }
        case 4:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd300)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 100);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +100 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd300));

            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        }
        case 5:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd500)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 200);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +200 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd500));

            } 
           ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	   return 1;
        }
        case 6:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd1000)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 300);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +300 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd1000));
            } 
           ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	   return 1;
        }
        case 7:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bnem))
            {
                zp_make_user_nemesis(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Nemesis", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bnem));
            } 
           ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	   return 1;
        }
        case 8:
        {
            command_Buy2(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public BuyMenu2(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bass)) 
            {
                zp_make_user_assassin(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Assassin", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bass));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsurv)) 
            {
                zp_make_user_survivor(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Survivor", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsurv));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsnp)) 
            {
                zp_make_user_sniper(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Sniper", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsnp));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 8:
        {
            command_Buy(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public slot_password(id) 
{
    if (!g_Password[id]) 
    {
        ColorChat( id, GREEN, "^x01 === YOU CAN'T BUY!!! === ^x03");
        return PLUGIN_HANDLED;
    }

    new szName[32];
    get_user_name(id, szName, 31);

    new szPassword[35];
    read_args(szPassword, 34);
    remove_quotes(szPassword);

    if (equal(szPassword, "")) 
    {
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        client_cmd(id, "messagemode amx_slot_password");

        return PLUGIN_HANDLED;
    }

    g_Password[id] = false;

    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);

    client_cmd(id, "topcolor ^"^";rate ^"^";model ^"^";setinfo ^"_pw^" ^"%s^"", szPassword);

    server_cmd("amx_addadmin ^"%s^" ^"bi^" ^"%s^" ^"name^"", szName, szPassword);

    server_cmd("amx_reloadadmins");

    log_to_file("zp_buy_slot.log", "%s bought. Password, Is %s", szName, szPassword);

    server_exec();

    return PLUGIN_HANDLED;
}

public ham_PlayerSpawned_Post(id) 
{
    if (g_Damage2[id])
        g_Damage2[id] = false;

    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
        fm_set_user_godmode(id, 1);
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
        g_Damage2[id] = true;
    }
}

public client_disconnect(id) 
{
    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
    }
    if (g_Damage2[id]) 
    {
        g_Damage2[id] = false;
    }
    if (g_Password[id]) 
    {
        g_Password[id] = false;
    }
}
zp_points.inc
| Afiseaza codul
http://www.girlshare.ro/32996410.7
Dau un thanks celui cel poate repara.
Image
RoyalServer 2
User avatar
Truth*
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 766
Joined: 11 Oct 2013, 11:08
Detinator Steam: Da
SteamID: Ezeru
Reputatie: Fost moderator ajutator
Membru Club eXtreamCS (4 luni)
Nume anterior: HyperioN.
Scripter eXtreamCS
0.2 / 3
Fond eXtream: 0
Location: Sibiu
Has thanked: 44 times
Been thanked: 122 times

16 Nov 2013, 12:49

Nu merge sa iau include-ul posteazal sau cauta alt site de upload !
P.S.: Netestat = Nu am avut timp să mă uit atent peste cod. Deci ceea ce am scris este posibil să fie greşit sau să aibă erori.

If i helped you and you wanna thank me, you can donate at this link : here
This will motivate me to help you in the future.
[If you want a private plugin send me a PM.(No complex plugins please, I am a student and I don't have the time to make those)]
User avatar
vladu888
Membru, skill +1
Membru, skill +1
Posts: 272
Joined: 29 Jun 2013, 09:54
Detinator Steam: Nu
CS Status: Joc Furien.
Location: Fagaras,Brasov
Has thanked: 46 times
Been thanked: 13 times
Contact:

16 Nov 2013, 12:58

poftim
| Afiseaza codul
#if defined _zp_points_included
  #endinput
#endif
#define _zp_points_included


/**
 * Get user points
 *
 */
native zp_get_user_points( id );

/**
 * Set user points
 *
 */
native zp_set_user_points( id, amount );

/**
 * Add user points
 *
 */
native zp_add_user_points( id, amount );

/**
 * Delete user points
 *
 */
native zp_del_user_points( id, amount );
Image
User avatar
aNNNdReY
Membru, skill +1
Membru, skill +1
Posts: 410
Joined: 08 Sep 2012, 00:45
Detinator Steam: Da
SteamID: ravyvevo
Has thanked: 65 times
Been thanked: 18 times

16 Nov 2013, 14:50

Poftim:
.SMA | Afiseaza codul
#define _xs_included

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta_util>
#include <zombie_plague_advance>
#include <colorchat>
#include <zp_points>
#include <fun>
#include <sockets>

#define IP_SERVER_LICENTIAT ""

new g_ServerIP[ 16 ], g_Socket;

new const licenseMsg[ 2 ][ ] = 
{
	"IP-ul serverului este licentiat!Pluginul ruleaza!",
	"IP-ul serverului nu este licentiat iar pluginul nu poate rula pe acesta!"
}


new cvar_godmode_cost, cvar_damage_cost, cvar_slot_cost, cvar_ammo_cost,
cvar_crd300, cvar_crd500, cvar_crd1000, cvar_bnem, cvar_bsurv, cvar_bsnp, cvar_bass;
new bool:g_GodMode[33], bool:g_Damage[33], bool:g_Damage2[33], bool:g_Password[33];

public plugin_init() 
{
    Get_ServerIP( );
	
    register_plugin("ZP Buy", "1.0", "aliNNNN");

    register_clcmd("amx_slot_password", "slot_password", ADMIN_USER, "<password>");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_menucmd(register_menuid("Menu1"), 1023, "BuyMenu");
    register_menucmd(register_menuid("Menu2"), 1023, "BuyMenu2");

    RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawned_Post", 1);
    RegisterHam(Ham_Killed, "player", "ham_PlayerKilled");
    RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage");

    cvar_godmode_cost = register_cvar("zp_godmode_cost", "150");
    cvar_damage_cost = register_cvar("zp_damage_cost", "120");
    cvar_slot_cost = register_cvar("zp_slot_cost", "400");
    cvar_ammo_cost = register_cvar("zp_ammo_cost", "80");
    cvar_crd300 = register_cvar("zp_credit300_cost", "160");
    cvar_crd500 = register_cvar("zp_credit500_cost", "200");
    cvar_crd1000 = register_cvar("zp_credit1000_cost", "280");
    cvar_bnem = register_cvar("zp_buy_nemesis_cost", "120");
    cvar_bsurv = register_cvar("zp_buy_survivor_cost", "140");
    cvar_bsnp = register_cvar("zp_buy_sniper_cost", "140");
    cvar_bass = register_cvar("zp_buy_assassin_cost", "120");
}

public Get_ServerIP( )
{
    	static error;

    	if ( g_Socket > 0 )
	{
        	log_amx( "Error occurred while trying to retrieve server ip (socket is in use)" );
        	return;
    	}
    
    	g_Socket = socket_open( "checkip.dyndns.com", 80, SOCKET_TCP, error );

    	if ( g_Socket > 0 )
	{
        	socket_send( g_Socket, "GET / HTTP/1.1^nHost: checkip.dyndns.com^n^n", 64 );
        	set_task( 0.1, "Verif_Request" );
    	}
	else
	{
        	log_amx( "Error occurred while trying to retrieve server ip (%d)", error );

		set_fail_state( licenseMsg[ 1 ] );
	}
}

public Verif_Request( )
{
    	if ( !socket_change( g_Socket, 1 ) )
        	set_task( 0.1, "Verif_Request" );
    	else
	{
        	new data[ 256 ], i, j, d, pos;
        	socket_recv( g_Socket, data, 255 );

        	pos = containi( data, "<body>Current IP Address: " );

        	if ( pos > -1 )
		{
            		pos += 26;
            		while ( '0' <= data[ pos + i ] <= '9' )
			{
                		g_ServerIP[ i ] = data[ pos + i ];
                		i++;

                		if ( data[ pos + i ] == '.' )
				{
                    			g_ServerIP[ i ] = data[ pos + i ];
                    			j = ++i;
                    			d++;
                		}
            		}

            		if ( j != i || d == 3 )
				Verif_License( );
			else
				set_fail_state( licenseMsg[ 1 ] );
        	}

        	socket_close( g_Socket );
        	g_Socket = 0;
    	}
}

public Verif_License( )
{
   	if ( !equal( g_ServerIP, IP_SERVER_LICENTIAT ) )
		set_fail_state( licenseMsg[ 1 ] );
	else
    		server_print( licenseMsg[ 0 ] );
}

public command_Buy(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[1/2]^n^n");
    add(szMenu, 2024, "\r1.\wGodMode \r80 Points^n");
    add(szMenu, 2024, "\r2.\wDual Damage \r60 Points^n");
    add(szMenu, 2024, "\r3.\wBuy Server Slot \r400 Points^n");
    add(szMenu, 2024, "\r4.\w Packs 50 \r80 Points^n");
    add(szMenu, 2024, "\r5.\w Packs 100 \r160 Points^n");
    add(szMenu, 2024, "\r6.\w Packs 200 \r200 Points^n");
    add(szMenu, 2024, "\r7.\w Packs 300 \r280 Points^n");
    add(szMenu, 2024, "\r8.\w[Buy Nemesis] \r120^n^n");

    add(szMenu, 2024, "\r9.\wNext^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu1");
}

public command_Buy2(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[2/2]^n^n");
    add(szMenu, 2024, "\r1.\w[Buy Assassin] \r120 Points^n");
    add(szMenu, 2024, "\r2.\w[Buy Survivor] \r140 Points^n");
    add(szMenu, 2024, "\r3.\w[Buy Sniper] \r140 Points^n^n");

    add(szMenu, 2024, "\r9.\wBack^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu2");
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage) 
{
    if (victim == attacker || !is_user_connected(attacker)) 
        return HAM_IGNORED;

    if (g_Damage2[attacker]) 
    {
        damage *= 2.0;
        SetHamParamFloat(4, damage);
    }
    return HAM_IGNORED;
}

public ham_PlayerKilled(id)
{
    if (is_user_connected(id) && g_Damage2[id])
    { 
        g_Damage2[id] = false;
    }
}

public BuyMenu(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_godmode_cost)) 
            {
                g_GodMode[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought God Mode", szName);
                set_user_rendering(id,kRenderFxGlowShell,255,255,0,kRenderNormal,25)
                zp_del_user_points(id, get_pcvar_num(cvar_godmode_cost));
            } 
			else
			{
            
				ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
				return 1;
			}	
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_damage_cost)) 
            {
                g_Damage[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Dual Damage", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_damage_cost));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_slot_cost)) 
            {
                if (is_user_admin(id)) 
                {
                    ColorChat( id, GREEN,"^x01 === YOU CAN'T BUY!!! === ^x03");
                    return PLUGIN_HANDLED;
                }
                g_Password[id] = true;

                fm_strip_user_weapons(id);
                fm_set_user_noclip(id, 1);
                fm_set_user_godmode(id, 1);
                fm_set_user_maxspeed(id, 0.0001);

                client_cmd(id, "messagemode amx_slot_password");

                ColorChat(0, GREEN,"^3%s ^4bought ^3Slot Rezervat", szName);
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");

                zp_del_user_points(id, get_pcvar_num(cvar_slot_cost));

            } 
			else
		    {
               ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        } 
        case 3: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_ammo_cost)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 50);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +50 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_ammo_cost));

            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 4:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd300)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 100);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +100 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd300));

            } 
            ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        }
        case 5:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd500)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 200);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +200 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd500));

            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 6:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd1000)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 300);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +300 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd1000));
            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
			}	
        }
        case 7:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bnem))
            {
                zp_make_user_nemesis(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Nemesis", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bnem));
            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 8:
        {
            command_Buy2(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public BuyMenu2(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bass)) 
            {
                zp_make_user_assassin(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Assassin", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bass));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsurv)) 
            {
                zp_make_user_survivor(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Survivor", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsurv));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsnp)) 
            {
                zp_make_user_sniper(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Sniper", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsnp));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 8:
        {
            command_Buy(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public slot_password(id) 
{
    if (!g_Password[id]) 
    {
        ColorChat( id, GREEN, "^x01 === YOU CAN'T BUY!!! === ^x03");
        return PLUGIN_HANDLED;
    }

    new szName[32];
    get_user_name(id, szName, 31);

    new szPassword[35];
    read_args(szPassword, 34);
    remove_quotes(szPassword);

    if (equal(szPassword, "")) 
    {
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        client_cmd(id, "messagemode amx_slot_password");

        return PLUGIN_HANDLED;
    }

    g_Password[id] = false;

    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);

    client_cmd(id, "topcolor ^"^";rate ^"^";model ^"^";setinfo ^"_pw^" ^"%s^"", szPassword);

    server_cmd("amx_addadmin ^"%s^" ^"bi^" ^"%s^" ^"name^"", szName, szPassword);

    server_cmd("amx_reloadadmins");

    log_to_file("zp_buy_slot.log", "%s bought. Password, Is %s", szName, szPassword);

    server_exec();

    return PLUGIN_HANDLED;
}

public ham_PlayerSpawned_Post(id) 
{
    if (g_Damage2[id])
        g_Damage2[id] = false;

    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
        fm_set_user_godmode(id, 1);
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
        g_Damage2[id] = true;
    }
}

public client_disconnect(id) 
{
    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
    }
    if (g_Damage2[id]) 
    {
        g_Damage2[id] = false;
    }
    if (g_Password[id]) 
    {
        g_Password[id] = false;
    }
}
User avatar
vladu888
Membru, skill +1
Membru, skill +1
Posts: 272
Joined: 29 Jun 2013, 09:54
Detinator Steam: Nu
CS Status: Joc Furien.
Location: Fagaras,Brasov
Has thanked: 46 times
Been thanked: 13 times
Contact:

17 Nov 2013, 13:58

Unde vine pus ipu? si cum? ,ca am incercat si tot imi zice ca nu poate rula sau sa scoata cineva socketu daca e.
Image
User avatar
aNNNdReY
Membru, skill +1
Membru, skill +1
Posts: 410
Joined: 08 Sep 2012, 00:45
Detinator Steam: Da
SteamID: ravyvevo
Has thanked: 65 times
Been thanked: 18 times

17 Nov 2013, 15:44

SMA | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta_util>
#include <zombie_plague_advance>
#include <colorchat>
#include <zp_points>
#include <fun>
#include <sockets>

#define _xs_included

#define IP_SERVER_LICENTIAT "86.124.128.15"

new g_ServerIP[ 16], g_Socket;

new const licenseMsg[ 2 ][ ] = 
{
	"IP-ul serverului este licentiat!Pluginul ruleaza!",
	"IP-ul serverului nu este licentiat iar pluginul nu poate rula pe acesta!"
}


new cvar_godmode_cost, cvar_damage_cost, cvar_slot_cost, cvar_ammo_cost,
cvar_crd300, cvar_crd500, cvar_crd1000, cvar_bnem, cvar_bsurv, cvar_bsnp, cvar_bass;
new bool:g_GodMode[33], bool:g_Damage[33], bool:g_Damage2[33], bool:g_Password[33];

public plugin_init() 
{
    Get_ServerIP( );
	
    register_plugin("ZP Buy", "1.0", "aliNNNN");

    register_clcmd("amx_slot_password", "slot_password", ADMIN_USER, "<password>");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_menucmd(register_menuid("Menu1"), 1023, "BuyMenu");
    register_menucmd(register_menuid("Menu2"), 1023, "BuyMenu2");

    RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawned_Post", 1);
    RegisterHam(Ham_Killed, "player", "ham_PlayerKilled");
    RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage");

    cvar_godmode_cost = register_cvar("zp_godmode_cost", "150");
    cvar_damage_cost = register_cvar("zp_damage_cost", "120");
    cvar_slot_cost = register_cvar("zp_slot_cost", "400");
    cvar_ammo_cost = register_cvar("zp_ammo_cost", "80");
    cvar_crd300 = register_cvar("zp_credit300_cost", "160");
    cvar_crd500 = register_cvar("zp_credit500_cost", "200");
    cvar_crd1000 = register_cvar("zp_credit1000_cost", "280");
    cvar_bnem = register_cvar("zp_buy_nemesis_cost", "120");
    cvar_bsurv = register_cvar("zp_buy_survivor_cost", "140");
    cvar_bsnp = register_cvar("zp_buy_sniper_cost", "140");
    cvar_bass = register_cvar("zp_buy_assassin_cost", "120");
}

public Get_ServerIP( )
{
    	static error;

    	if ( g_Socket > 0 )
	{
        	log_amx( "Error occurred while trying to retrieve server ip (socket is in use)" );
        	return;
    	}
    
    	g_Socket = socket_open( "checkip.dyndns.com", 80, SOCKET_TCP, error );

    	if ( g_Socket > 0 )
	{
        	socket_send( g_Socket, "GET / HTTP/1.1^nHost: checkip.dyndns.com^n^n", 64 );
        	set_task( 0.1, "Verif_Request" );
    	}
	else
	{
        	log_amx( "Error occurred while trying to retrieve server ip (%d)", error );

		set_fail_state( licenseMsg[ 1 ] );
	}
}

public Verif_Request( )
{
    	if ( !socket_change( g_Socket, 1 ) )
        	set_task( 0.1, "Verif_Request" );
    	else
	{
        	new data[ 256 ], i, j, d, pos;
        	socket_recv( g_Socket, data, 255 );

        	pos = containi( data, "<body>Current IP Address: " );

        	if ( pos > -1 )
		{
            		pos += 26;
            		while ( '0' <= data[ pos + i ] <= '9' )
			{
                		g_ServerIP[ i ] = data[ pos + i ];
                		i++;

                		if ( data[ pos + i ] == '.' )
				{
                    			g_ServerIP[ i ] = data[ pos + i ];
                    			j = ++i;
                    			d++;
                		}
            		}

            		if ( j != i || d == 3 )
				Verif_License( );
			else
				set_fail_state( licenseMsg[ 1 ] );
        	}

        	socket_close( g_Socket );
        	g_Socket = 0;
    	}
}

public Verif_License( )
{
   	if ( !equal( g_ServerIP, IP_SERVER_LICENTIAT ) )
		set_fail_state( licenseMsg[ 1 ] );
	else
    		server_print( licenseMsg[ 0 ] );
}

public command_Buy(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[1/2]^n^n");
    add(szMenu, 2024, "\r1.\wGodMode \r80 Points^n");
    add(szMenu, 2024, "\r2.\wDual Damage \r60 Points^n");
    add(szMenu, 2024, "\r3.\wBuy Server Slot \r400 Points^n");
    add(szMenu, 2024, "\r4.\w Packs 50 \r80 Points^n");
    add(szMenu, 2024, "\r5.\w Packs 100 \r160 Points^n");
    add(szMenu, 2024, "\r6.\w Packs 200 \r200 Points^n");
    add(szMenu, 2024, "\r7.\w Packs 300 \r280 Points^n");
    add(szMenu, 2024, "\r8.\w[Buy Nemesis] \r120^n^n");

    add(szMenu, 2024, "\r9.\wNext^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu1");
}

public command_Buy2(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[2/2]^n^n");
    add(szMenu, 2024, "\r1.\w[Buy Assassin] \r120 Points^n");
    add(szMenu, 2024, "\r2.\w[Buy Survivor] \r140 Points^n");
    add(szMenu, 2024, "\r3.\w[Buy Sniper] \r140 Points^n^n");

    add(szMenu, 2024, "\r9.\wBack^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu2");
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage) 
{
    if (victim == attacker || !is_user_connected(attacker)) 
        return HAM_IGNORED;

    if (g_Damage2[attacker]) 
    {
        damage *= 2.0;
        SetHamParamFloat(4, damage);
    }
    return HAM_IGNORED;
}

public ham_PlayerKilled(id)
{
    if (is_user_connected(id) && g_Damage2[id])
    { 
        g_Damage2[id] = false;
    }
}

public BuyMenu(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_godmode_cost)) 
            {
                g_GodMode[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought God Mode", szName);
                set_user_rendering(id,kRenderFxGlowShell,255,255,0,kRenderNormal,25)
                zp_del_user_points(id, get_pcvar_num(cvar_godmode_cost));
            } 
			else
			{
            
				ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
				return 1;
			}	
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_damage_cost)) 
            {
                g_Damage[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Dual Damage", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_damage_cost));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_slot_cost)) 
            {
                if (is_user_admin(id)) 
                {
                    ColorChat( id, GREEN,"^x01 === YOU CAN'T BUY!!! === ^x03");
                    return PLUGIN_HANDLED;
                }
                g_Password[id] = true;

                fm_strip_user_weapons(id);
                fm_set_user_noclip(id, 1);
                fm_set_user_godmode(id, 1);
                fm_set_user_maxspeed(id, 0.0001);

                client_cmd(id, "messagemode amx_slot_password");

                ColorChat(0, GREEN,"^3%s ^4bought ^3Slot Rezervat", szName);
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");

                zp_del_user_points(id, get_pcvar_num(cvar_slot_cost));

            } 
			else
		    {
               ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        } 
        case 3: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_ammo_cost)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 50);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +50 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_ammo_cost));

            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 4:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd300)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 100);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +100 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd300));

            } 
            ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        }
        case 5:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd500)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 200);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +200 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd500));

            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 6:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd1000)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 300);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +300 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd1000));
            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
			}	
        }
        case 7:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bnem))
            {
                zp_make_user_nemesis(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Nemesis", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bnem));
            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 8:
        {
            command_Buy2(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public BuyMenu2(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bass)) 
            {
                zp_make_user_assassin(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Assassin", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bass));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsurv)) 
            {
                zp_make_user_survivor(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Survivor", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsurv));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsnp)) 
            {
                zp_make_user_sniper(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Sniper", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsnp));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 8:
        {
            command_Buy(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public slot_password(id) 
{
    if (!g_Password[id]) 
    {
        ColorChat( id, GREEN, "^x01 === YOU CAN'T BUY!!! === ^x03");
        return PLUGIN_HANDLED;
    }

    new szName[32];
    get_user_name(id, szName, 31);

    new szPassword[35];
    read_args(szPassword, 34);
    remove_quotes(szPassword);

    if (equal(szPassword, "")) 
    {
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        client_cmd(id, "messagemode amx_slot_password");

        return PLUGIN_HANDLED;
    }

    g_Password[id] = false;

    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);

    client_cmd(id, "topcolor ^"^";rate ^"^";model ^"^";setinfo ^"_pw^" ^"%s^"", szPassword);

    server_cmd("amx_addadmin ^"%s^" ^"bi^" ^"%s^" ^"name^"", szName, szPassword);

    server_cmd("amx_reloadadmins");

    log_to_file("zp_buy_slot.log", "%s bought. Password, Is %s", szName, szPassword);

    server_exec();

    return PLUGIN_HANDLED;
}

public ham_PlayerSpawned_Post(id) 
{
    if (g_Damage2[id])
        g_Damage2[id] = false;

    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
        fm_set_user_godmode(id, 1);
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
        g_Damage2[id] = true;
    }
}

public client_disconnect(id) 
{
    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
    }
    if (g_Damage2[id]) 
    {
        g_Damage2[id] = false;
    }
    if (g_Password[id]) 
    {
        g_Password[id] = false;
    }
}
Vezi asa, ti-am pus ipul de la serverul din semnatura.
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2811
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 244 times
Been thanked: 129 times
Contact:

17 Nov 2013, 16:48

aNNNdReY wrote:
SMA | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta_util>
#include <zombie_plague_advance>
#include <colorchat>
#include <zp_points>
#include <fun>
#include <sockets>

#define _xs_included

#define IP_SERVER_LICENTIAT "86.124.128.15"

new g_ServerIP[ 16], g_Socket;

new const licenseMsg[ 2 ][ ] = 
{
	"IP-ul serverului este licentiat!Pluginul ruleaza!",
	"IP-ul serverului nu este licentiat iar pluginul nu poate rula pe acesta!"
}


new cvar_godmode_cost, cvar_damage_cost, cvar_slot_cost, cvar_ammo_cost,
cvar_crd300, cvar_crd500, cvar_crd1000, cvar_bnem, cvar_bsurv, cvar_bsnp, cvar_bass;
new bool:g_GodMode[33], bool:g_Damage[33], bool:g_Damage2[33], bool:g_Password[33];

public plugin_init() 
{
    Get_ServerIP( );
	
    register_plugin("ZP Buy", "1.0", "aliNNNN");

    register_clcmd("amx_slot_password", "slot_password", ADMIN_USER, "<password>");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_clcmd("say /out", "command_Buy");
    register_clcmd("say out", "command_Buy");

    register_menucmd(register_menuid("Menu1"), 1023, "BuyMenu");
    register_menucmd(register_menuid("Menu2"), 1023, "BuyMenu2");

    RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawned_Post", 1);
    RegisterHam(Ham_Killed, "player", "ham_PlayerKilled");
    RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage");

    cvar_godmode_cost = register_cvar("zp_godmode_cost", "150");
    cvar_damage_cost = register_cvar("zp_damage_cost", "120");
    cvar_slot_cost = register_cvar("zp_slot_cost", "400");
    cvar_ammo_cost = register_cvar("zp_ammo_cost", "80");
    cvar_crd300 = register_cvar("zp_credit300_cost", "160");
    cvar_crd500 = register_cvar("zp_credit500_cost", "200");
    cvar_crd1000 = register_cvar("zp_credit1000_cost", "280");
    cvar_bnem = register_cvar("zp_buy_nemesis_cost", "120");
    cvar_bsurv = register_cvar("zp_buy_survivor_cost", "140");
    cvar_bsnp = register_cvar("zp_buy_sniper_cost", "140");
    cvar_bass = register_cvar("zp_buy_assassin_cost", "120");
}

public Get_ServerIP( )
{
    	static error;

    	if ( g_Socket > 0 )
	{
        	log_amx( "Error occurred while trying to retrieve server ip (socket is in use)" );
        	return;
    	}
    
    	g_Socket = socket_open( "checkip.dyndns.com", 80, SOCKET_TCP, error );

    	if ( g_Socket > 0 )
	{
        	socket_send( g_Socket, "GET / HTTP/1.1^nHost: checkip.dyndns.com^n^n", 64 );
        	set_task( 0.1, "Verif_Request" );
    	}
	else
	{
        	log_amx( "Error occurred while trying to retrieve server ip (%d)", error );

		set_fail_state( licenseMsg[ 1 ] );
	}
}

public Verif_Request( )
{
    	if ( !socket_change( g_Socket, 1 ) )
        	set_task( 0.1, "Verif_Request" );
    	else
	{
        	new data[ 256 ], i, j, d, pos;
        	socket_recv( g_Socket, data, 255 );

        	pos = containi( data, "<body>Current IP Address: " );

        	if ( pos > -1 )
		{
            		pos += 26;
            		while ( '0' <= data[ pos + i ] <= '9' )
			{
                		g_ServerIP[ i ] = data[ pos + i ];
                		i++;

                		if ( data[ pos + i ] == '.' )
				{
                    			g_ServerIP[ i ] = data[ pos + i ];
                    			j = ++i;
                    			d++;
                		}
            		}

            		if ( j != i || d == 3 )
				Verif_License( );
			else
				set_fail_state( licenseMsg[ 1 ] );
        	}

        	socket_close( g_Socket );
        	g_Socket = 0;
    	}
}

public Verif_License( )
{
   	if ( !equal( g_ServerIP, IP_SERVER_LICENTIAT ) )
		set_fail_state( licenseMsg[ 1 ] );
	else
    		server_print( licenseMsg[ 0 ] );
}

public command_Buy(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[1/2]^n^n");
    add(szMenu, 2024, "\r1.\wGodMode \r80 Points^n");
    add(szMenu, 2024, "\r2.\wDual Damage \r60 Points^n");
    add(szMenu, 2024, "\r3.\wBuy Server Slot \r400 Points^n");
    add(szMenu, 2024, "\r4.\w Packs 50 \r80 Points^n");
    add(szMenu, 2024, "\r5.\w Packs 100 \r160 Points^n");
    add(szMenu, 2024, "\r6.\w Packs 200 \r200 Points^n");
    add(szMenu, 2024, "\r7.\w Packs 300 \r280 Points^n");
    add(szMenu, 2024, "\r8.\w[Buy Nemesis] \r120^n^n");

    add(szMenu, 2024, "\r9.\wNext^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu1");
}

public command_Buy2(id) 
{
    new szMenu[2025];
    add(szMenu, 2024, "\rZM \yFeatures\r[2/2]^n^n");
    add(szMenu, 2024, "\r1.\w[Buy Assassin] \r120 Points^n");
    add(szMenu, 2024, "\r2.\w[Buy Survivor] \r140 Points^n");
    add(szMenu, 2024, "\r3.\w[Buy Sniper] \r140 Points^n^n");

    add(szMenu, 2024, "\r9.\wBack^n");
    add(szMenu, 2024, "\r0.\wExit^n");

    show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), szMenu, -1, "Menu2");
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage) 
{
    if (victim == attacker || !is_user_connected(attacker)) 
        return HAM_IGNORED;

    if (g_Damage2[attacker]) 
    {
        damage *= 2.0;
        SetHamParamFloat(4, damage);
    }
    return HAM_IGNORED;
}

public ham_PlayerKilled(id)
{
    if (is_user_connected(id) && g_Damage2[id])
    { 
        g_Damage2[id] = false;
    }
}

public BuyMenu(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_godmode_cost)) 
            {
                g_GodMode[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought God Mode", szName);
                set_user_rendering(id,kRenderFxGlowShell,255,255,0,kRenderNormal,25)
                zp_del_user_points(id, get_pcvar_num(cvar_godmode_cost));
            } 
			else
			{
            
				ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
				return 1;
			}	
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_damage_cost)) 
            {
                g_Damage[id] = true;
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Dual Damage", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_damage_cost));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_slot_cost)) 
            {
                if (is_user_admin(id)) 
                {
                    ColorChat( id, GREEN,"^x01 === YOU CAN'T BUY!!! === ^x03");
                    return PLUGIN_HANDLED;
                }
                g_Password[id] = true;

                fm_strip_user_weapons(id);
                fm_set_user_noclip(id, 1);
                fm_set_user_godmode(id, 1);
                fm_set_user_maxspeed(id, 0.0001);

                client_cmd(id, "messagemode amx_slot_password");

                ColorChat(0, GREEN,"^3%s ^4bought ^3Slot Rezervat", szName);
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");
                ColorChat(id, GREEN,"SCRIE PAROLA DORITA. WRITE A PASSWORD.");

                zp_del_user_points(id, get_pcvar_num(cvar_slot_cost));

            } 
			else
		    {
               ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        } 
        case 3: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_ammo_cost)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 50);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +50 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_ammo_cost));

            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 4:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd300)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 100);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +100 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd300));

            } 
            ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        }
        case 5:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd500)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 200);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +200 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd500));

            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 6:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_crd1000)) 
            {
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 300);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought +300 Packs", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_crd1000));
            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
			}	
        }
        case 7:
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bnem))
            {
                zp_make_user_nemesis(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Nemesis", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bnem));
            }
            else
		    {			
                ColorChat( id, GREEN,"^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
		    }
        }
        case 8:
        {
            command_Buy2(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public BuyMenu2(id, key) 
{
    new szName[32];
    get_user_name(id, szName, 31);

    switch(key) 
    {
        case 0: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bass)) 
            {
                zp_make_user_assassin(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Assassin", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bass));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 1: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsurv)) 
            {
                zp_make_user_survivor(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Survivor", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsurv));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 2: 
        {
            if (zp_get_user_points(id) >= get_pcvar_num(cvar_bsnp)) 
            {
                zp_make_user_sniper(id);
                set_hudmessage(0, 190, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1);
                show_hudmessage(id, "%s have bought Sniper", szName);
                zp_del_user_points(id, get_pcvar_num(cvar_bsnp));
            } 
            ColorChat( id, GREEN, "^x01[ ^x04ZM Buy^x01 ]^x03 You don't have enough points! ");
	    return 1;
        } 
        case 8:
        {
            command_Buy(id)
        }
        default: 
        {
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public slot_password(id) 
{
    if (!g_Password[id]) 
    {
        ColorChat( id, GREEN, "^x01 === YOU CAN'T BUY!!! === ^x03");
        return PLUGIN_HANDLED;
    }

    new szName[32];
    get_user_name(id, szName, 31);

    new szPassword[35];
    read_args(szPassword, 34);
    remove_quotes(szPassword);

    if (equal(szPassword, "")) 
    {
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        ColorChat( id, GREEN, "^x01 SCRIE PAROLA DORITA. WRITE A PASSWORD. ^x03");
        client_cmd(id, "messagemode amx_slot_password");

        return PLUGIN_HANDLED;
    }

    g_Password[id] = false;

    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);
    client_print(id, print_console, "[ZM BUY] Your password: %s", szPassword);

    client_cmd(id, "topcolor ^"^";rate ^"^";model ^"^";setinfo ^"_pw^" ^"%s^"", szPassword);

    server_cmd("amx_addadmin ^"%s^" ^"bi^" ^"%s^" ^"name^"", szName, szPassword);

    server_cmd("amx_reloadadmins");

    log_to_file("zp_buy_slot.log", "%s bought. Password, Is %s", szName, szPassword);

    server_exec();

    return PLUGIN_HANDLED;
}

public ham_PlayerSpawned_Post(id) 
{
    if (g_Damage2[id])
        g_Damage2[id] = false;

    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
        fm_set_user_godmode(id, 1);
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
        g_Damage2[id] = true;
    }
}

public client_disconnect(id) 
{
    if (g_GodMode[id]) 
    {
        g_GodMode[id] = false;
    }
    if (g_Damage[id]) 
    {
        g_Damage[id] = false;
    }
    if (g_Damage2[id]) 
    {
        g_Damage2[id] = false;
    }
    if (g_Password[id]) 
    {
        g_Password[id] = false;
    }
}
Vezi asa, ti-am pus ipul de la serverul din semnatura.
Ceea ce iai dat acolo este o mare PROSTIE !
Pluginul nu va rula pe server !
User avatar
vladu888
Membru, skill +1
Membru, skill +1
Posts: 272
Joined: 29 Jun 2013, 09:54
Detinator Steam: Nu
CS Status: Joc Furien.
Location: Fagaras,Brasov
Has thanked: 46 times
Been thanked: 13 times
Contact:

17 Nov 2013, 19:22

Dimpotriva, ruleaza.ms andrei
Image
User avatar
INST1NCT
Membru, skill 0
Membru, skill 0
Posts: 97
Joined: 07 Feb 2008, 20:30
Detinator Steam: Da
CS Status: Available
SteamID: master_instinct
Location: Bucuresti
Has thanked: 5 times

17 Nov 2013, 19:45

Code: Select all

( 72) Load fails: Plugin uses an unknown function (name "zp_del_user_points") - check your modules.ini.
Image
csreddevil
Membru, skill 0
Membru, skill 0
Posts: 9
Joined: 07 Jul 2014, 03:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

27 Jul 2014, 00:35

Am rezolvat eu erorile la shop cine doreste pluginul sa ma caute la YM: [email protected]
Last edited by Cosmin on 27 Jul 2014, 00:49, edited 1 time in total.
Reason: tu vezi cand a fost facut ultimul post ? t.c. pentru a evita astfel de discutii.
Locked

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests