Author Topic: [Request] Auto-drop  (Read 1041 times)

0 Members and 1 Guest are viewing this topic.

Offline Verstorbene

  • Major(1)
  • Posts: 7
[Request] Auto-drop
« on: July 30, 2007, 03:09:16 pm »
'Ello, need help with a specific problem in my zombie server. The problem is that players like to be exploitive and grind over 300 kills on a map by running through a group of zombies with a chainsaw. I can't disable the chainsaw or zombies would be useless; however, I was wondering how difficult it would be to create a script that would make a player on team bravo automatically drop their weapon if the picked up a chainsaw?

Thanks in advance for the help.

Offline mxyzptlk

  • Veteran
  • *****
  • Posts: 1493
  • The Panda Ninja
Re: [Request] Auto-drop
« Reply #1 on: July 30, 2007, 03:33:29 pm »
Why would bravo want to kill zombies, which are meant to be on bravo themselves?

"While preceding your entrance with a grenade is a good tactic in
Quake, it can lead to problems if attempted at work." -- C Hacking

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: [Request] Auto-drop
« Reply #2 on: July 30, 2007, 03:40:07 pm »
procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
  for i:=1 to 32 do
    If (GetPlayerStat(i,'Active') = true) and (GetPlayerStat(i,'Human') = true) then begin
      If GetPlayerStat(i,'Primary') = 15 then
        ForceWeapon(i,255,GetPlayerStat(i,'Secondary'),0);
      If GetPlayerStat(i,'Secondary') = 15 then
        ForceWeapon(i,GetPlayerStat(i,'Primary'),255,GetPlayerStat(i,'Ammo'));
    end;
end;
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Verstorbene

  • Major(1)
  • Posts: 7
Re: [Request] Auto-drop
« Reply #3 on: July 30, 2007, 07:00:16 pm »
Worked awesomely, Avarax. I'd say I love you, but that'd be wierd.

While we're on this subject, is there a way to make the saw just not count for points?

(By the way, I hope you don't mind, but I'm gonna pick apart that code to learn exactly how you did it. =] )

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: [Request] Auto-drop
« Reply #4 on: July 30, 2007, 07:09:43 pm »
Yup.

Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  if (Weapon = 'Chainsaw') and (GetPlayerStat(Killer,'Team') <> GetPlayerStat(Victim,'Team')) then SetScore(Killer,GetPlayerStat(Killer,'Kills') - 1);
end;

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: [Request] Auto-drop
« Reply #5 on: July 30, 2007, 07:11:59 pm »
procedure AppOnIdle(Ticks: integer); //AppOnIdle is executed every second
var i: byte;
begin
 for i:=1 to 32 do  //This loop will allow me to check every single playerslot, as their can be a maximum of 32 player IDs.
 If (GetPlayerStat(i,'Active') = true) and (GetPlayerStat(i,'Human') = true) then begin //checks wether ID is active (=player exists) and is human (not bot)
 If GetPlayerStat(i,'Primary') = 15 then   //Checks if primary of the player is a saw, if it is, it forces fist as primary instead (fist = 255)
 ForceWeapon(i,255,GetPlayerStat(i,'Secondary'),0);
 If GetPlayerStat(i,'Secondary') = 15 then //Same for secondary
 ForceWeapon(i,GetPlayerStat(i,'Primary'),255,GetPlayerStat(i,'Ammo'));
 end;
end;
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Verstorbene

  • Major(1)
  • Posts: 7
Re: [Request] Auto-drop
« Reply #6 on: July 30, 2007, 09:01:15 pm »
Thank you, Avarax and DorkeyDear. You both have been awesome, and thank you Avarax for labeling what everything does. It will help me in the future.