Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
August 24, 2019, 12:27:11 am

Author Topic: Manhunt Game Mode  (Read 9942 times)

misterff1

  • Donator
  • Hero Member
  • *****
  • Posts: 582
    • View Profile
Re: Manhunt Game Mode
« Reply #30 on: April 06, 2014, 09:49:14 am »

EDIT: Misterff, did you ever fix that exit on death problem? If not send me a message with your server code.

well, I managed to get them out at some point, but only by making them exit, then die and then respawn. I will send you the code later today if I have time

Darwood37

  • Donator
  • Hero Member
  • *****
  • Posts: 690
    • View Profile
Re: Manhunt Game Mode
« Reply #31 on: April 06, 2014, 03:29:50 pm »
If you use
Code: [Select]
if v.player ~= player thenIt does not echo the typed chat back to you.

Code: [Select]
if v ~= player thenworks. but you get a error "Boolean Player == Player"

Code: [Select]
            for k,v in pairs(self.players) do
                player:SendChatMessage( "[Manhunt] "..v.player:GetName()..": " .. msg, v.player:GetColor() )
            end
            return false
        else
            return true
        end
does the same double chat no difference.

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: Manhunt Game Mode
« Reply #32 on: April 06, 2014, 06:48:51 pm »
If you use
Code: [Select]
if v.player ~= player thenIt does not echo the typed chat back to you.
Well good, then you can use that.
Quote
Code: [Select]
if v ~= player thenworks. but you get a error "Boolean Player == Player"
The error is because 'v' is not a player object, 'v.player' is. This is proven by the fact that v.player is used in the GetName() method. v is a table of data, though it may only contain v.player. Don't know without looking at where v is defined. It doesn't really matter though.
Quote
Code: [Select]
            for k,v in pairs(self.players) do
                player:SendChatMessage( "[Manhunt] "..v.player:GetName()..": " .. msg, v.player:GetColor() )
            end
            return false
        else
            return true
        end
does the same double chat no difference.
Hmm, sometimes it seems like return false must be in the first or second statement to work. Don't know in this case. But with the first code working it doesn't matter.

Darwood37

  • Donator
  • Hero Member
  • *****
  • Posts: 690
    • View Profile
Re: Manhunt Game Mode
« Reply #33 on: April 06, 2014, 07:10:20 pm »
No matter what i use it does not work correctly because you cannot pass
player:SendChatMessage( "[Manhunt] "..v.player:GetName()..": " .. msg, v.player:GetColor() )
to client chat, it requires the player to be the first argument. The only way to test this properly is to have 2 players online.

v.player:GetName() is the players actual name.

When dealing with troubleshooting i often put a print command so that i can see what the var is putting out.

At this point i give up and hope someone else fixes it. :)

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: Manhunt Game Mode
« Reply #34 on: April 06, 2014, 07:41:04 pm »
Replace:
Code: [Select]
        if self:IsInManhunt(player) then
            for k,v in pairs(self.players) do
                player:SendChatMessage( "[Manhunt] "..v.player:GetName()..": " .. msg, v.player:GetColor() )
            end
        else
            return true
        end

with:
Code: [Select]
        if self:IsInManhunt(player) then
            for k,v in pairs(self.players) do
local VPlayerObject = v.player
local VPlayerName = v.player:GetName()
local VPlayerColor = v.player:GetColor()
if VPlayerObject ~= player then
player:SendChatMessage( "[Manhunt] ".. VPlayerName ..": " .. msg, VPlayerColor )
print(VPlayerObject," is NOT",player,"sending message")
else
print(VPlayerObject," IS ",player,"NOT sending message")
end
            end
        else
            return true
        end

You don't need to have the client do anything to test this. Send a chat message, if you only see one then it's working. Your server console should say 'Darwood IS Darwood NOT sending message'. If there is another in at the time then it will say:
'OtherPlayerName is NOT Darwood sending message'
'Darwood IS Darwood NOT sending message'

I've never used that gamemode but this should work. If it doesn't perhaps that function should be re-written from scratch.

Darwood37

  • Donator
  • Hero Member
  • *****
  • Posts: 690
    • View Profile
Re: Manhunt Game Mode
« Reply #35 on: April 06, 2014, 09:41:00 pm »
Jas,  Still does not display what you typed locally. This is also reversed whatever i type displays on the other players screen as if they typed it "[MANHUNT] their.name: msg" . Think it needs a complete rewrite of the chat function.