AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   create fake player (https://forums.alliedmods.net/showthread.php?t=83015)

whosyourdaddy 01-02-2009 19:00

create fake player
 
how can i spawn like a fake player behind me, like it will look like a normal player where if u run into it u will stop, it can take damage, and has a gun in its hand

Bugsy 01-02-2009 21:48

Re: create fake player
 
Quote:

Originally Posted by whosyourdaddy (Post 737277)
how can i spawn like a fake player behind me, like it will look like a normal player where if u run into it u will stop, it can take damage, and has a gun in its hand

Below is from my Aimbot Detection plugin (link in sig).

PHP Code:

//not sure if you will need all of these
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>

new g_BotID

public AddBot()
{        
    new 
szTeam[2]
    new 
szName[33]
    
format(szName 32 "FakePlayer"  )
    
    
g_BotID engfunc(EngFunc_CreateFakeClientszName)
    
    if(!
g_BotID
        return 
PLUGIN_HANDLED
    
    engfunc
(EngFunc_FreeEntPrivateDatag_BotID )

    static 
szRejectReason[128]
    
dllfunc(DLLFunc_ClientConnectg_BotID szName"127.0.0.1"szRejectReason)
    
    if( !
is_user_connected(g_BotID) ) 
        return 
PLUGIN_HANDLED

    dllfunc
(DLLFunc_ClientPutInServerg_BotID)
    
set_pev(g_BotID,pev_spawnflagspev(g_BotIDpev_spawnflags) | FL_FAKECLIENT)
    
set_pev(g_BotID,pev_flagspev(g_BotID,pev_flags) | FL_FAKECLIENT)

    
//Set the bot to a team
    
formatszTeam "%d" CS_TEAM_CT
    
engclient_cmd(g_BotID"jointeam"szTeam)
    
engclient_cmd(g_BotID"joinclass""1")
    
    
//Spawn bot
    
fm_user_spawn(g_BotID)
    
    
//Make our bot appear as a spectator on scoreboard
    
message_begin(MSG_ALLget_user_msgid("TeamInfo") , _0)
    
write_byte(g_BotID)
    
write_string("SPECTATOR")
    
message_end()
    
    return 
PLUGIN_HANDLED


There are also forwards in the source to detect when the player gets shot\killed.

PHP Code:

    RegisterHam(Ham_Killed,     "player",  "func_Ham_Killed_Player")
    
RegisterHam(Ham_TakeDamage"player" "func_Ham_TakeDamage"

To get it placed behind you, you will need to use get\set origin along with some coordinate manipulation.

whosyourdaddy 01-02-2009 22:17

Re: create fake player
 
that creates a bot but i got this far so far

Code:

public beyonder_makeil(id)
{
 
if( beyonder[id] ) {
if (!Beyonderisdead[id]) {
Beyonderisdead[id]=true
}
return PLUGIN_CONTINUE
}
new Float:b_orig[3]
new originplayer[3], originlook[3], aimvec[3]
get_user_origin(id, originplayer)
get_user_origin(id, originlook, 2)
 
new distance[2]

distance[0] = originlook[0]-originplayer[0]
distance[1] = originlook[1]-originplayer[1]
 
new unitsinfront = 80
aimvec[0]=originplayer[0]+(unitsinfront*distance[0])/sqrt(distance[0]*distance[0]+distance[1]*distance[1])
aimvec[1]=originplayer[1]+(unitsinfront*distance[1])/sqrt(distance[0]*distance[0]+distance[1]*distance[1])
aimvec[2]=originplayer[2]
b_orig[0] = float(aimvec[0]);
b_orig[1] = float(aimvec[1]);
b_orig[2] = float(aimvec[2]);
beyonder[id] = create_entity("info_target")
entity_set_origin(beyonder[id], b_orig) new model[32],modelchange[128]
get_user_info(id,"model",model,31)
format(modelchange,127,"models/player/%s/%s.mdl",model,model)
client_print(id,print_chat,"You Spawned A Fake with model %s",model) //DEBUG MESSAGE
entity_set_model(beyonder[id], modelchange)
new const Float:mins[3] = { -16.0, -16.0, -36.0 }
new const Float:maxs[3] = { 16.0, 16.0, 36.0 }
set_size(beyonder[id],mins,maxs)
entity_set_origin(beyonder[id],b_orig)
set_pev(beyonder[id],pev_movetype, MOVETYPE_PUSHSTEP)
set_pev(beyonder[id],pev_solid, SOLID_BBOX)
set_pev(beyonder[id],pev_flags, FL_MONSTER)
set_pev(beyonder[id],pev_fixangle, 1)
new Float:health = 25
set_pev(beyonder[id],pev_nextthink, get_gametime() + 0.1)
set_pev(beyonder[id],pev_gravity, 1.0)
set_pev(beyonder[id],pev_friction, 1.0)
set_pev(beyonder[id],pev_animtime, 2.0)
set_pev(beyonder[id],pev_framerate, 1.0)
set_pev(beyonder[id],pev_health, health)
set_pev(beyonder[id],pev_takedamage, DAMAGE_AIM)
set_pev(beyonder[id],pev_max_health, health)
set_pev(beyonder[id],pev_controller_0, 125)
set_pev(beyonder[id],pev_controller_1, 125)
set_pev(beyonder[id],pev_controller_2, 125)
set_pev(beyonder[id],pev_controller_3, 125)
 
set_pev(beyonder[id],pev_classname, "playah")
return 1
}



i was wondering if i can do something to make this thing follow me like a hostage?


All times are GMT -4. The time now is 09:10.

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