AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Event dosent work properly (https://forums.alliedmods.net/showthread.php?t=217596)

At3u 06-04-2013 16:01

Event dosent work properly
 
i quit this plugin

TheDS1337 06-04-2013 16:20

Re: Event dosent work properly
 
Try use TextMsg event

At3u 06-04-2013 17:04

Re: Event dosent work properly
 
Yeah..but why team events dosent work in my plugin ?

TheDS1337 06-04-2013 17:08

Re: Event dosent work properly
 
Quote:

Originally Posted by At3u (Post 1964672)
Yeah..but why team events dosent work in my plugin ?

use register_logevent with Terrorist_Win ( i saw it in amxmodx.inc ) check it :D

At3u 06-04-2013 17:52

Re: Event dosent work properly
 
Might be the problem that both events are using the same public ?

Edit: if i use 1 event plugin works just fine..if i use both events menu is showed no matters who win

TheDS1337 06-05-2013 04:00

Re: Event dosent work properly
 
Test this :D
Code:

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

#pragma semicolon 1 

new bonus;
const WINNING_TEAM_MENU_KEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5;

public plugin_init()
{
    register_plugin("WinnerTeam_Gifts", "1.0", "M3taph0riK");

    register_menucmd(register_menuid("Echipa ta a castigat alege un cadou :"), WINNING_TEAM_MENU_KEYS, "Gifts");

    register_message(get_user_msgid("TextMsg"), "message_textmsg");

    bonus = register_cvar("bonus","1000");
}

public message_textmsg()
{
        static string[32];
        get_msg_arg_string(2, string, charsmax(string));
       
        if(equal(string, "#Terrorists_Win"))
        {               
                for(new i = 1; i <= get_maxplayers(); i++)
                {       
                        if(get_user_team(i) != 1)
                                continue;
                               
                        GiftsMenu(i);
                }
        }
        else if(equal(string, "#CTs_Win"))
        {               
                for(new i = 1; i <= get_maxplayers(); i++)
                {
                        if(get_user_team(i) != 2)
                                continue;
                               
                        GiftsMenu(i);
                }
        }
}

public MomeyGift(id)

    if (!is_user_alive(id))
    return;
 
    new money = cs_get_user_money(id);
    new got = get_pcvar_num(bonus);
    cs_set_user_money(id, money + got);
}

public HpGift(id)
{
    if (!is_user_alive(id))
    return;

    set_user_health(id, 125);
}

public ArmorGift(id)
{
    if (!is_user_alive(id))
    return;

    set_user_armor(id, 150);
}

public FootStepsGift(id)
{
    if (!is_user_alive(id))
    return;

    set_user_footsteps(id, 1);
}

public GiftsMenu(id)
{       
    static const szMenu[] = "\rEchipa ta a castigat alege un cadou :^n^n\w1. \yExtra cash 1000$^n\w2. \yExtra life + 25 HP^n\w3. \yArmura cu 150 HP^n\w4. \ySilent FootSteps^n\w5. \yPachetul intreg de grenazi";
    show_menu(id, WINNING_TEAM_MENU_KEYS, szMenu);

    return PLUGIN_HANDLED;
}

public Gifts(id, key)
{
    switch( key )
    {
        case 0:
        {
            MomeyGift(id);
        }
        case 1:
        {
            HpGift(id);
        }
        case 2:
        {
            ArmorGift(id);
        }
        case 3:
        {
            FootStepsGift(id);
        }
        case 4:
        {
            give_item(id,"weapon_hegrenade");
            give_item(id,"weapon_flashbang");
            give_item(id,"weapon_flashbang");
            give_item(id,"weapon_smokegrenade");
        }       
    }

    return PLUGIN_HANDLED;
}


At3u 06-05-2013 04:18

Re: Event dosent work properly
 
Dosent work ! If a team wins Gifts menu dosent appear...

TheDS1337 06-05-2013 04:26

Re: Event dosent work properly
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun> 

#pragma semicolon 1 

new bonus;

public plugin_init()
{
    register_plugin("WinnerTeam_Gifts", "1.0", "M3taph0riK");

    register_menu("Gifts Menu", 1023, "Gifts");

    register_message(get_user_msgid("TextMsg"), "message_textmsg");

    bonus = register_cvar("bonus","1000");
}

public message_textmsg()
{
        static string[32];
        get_msg_arg_string(2, string, charsmax(string));
       
        if(equal(string, "#Terrorists_Win"))
        {               
                for(new i = 1; i <= get_maxplayers(); i++)
                {       
                        if(get_user_team(i) == 1)                       
                                GiftsMenu(i);
                }
        }
        else if(equal(string, "#CTs_Win"))
        {               
                for(new i = 1; i <= get_maxplayers(); i++)
                {
                        if(get_user_team(i) == 2)                       
                                GiftsMenu(i);
                }
        }
}

public MomeyGift(id)

    if (!is_user_alive(id))
    return;
 
    new money = cs_get_user_money(id);
    new got = get_pcvar_num(bonus);
    cs_set_user_money(id, money + got);
}

public HpGift(id)
{
    if (!is_user_alive(id))
    return;

    set_user_health(id, 125);
}

public ArmorGift(id)
{
    if (!is_user_alive(id))
    return;

    set_user_armor(id, 150);
}

public FootStepsGift(id)
{
    if (!is_user_alive(id))
    return;

    set_user_footsteps(id, 1);
}

public GiftsMenu(id)
{       
    static const szMenu[] = "\rEchipa ta a castigat alege un cadou :^n^n\w1. \yExtra cash 1000$^n\w2. \yExtra life + 25 HP^n\w3. \yArmura cu 150 HP^n\w4. \ySilent FootSteps^n\w5. \yPachetul intreg de grenazi";
    show_menu(id, 1023, szMenu, -1, "Gifts Menu");   
       
    return PLUGIN_HANDLED;
}

public Gifts(id, key)
{
    switch( key )
    {
        case 0:
        {
            MomeyGift(id);
        }
        case 1:
        {
            HpGift(id);
        }
        case 2:
        {
            ArmorGift(id);
        }
        case 3:
        {
            FootStepsGift(id);
        }
        case 4:
        {
            give_item(id,"weapon_hegrenade");
            give_item(id,"weapon_flashbang");
            give_item(id,"weapon_flashbang");
            give_item(id,"weapon_smokegrenade");
        }       
    }

    return PLUGIN_HANDLED;
}


At3u 06-05-2013 04:35

Re: Event dosent work properly
 
Including amxmisc dosent change anything.....plugin still not works


All times are GMT -4. The time now is 16:17.

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