Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: kennedyarz on Mar 07, 2017, 04:24 PM

Title: Check when one player attacks another
Post by: kennedyarz on Mar 07, 2017, 04:24 PM
How to check when a player is attacking another? Is it possible to know this at the moment it attacks? Example.
Message("" + player.Name + "Is Attacking" + plr.Name + "", player)
Title: Re: Check when one player attacks another
Post by: KAKAN on Mar 07, 2017, 04:52 PM
Client side: PlayerShoot :)
Title: Re: Check when one player attacks another
Post by: kennedyarz on Mar 07, 2017, 05:19 PM
Quote from: KAKAN on Mar 07, 2017, 04:52 PMClient side: PlayerShoot :)

A serious example?
Title: Re: Check when one player attacks another
Post by: vito on Mar 07, 2017, 06:11 PM
its alomost impossible in typical vc-mp gameplay, PlayerShoot wont work with fpv, shotgus, arms...
Title: Re: Check when one player attacks another
Post by: kennedyarz on Mar 07, 2017, 06:13 PM
Quote from: vito on Mar 07, 2017, 06:11 PMits alomost impossible in typical vc-mp gameplay, PlayerShoot wont work with fpv, shotgus, arms...
:(
Title: Re: Check when one player attacks another
Post by: KAKAN on Mar 08, 2017, 04:57 AM
function Player::PlayerShoot(player, weapon, hitEntity, hitPosition){
if( hitEntity == null ) return 1; // Don't use break, it may give weird errors in VCMP :x
if( hitEntity.rawget( "ID" ) == null ) return 1;
//hitEntity is a player :)
local stream = Stream();
stream.WriteInt( hitEntity.ID );
Server side:-
function onClientScriptData(player){
Message( player.Name + " is shooting " + FindPlayer( Stream.ReadInt() ).Name ); // Do some error checking before using theez
}
Theoretically it should work, but if
Quote from: vito on Mar 07, 2017, 06:11 PMPlayerShoot wont work with fpv, shotgus, arms...
its true, then it wont :)