Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: kennedyarz on March 7th, 2017, 04:24 PM

Title: Check when one player attacks another
Post by: kennedyarz on March 7th, 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.
Code: [Select]
Message("" + player.Name + "Is Attacking" + plr.Name + "", player)
Title: Re: Check when one player attacks another
Post by: KAKAN on March 7th, 2017, 04:52 PM
Client side: PlayerShoot :)
Title: Re: Check when one player attacks another
Post by: kennedyarz on March 7th, 2017, 05:19 PM
Quote from KAKAN on March 7th, 2017, 04:52 PM
Client side: PlayerShoot :)
A serious example?
Title: Re: Check when one player attacks another
Post by: vito on March 7th, 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 March 7th, 2017, 06:13 PM
Quote from vito on March 7th, 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: KAKAN on March 8th, 2017, 04:57 AM
Code: [Select]
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:-
Code: [Select]
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 March 7th, 2017, 06:11 PM
PlayerShoot wont work with fpv, shotgus, arms...
its true, then it wont :)