Raised This Month: $ Target: $400
 0% 

[SOLVED] Help giving fakeclient a weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-24-2009 , 22:53   Re: Help giving fakeclient a weapon
Reply With Quote #1

Solved. Apparently my code was working but the bot was invisible so I couldn't see the weapon in-hand. Also, client_cmd was not making him shoot or drop weapon so I assumed he did not have it. The code below has a command to add a bot with deagle and another command to drop the deagle.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "bugsy"

#define OFFSET_TEAM        114

enum CsTeams 
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T,
    
CS_TEAM_CT,
    
CS_TEAM_SPECTATOR 
}

new 
g_BotID;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd"amx_makebot""Bot");
    
register_concmd"amx_dropweapon""DropWeap");
}

public 
Bot(id)
{
    new 
Float:fOrigin[3];
    
pevid,pev_origin,fOrigin);
    
    
AddBot(id);

    
fm_entity_set_origing_BotID fOrigin );
    
    
fm_give_itemg_BotID,"weapon_deagle");
}    


public 
DropWeap(id)
{
    
engclient_cmdg_BotID "drop" "weapon_deagle");
}

public 
AddBot(id)
{        
    new 
szTeam[2];
    new 
szName[6];

    
formatszName "xyz%2d" random_num(10,99) );
    
g_BotID engfunc(EngFunc_CreateFakeClientszName );
    
    if ( !
g_BotID 
        return 
PLUGIN_HANDLED;
    
    
engfuncEngFunc_FreeEntPrivateDatag_BotID );

    static 
szRejectReason[128];
    
dllfuncDLLFunc_ClientConnectg_BotID szName"127.0.0.1"szRejectReason );
    
    
dllfuncDLLFunc_ClientPutInServerg_BotID)
    
set_pevg_BotIDpev_spawnflagspev(g_BotIDpev_spawnflags) | FL_FAKECLIENT );
    
set_pevg_BotIDpev_flagspev(g_BotID,pev_flags) | FL_FAKECLIENT );

    
//Bot created, assign to appropriate team. 
    
formatszTeam "%d" , (fm_cs_get_user_teamid ) == CS_TEAM_T) ? CS_TEAM_CT CS_TEAM_T ) ;
    
engclient_cmdg_BotID"jointeam"szTeam );
    
engclient_cmdg_BotID"joinclass""1" );
    
    
//Spawn bot
    
fm_user_spawng_BotID );
    
    
//Make bot invisible
    
fm_set_renderingg_BotIDkRenderNormal255255255kRenderNormal25 );
    
    return 
PLUGIN_HANDLED;
}

public 
fm_user_spawn(id

    
set_pev(idpev_deadflagDEAD_RESPAWNABLE);
    
dllfunc(DLLFunc_Spawnid);
    
set_pev(idpev_iuser10);
}

public 
CsTeams:fm_cs_get_user_team(id)
{
    return 
CsTeams:get_pdata_int(idOFFSET_TEAM);

__________________
Bugsy 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 12:34.


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