Raised This Month: $ Target: $400
 0% 

Making a blue sphere around player?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 07-01-2009 , 09:07   Making a blue sphere around player?
Reply With Quote #1

Hi i wonder if someone knows a good way to make like a sphere around a player

http://www.macbrilliance.com/reviews...n/droideka.jpg

http://www.theforce.net/swtc/Pix/dvd/tpm/droideka3.jpg

http://www.billiecotton.com/pantherP...s/droideka.jpg

I guess it would be a sprite

Code:
/*Credits list
Emp' - Menu system
SnoW - loop
Exolent - random system
XxAvalanchexX - movement
*/


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

//Holds maximum players
new gMaxClients;

new menu;

new dcount;
new hcount;
new destroyer[32];
new healer[32];

new Float:lastMove[33];

//Here is to easy change models to use
#define droid_player_model "models/starwars/droid.mdl"
#define clone_player_model "models/starwars/clone.mdl"

public plugin_init() {
    register_plugin("Star wars: The clone wars", "0.1", "Micke1101")
    
    //Make so no one can buy weapons
    remove_entity_name("func_buyzone");
    
    //Gets the total amount of players
    gMaxClients = get_maxplayers();
    
    //At new round
    register_event("ResetHUD","newround","b");
    
    register_forward(FM_PlayerPreThink,"fw_playerprethink",1);
}
//Makes players download nessesary files
public precache(){
    precache_model(droid_player_model);
    precache_model(clone_player_model);
}
public fw_playerprethink(id)
{
    static Float:velocity[3];
    pev(id,pev_velocity,velocity);
    
    new Float:gtime = get_gametime();
    
    if(velocity[0] || velocity[1] || velocity[2] || !(pev(id,pev_flags) & FL_ONGROUND))
        lastMove[id] = gtime;

    if(gtime-lastMove[id] >= 2.0)
    {
        cs_set_user_armor(id, 100, 2)
        DestroyerShield(id);
        lastMove[id] = gtime;
    }
    
    return FMRES_IGNORED;
}
public DestroyerShield(id){
    set_task(1.0, "ShieldUp");
    set_task(31.0, "ShieldDown");
}
public ShieldUp(id){
    set_user_maxspeed(id, 50)
    set_user_godmode(id, 1)
}
public ShieldDown(id){
    //Ill be seting it to 0 cause it will be the same as default and im not sure what that is :P
    set_user_maxspeed(id, 0)
    set_user_godmode(id, 0)
}
public newround() {
    //Loop that will go though all players check team and show them the right teams menu.
    for ( new Player = 1; Player <= gMaxClients; Player++ )
    {
        if( is_user_alive( Player ) )
        {
            if(cs_get_user_team(Player) == CS_TEAM_T){
                cs_set_user_model(Player, droid_player_model)
                DroidMenu(Player);
            }
            if(cs_get_user_team(Player) == CS_TEAM_CT){
                cs_set_user_model(Player, clone_player_model)
                CloneMenu(Player);
            }
        }
    }
}
public CloneMenu(id)
{
    //Different choises of clones for ct
    menu = menu_create("\rClone trooper menu", "menu_handler");
    menu_additem(menu, "\Normal clone", "1", 0);
    menu_additem(menu, "\Healer clone", "2", 0);
    menu_additem(menu, "\Grenade clone", "3", 0);
    menu_additem(menu, "\Sniper clone", "4", 0);
    menu_additem(menu, "\Whats the differens?", "5", 0)
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}
public DroidMenu(id)
{
    //Different choises of droids for t
    menu = menu_create("\rDroid menu", "menu_handler");
    menu_additem(menu, "\Normal droid", "1", 0);
    menu_additem(menu, "\Healer droid", "2", 0);
    menu_additem(menu, "\Destroyer", "3", 0);
    menu_additem(menu, "\Sniper droid", "4", 0);
    menu_additem(menu, "\Whats the differens?", "5", 0)
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}
public menu_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:
        {
            if(cs_get_user_team(id) == CS_TEAM_T){
                cs_set_user_model(id, droid_player_model)
                give_item(id, "weapon_ak47")
            }
            if(cs_get_user_team(id) == CS_TEAM_CT){
                cs_set_user_model(id, clone_player_model)
                give_item(id, "weapon_m4a1")
            }
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 2:
        {
            if(cs_get_user_team(id) == CS_TEAM_T){
                cs_set_user_model(id, droid_player_model)
                give_item(id, "weapon_mp5navy")
            }
            if(cs_get_user_team(id) == CS_TEAM_CT){
                cs_set_user_model(id, clone_player_model)
                give_item(id, "weapon_mp5navy")
            }
            healer[hcount++] = id;
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 3:
        {
            if(cs_get_user_team(id) == CS_TEAM_T){
                cs_set_user_model(id, droid_player_model)
                give_item(id, "weapon_m249")
                destroyer[dcount++] = id;
            }
            if(cs_get_user_team(id) == CS_TEAM_CT){
                cs_set_user_model(id, clone_player_model)
                for ( new HeNades = 1; HeNades <= 10; HeNades++ )
                {
                    give_item(id, "weapon_hegrenade")
                }
                for ( new SmokeNades = 1; SmokeNades <= 10; SmokeNades++ )
                {
                    give_item(id, "weapon_smokegrenade")
                }
                for ( new FlashNades = 1; FlashNades <= 10; FlashNades++ )
                {
                    give_item(id, "weapon_flashbang")
                }
                give_item(id, "weapon_p90")
            }
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 4:
        {
            if(cs_get_user_team(id) == CS_TEAM_T){
                cs_set_user_model(id, droid_player_model)
                give_item(id, "weapon_awp")
            }
            if(cs_get_user_team(id) == CS_TEAM_CT){
                cs_set_user_model(id, clone_player_model)
                give_item(id, "weapon_awp")
            }
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 5:
        {
            if(cs_get_user_team(id) == CS_TEAM_T){
                show_motd(id, "starwars_droid.txt")
            }
            if(cs_get_user_team(id) == CS_TEAM_CT){
                show_motd(id, "starwars_clone.txt")
            }
        }
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
i want to make it at public ShieldUp(id){
and close it at
public ShieldDown(id){

Thanks in advanced
micke1101 is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 07-01-2009 , 09:20   Re: Making a blue sphere around player?
Reply With Quote #2

Create a entity ,give it your model,store this entity in pev_user4
then you can remove the entity in ShieldDown(id)
hzqst is offline
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 07-01-2009 , 09:25   Re: Making a blue sphere around player?
Reply With Quote #3

Ok.
But how will i make that a sphere?
micke1101 is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 07-01-2009 , 09:26   Re: Making a blue sphere around player?
Reply With Quote #4

precache a model
hzqst is offline
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 07-01-2009 , 09:32   Re: Making a blue sphere around player?
Reply With Quote #5

So the entity is a sphere around any model?
micke1101 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-01-2009 , 09:41   Re: Making a blue sphere around player?
Reply With Quote #6

Find an model looking like an sphere ;)
__________________
xPaw is offline
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 07-01-2009 , 09:47   Re: Making a blue sphere around player?
Reply With Quote #7

ah ok.
That will take alot of time...
micke1101 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-01-2009 , 10:06   Re: Making a blue sphere around player?
Reply With Quote #8

Nah, use a valve sprite "glow0" or something like that, scale him to a bigger value then set it to follow player, now you got a sphere no matter where you look from x)
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 07-01-2009 , 10:23   Re: Making a blue sphere around player?
Reply With Quote #9

Can you show me code example?
micke1101 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-01-2009 , 15:57   Re: Making a blue sphere around player?
Reply With Quote #10

Ok, here it is. A test plugin that try to simulate what you want. I say that this IS NOT the best way to make it, but should work.

Type /test in game, and look at player that typed.

Thanks to xPaw(teh nab) for test.
Attached Files
File Type: sma Get Plugin or Get Source (bubble_test.sma - 635 views - 1.4 KB)
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 07-01-2009 at 16:21.
Alka 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 15:26.


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