AlliedModders

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

deadbunny 05-21-2013 15:46

VIP
 
Ok. I made a VIP plugin for JailBreak servers. But, didn't work to compile....
Code:

#pragma semicolon 1

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

#define PLUGIN "[JB] VIP"
#define VERSION "1.0"
#define AUTHOR "zBANG !!"

#define ADMIN_JBVIP ADMIN_LEVEL_H

new const PREFIX[] = { "!g[JbX.FreakZ.Ro - VIP]!n" };

new VipUsed[33];
new HasSpeed;

new Float:fast_speed = 400.0;
new Float:normal_speed = 250.0;

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR); 

    RegisterHam(Ham_Spawn, "player", "FwdHamSpawn_Post");
    RegisterHam(Ham_Item_PreFrame, "player", "FwdPreFrame_Post");
   
    register_clcmd("say /meniuvip", "cmdVmenu");
    register_clcmd("say_team /meniuvip", "cmdVmenu");
}

public FwdPreFrame_Post(id)
{
    if(!is_user_alive(id))
    {
        return PLUGIN_HANDLED;
    }

    if(!HasSpeed)
    {
        return PLUGIN_HANDLED;
    }
   
    else if(HasSpeed)
    {
        set_user_maxspeed(id, 500.0);
    }
   
    return PLUGIN_HANDLED;
}

public FwdHamSpawn_Post(id)
{
    HasSpeed = false;
    VipUsed[id] = false;
    set_user_maxspeed(id, 250.0);
    set_user_rendering( id, _, 0, 0, 0, _, 0 ); 
    set_user_footsteps(id, 0);
}

public cmdVmenu(id)
{
    if(cs_get_user_team(id) == CS_TEAM_T && get_user_flags(id) && ADMIN_JBVIP && VipUsed[id])
    {
        VipMenu(id);
    }
   
    else if(VipUsed[id])
    {
        client_printc(id, "%s Deja ai folosit !gVIP!n runda aceasta. Asteapta pana runda urmatoare", PREFIX);
    }
   
    else
    {
        client_printc(id, "%s Doar !gVIPii!n !gDetinuti!n pot folosi VIP", PREFIX);
        return PLUGIN_HANDLED;
    }
   
    return PLUGIN_HANDLED;
}

public VipMenu(id)
{
    new menu = menu_create("\yJailBreak VIP Menu:^n\rby zBANG !!", "VipMenu_handler");

    menu_additem(menu, "Gravitate Scazuta", "1", 0);
    menu_additem(menu, "Invizibilitate", "2", 0);
    menu_additem(menu, "Viteza", "3", 0);
    menu_additem(menu, "Droguri", "4", 0);
    menu_additem(menu, "Viata", "5", 0);
    menu_additem(menu, "Armura", "6", 0);
    menu_additem(menu, "Deagle cu 1 glont", "7", 0);
    menu_additem(menu, "Glock cu 3 gloante", "8", 0);
    menu_additem(menu, "USP cu 2 gloante", "9", 0);

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}

public VipMenu_handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);

    new key = str_to_num(data);

    switch(key)
    {
        case 1:
        {
            set_user_gravity(id, 0.4375);
            VipUsed[id] = true;
           
            client_printc(id, "%s Ai cumparat !gGravitate!n", PREFIX);
        }
        case 2:
        {
            set_user_rendering(id, kRenderFxNone, 50, 50, 50, kRenderTransAdd, 50);
            set_user_footsteps(id, 1);
            VipUsed[id] = true;
           
            client_printc(id, "%s Ai cumparat !gInvizibilitate!n", PREFIX);
        }
        case 3:
        {
            VipUsed[id] = true;
            HasSpeed = true;
            set_user_maxspeed(id, 500.0);
           
            client_printc(id, "%s Ai cumparat !gViteza!n", PREFIX);
        }
        case 4:
        {
        set_user_armor(id, 150);
        set_user_health(id, 200);
        set_user_maxspeed(id, 380.0);
        client_printc(id, "%s[^4JbX.FreakZ.Ro^3] !n%s!n a folosit !gVIP!g pt a lua !tDroguri!t !");
        }
        case 5:
        {
            VipUsed[id] = true;
            set_user_health(id, 200); 
            client_printc(id, "%s Ai cumparat !gViata!n", PREFIX);
        }
        case 6:
        {
            VipUsed[id] = true;
            set_user_armor(id, 200);
           
            client_printc(id, "%s Ai cumparat !gArmura!n", PREFIX);
        }
        case 7:
        {
            cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 1);
            VipUsed[id] = true;
           
            client_printc(id, "%s Ai cumparat !gDeagle cu 1 glont!n", PREFIX);
        }
        case 8:
        {
            cs_set_weapon_ammo(give_item(id, "weapon_glock18"), 3);
            VipUsed[id] = true;
           
            client_printc(id, "%s Ai cumparat !gGlock cu 3 gloante!n", PREFIX);
        }
        case 9:
        {
            VipUsed[id] = true;
            cs_set_weapon_ammo(give_item(id, "weapon_usp"), 2);
           
            client_printc(id, "%s Ai cumparat !uSp cu 2 gloante!n", PREFIX);
}
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}


stock client_printc(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
   
    replace_all(msg, 190, "!n", "^x01"); // Default Renk(Sari)
    replace_all(msg, 190, "!g", "^x04"); // Yesil Renk
    replace_all(msg, 190, "!t", "^x03"); // Takim Renk( CT mavi , T kirmizi )
   
    if (id) players[0] = id; else get_players(players, count, "ch");
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/

And, also, I find a plugin, when, a player is a VIP , in TAB (at scores) it appares with "VIP" , not with "DEAD" . It works to compile, but it doesn't work on server... Code:
Code:

#include < amxmodx >

#define ADMIN_JBVIP ADMIN_LEVEL_H

#define SCOREATTRIB_NONE    0
#define SCOREATTRIB_DEAD    ( 1 << 0 )
#define SCOREATTRIB_BOMB    ( 1 << 1 )
#define SCOREATTRIB_VIP  ( 1 << 2 )

public plugin_init( ) {
    register_plugin( "VIP Admin", "0.0.1", "Exolent" );
   
    register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" );
}

public MessageScoreAttrib( iMsgID, iDest, iReceiver ) {
    new iPlayer = get_msg_arg_int( 1 );
    if( is_user_connected( iPlayer )
    && ( get_user_flags( iPlayer ) & ADMIN_JBVIP ) ) {
        set_msg_arg_int( 2, ARG_BYTE, is_user_alive( iPlayer ) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD );
    }
}

I'll be happy if you help me with those plugins.... With the first, especially with the first. I hope you know....
I wait responses !

benio101 05-23-2013 11:20

Re: VIP
 
The best way to make VIP state in Score Table is just binary sum the 2nd message argument with 4.
PHP Code:

register_message(get_user_msgid("ScoreAttrib"), "VipStatus"); 

PHP Code:

#define ADMIN_JBVIP ADMIN_LEVEL_H 

PHP Code:

public VipStatus(){
    new 
id=get_msg_arg_int(1);
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_JBVIP){
        
set_msg_arg_int(2ARG_BYTEget_msg_arg_int(2)|4);
    }


Note, that Alive Terrorists won`t see the VIP status in Score Table due to restrictions on user side and you can`t do anythink with that without editing user files, what is normally impossible even using forbidden on AM slow hacks.

Note also, when player`s 2nd arg state is 0, then it is no txt in table.
Else, the fewer flag value, the higher priority. It means,
if get_msg_arg_int(2)&1 then the "Dead" text will appear with highest priority.
then, if !(get_msg_arg_int(2)&1) && get_msg_arg_int(2)&2 - the "Bomb" text will appear.
finally, if !(get_msg_arg_int(2)&2) && !(get_msg_arg_int(2)&4) - the "VIP" text will be showned.
This guarantees, that summing arg 2 msg with 4 will not collide with any other states.
Anyway, alive terros wont see the vip text and you cant fix it from server side.

Best regards.

deadbunny 05-23-2013 11:36

Re: VIP
 
Ok, I don't understand more of those you say, but, finally, can you help me those plugins? (especially first....) and did you let me the edited .sma ? :-w

Blizzard_87 05-23-2013 16:09

Re: VIP
 
Quote:

Originally Posted by deadbunny (Post 1956900)
Ok, I don't understand more of those you say, but, finally, can you help me those plugins? (especially first....) and did you let me the edited .sma ? :-w

This is scripting help. If you want someone to edit your whole plugin to fix it then post in the request section.


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

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