marty000123 Posted November 11, 2017 Share Posted November 11, 2017 (edited) ''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 November 11, 2017 by marty000123 Link to comment
Blast3r Posted November 11, 2017 Share Posted November 11, 2017 Seems like the hill enter is being triggered on the peds as well, try moving the element type check to before the getAccountName. Link to comment
Moderators IIYAMA Posted November 11, 2017 Moderators Share Posted November 11, 2017 function hill_Enter ( thePlayer, matchingDimension ) if getElementType(thePlayer) == "player" then -- check if the hit element is actually a player local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) As @Blast3r said. Link to comment
marty000123 Posted November 11, 2017 Author Share Posted November 11, 2017 (edited) 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 November 11, 2017 by marty000123 Link to comment
Moderators IIYAMA Posted November 12, 2017 Moderators Share Posted November 12, 2017 Getting team of nothing = warning What is <nothing>? And how to check that: https://stackoverflow.com/questions/9141217/empty-variable-check Link to comment
marty000123 Posted November 12, 2017 Author Share Posted November 12, 2017 It's obviously that the peds attack is also being registered and checked. But since it doesn't have a team, it :Os up. I have done the check that if the element is a player, this and that happens, but it didn't seem to work. Link to comment
Moderators IIYAMA Posted November 12, 2017 Moderators Share Posted November 12, 2017 Oke now look back at the code I posted, do you think you implement line 3 from my copy in your code? Link to comment
Moderators IIYAMA Posted November 12, 2017 Moderators Share Posted November 12, 2017 40 minutes ago, marty000123 said: Yup. Good, lets get started. Link to comment
marty000123 Posted November 14, 2017 Author Share Posted November 14, 2017 So ye can I get some additional help with this? Still haven't fixed it. The script doesn't work either. Link to comment
Moderators IIYAMA Posted November 14, 2017 Moderators Share Posted November 14, 2017 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
marty000123 Posted November 14, 2017 Author Share Posted November 14, 2017 (edited) 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 November 14, 2017 by marty000123 Link to comment
Moderators IIYAMA Posted November 14, 2017 Moderators Share Posted November 14, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now