I'm making a mutator with an exec function where players can slap each other and remove 1-10 health points per slap, I'm not putting in a limit to slaps yet. My question is how do I make it so that the player string entered (to be slapped) can be checked against the list of players and then have the appropriate amount of health removed.
ps a pawn is any object that is controlled, the controller is the controller of the pawn and other is the pawn. I dont kno about player.
Code:
class SlapMut extends Mutator;
var int Strength;
var Pawn Other;
var Player Player;
//example - slap Me103xr5 10 being an as$$
exec function slap(out Player Player, out int Strength, optional string Reason)
{
local Controller C;
Level.Game.Broadcast(C, Player @ "is slapped with a strength of" @ Strength @ "for" @ Reason);
if ( (Strength <= 10)&&(Strength > 0) ){
ModifyPlayer(Other);
}
}
function ModifyPlayer(Pawn Other)
{
Other.Health -= Strength;
Super.ModifyPlayer(Other);
}
defaultproperties
{
GroupName="Slap"
FriendlyName="Slap"
Description="Slap another player and take away some of their health"
}
Last edited by a moderator: