Jump to content

Peds are :Oing up my script


marty000123

Recommended Posts

''WARNING: redzone/server.lua:6: Bad argument @ getAccountName [Expected account at argument 1, got boolean] [DUP x5]''

''ERROR: redzone/server.lua:7: attempt to concatenate local áccName' (a boolean value)''

This doesn't happen when I have my zombies turned off. So the peds are :Oing up the script, does anyone know a solution to this?

redzone = createRadarArea (  -978.54296875, -343.0224609375, 3900, 800, 255, 0, 0, 30)
local redz = createColRectangle ( -978.54296875, -343.0224609375, 3900, 800 )

function hill_Enter ( thePlayer, matchingDimension )
  local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Staff" ) ) then
        local playerName = getPlayerName ( thePlayer )
        if getElementType ( thePlayer ) == "player" then
                killPed(thePlayer)
outputChatBox ( playerName.." entered the redzone, and died of radiation!", root, 255, 255, 109 )
end
	        
        end
end
addEventHandler ( "onColShapeHit", redz, hill_Enter )

 

Edited by marty000123
Link to comment

That worked, thanks!

Now I have a similar problem with peds. Whenever a zombie hits me, the following 2 warnings happen (theyre connected but i cant figure out how to fix):

WARNING: playerzombie/server.lua: BAd argument @ getPlayerTeam [expected player at argument 1, got ped] [DUP x2]
WARNING: playerzombie/server.lua: Bad argumetn @ getTeamName [expected team at argument 1, got boolean] [DUP x2]

function katana(attacker, weapon, bodypart, loss)
  if getTeamName(getPlayerTeam(attacker)) == "Infected" then
        if getPedWeapon(attacker) == 8 then
            setElementHealth(source, getElementHealth(source) - 40 )
        end
    end
end
addEventHandler("onPlayerDamage", root, katana)
Edited by marty000123
Link to comment
  • Moderators
2 hours ago, marty000123 said:

So ye can I get some additional help with this? Still haven't fixed it. The script doesn't work either.

Don't post such useless reply and show us what you tried.

You have already posted 255 posts and you still can't figure out that you have to try in order to walk, even a baby understands that. -_-!

 

Here you have two tutorials:

https://www.tutorialspoint.com/lua/if_else_statement_in_lua.htm

 

Link to comment

I mean, I thought I was pretty clear when I said ''here's my code'' and ''i added your line to it''. Even a baby can understand that my final code looks like the code I originally sent, plus the line you gave me. I also already said that it didn't work, hence my request for further help. So if you want to help me, then help me, appreciate it, but don't act like a :O.

function katana(attacker, weapon, bodypart, loss)
	if getElementType(thePlayer) == "player" then
		if getTeamName(getPlayerTeam(attacker)) == "Infected" then
			if getPedWeapon(attacker) == 8 then
				setElementHealth(source, getElementHealth(source) - 40 )
			end
		end
	end
end
addEventHandler("onPlayerDamage", root, katana)	
	

 

Edited by marty000123
Link to comment
  • Moderators

I appreciate it, if you take me seriously. If you don't show some me motivation(for example by not showing what you tried), then please don't be so surprised.

If you think that I get paid to help you, then you are slightly mistaken. I am helping you because I like to help people who want to learn.

 

 


 

thePlayer, does not exist in this code. It is fiction.

It is not here:

And not here:

https://wiki.multitheftauto.com/wiki/OnPlayerDamage

 

But there is attacker which you can use over thePlayer. Which is actually a parameter of this event and sample.

 


I recommend you to write it like this:

if attacker and getElementType(attacker) == "player" then

First it will check if the attacker variable has a value which is not nil/false and then it checks if the attacker is a player.

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...