0 Members and 2 Guests are viewing this topic.
const GodMode_EnemyKill = False;type trPlayer = record //Add more methods here if you use array/object style storage. GodMode : Boolean; GodMode_JustHitPlayer : Boolean; GodMode_JustGotKilled : Boolean; end;var aPlayers: array[1..32] of trPlayer;function GodMode_OnCommand(ID: byte; Text: string): boolean;begin if (MaskCheck(Text,'/kill *') and (GetPlayerStat(strtoint(Copy(Text,7,Length(Text))),'Active') = True) and (GetPlayerStat(strtoint(Copy(Text,7,Length(Text))),'Alive') = True) and (GetPlayerStat(strtoint(Copy(Text,7,Length(Text))),'Team') <> 5)) then begin aPlayers[ID].GodMode_JustGotKilled := True; DoDamage(strtoint(Copy(Text,7,Length(Text))), 200); Command('/say '+GetPlayerStat(strtoint(Copy(Text,7,Length(Text))), 'Name')+' killed by admin'); Result:=True; end;end;function GodMode_OnPlayerCommand(ID: byte; Text: string): boolean;begin if (Text = '/kill') or (Text = '/brutalkill') and (GetPlayerStat(ID, 'Active') = True) and (GetPlayerStat(ID, 'Alive') = True) and (GetPlayerStat(ID, 'Team') <> 5) then begin aPlayers[ID].GodMode_JustGotKilled := True; DoDamage(ID,200); Result:=True; end; if (MaskCheck(Text,'/godmode *')) and (GetPlayerStat(ID, 'Active') = True) then begin if (GetPlayerStat(ID, 'Team') <> 5) then begin if (strtoint(Copy(Text,10,Length(Text))) = 1) and (aPlayers[ID].GodMode = False) then begin if GetPlayerStat(ID, 'Flagger') then DoDamage(ID,200); aPlayers[ID].GodMode := True; Command('/say "'+GetPlayerStat(ID, 'Name')+'" activated god mode (/godmode 1).'); end else if (strtoint(Copy(Text,10,Length(Text))) = 0) and (aPlayers[ID].GodMode) then begin aPlayers[ID].GodMode := False; Command('/say "'+GetPlayerStat(ID, 'Name')+'" deactivated god mode (/godmode 0).'); DoDamage(ID,200); end else begin if aPlayers[ID].GodMode then begin SayToPlayer(ID, GetPlayerStat(ID, 'Name')+', your god mode is activated at the moment. Use /godmode 0 to deactivate it.'); end else SayToPlayer(ID, GetPlayerStat(ID, 'Name')+', your god mode is deactivated at the moment. Use /godmode 1 to activate it.'); end; end else SayToPlayer(ID, GetPlayerStat(ID, 'Name')+', you can''t activate/deactivate the god mode when you are a spectator.'); end;end;procedure GodMode_OnLeaveGame(ID,Team: byte;Kicked: boolean);begin aPlayers[ID].GodMode := False; aPlayers[ID].GodMode_JustHitPlayer := False; aPlayers[ID].GodMode_JustGotKilled := False;end;procedure GodMode_OnFlagGrab(nPlayerID, nTeamIndex: byte; bGrabbedInBase: boolean);begin if ((GetPlayerStat(nPlayerID, 'Alive') = True) and aPlayers[nPlayerID].GodMode) then begin aPlayers[nPlayerID].GodMode_JustGotKilled := True; DoDamage(nPlayerID, 200); end;end;//BUG: Whenever a player is damaged by map (not killing), this is not called. :Ofunction GodMode_OnPlayerDamage(nVictimPlayerID, nShooterPlayerID: byte; nDamage: integer): integer;begin // Victim = Player Damaged // Shooter = Player doing the damage // Victim = Shooter when: // Suicide. // Map/Server kill of a player. if ((GetPlayerStat(nVictimPlayerID, 'Active') and GetPlayerStat(nShooterPlayerID, 'Active')) and (GetPlayerStat(nVictimPlayerID, 'Alive') and GetPlayerStat(nShooterPlayerID, 'Alive'))) then begin if (nShooterPlayerID <> nVictimPlayerID) then begin Result := 0; if aPlayers[nShooterPlayerID].GodMode then begin //hit him with the same strength but opposite direction :D aPlayers[nShooterPlayerID].GodMode_JustHitPlayer:=True; DoDamage(nShooterPlayerID, nDamage); end else if GodMode_EnemyKill then begin Result := nDamage; end; end else if aPlayers[nVictimPlayerID].GodMode then begin if aPlayers[nVictimPlayerID].GodMode_JustGotKilled then begin Result := nDamage; aPlayers[nVictimPlayerID].GodMode_JustGotKilled := False; end else if aPlayers[nVictimPlayerID].GodMode_JustHitPlayer then begin Result := nDamage; aPlayers[nVictimPlayerID].GodMode_JustHitPlayer := False; end else Result := 0; end else Result := nDamage; end;end;function OnCommand(ID: byte; Text: string):Boolean;begin Result:=False; //Put other OnCommand codes in here. if GodMode_OnCommand(ID, Text) then Result:=True;end;function OnPlayerCommand(ID: Byte; Text: string): boolean;begin Result:=False; //Put other OnPlayerCommand codes in here. if GodMode_OnPlayerCommand(ID, Text) then Result:=True;end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);begin GodMode_OnLeaveGame(ID, Team, Kicked); //Put other OnLeaveGame codes in here.end;procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);begin GodMode_OnFlagGrab(ID, TeamFlag, GrabbedInBase); //Put other OnFlagGrab codes in here.end;function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;begin // Victim = Player Damaged // Shooter = Player doing the damage result := GodMode_OnPlayerDamage(Victim, Shooter, Damage); //Put other OnPlayerDamage codes in here and make sure the result value //is the one wanted, as the "Result" variable now holds the damage from //GodMode.end;
killed whenever they touch any flag that can be grabbed, harmed whenever they hit other players. Damage they do to other players is redirected back to them. If Friendly Fire is on, then that also happens when they hit players in their own teams
Your "super god" is not interesting, nobody will play in this server
type trPlayer = record //Add more methods here if you use array/object style storage. GodMode : Boolean; end;var aPlayers: array[1..32] of trPlayer;function GodMode_OnPlayerCommand(ID: byte; Text: string): boolean;begin if MaskCheck(Text,'/godmode *') then begin if (strtoint(Copy(Text,10,Length(Text))) = 1) then begin aPlayers[ID].GodMode := True; end else aPlayers[ID].GodMode := False; end;end;procedure GodMode_OnLeaveGame(ID,Team: byte;Kicked: boolean);begin aPlayers[ID].GodMode := False;end;//BUG: Whenever a player is damaged by map (not killing), this is not called. :Ofunction GodMode_OnPlayerDamage(nVictimPlayerID, nShooterPlayerID: byte; nDamage: integer): integer;begin // Victim = Player Damaged // Shooter = Player doing the damage // Victim = Shooter when: // Suicide. // Map/Server kill of a player. if aPlayers[nVictimPlayerID].GodMode then begin Result := 0; end else Result := nDamage;end;function OnPlayerCommand(ID: Byte; Text: string): boolean;begin Result:=False; //Put other OnPlayerCommand codes in here. if GodMode_OnPlayerCommand(ID, Text) then Result:=True;end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);begin GodMode_OnLeaveGame(ID, Team, Kicked); //Put other OnLeaveGame codes in here.end;function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;begin // Victim = Player Damaged // Shooter = Player doing the damage result := GodMode_OnPlayerDamage(Victim, Shooter, Damage); //Put other OnPlayerDamage codes in here and make sure the result value //is the one wanted, as the "Result" variable now holds the damage from //GodMode.end;
If Result := 0, then no damage is ever dealt