stefutz101 Posted August 12, 2015 Share Posted August 12, 2015 addEventHandler("onPlayerWasted",root,function(_,killer) local alivetime = getElementData(source,"alivetime") local name = getPlayerName(killer) if tonumber(alivetime)>3 then outputChatBox("Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!",root,255,0,0,true) end end) Error at local name = getPlayerName(killer) . Please help TY Link to comment
KariiiM Posted August 12, 2015 Share Posted August 12, 2015 It should works, and be sure you did the setElementData of alivetime addEventHandler("onPlayerWasted",root,function() local alivetime = getElementData(source,"alivetime") local name = getPlayerName(source) if tonumber(alivetime)>3 then outputChatBox("Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!",root,255,0,0,true) end end) Link to comment
stefutz101 Posted August 12, 2015 Author Share Posted August 12, 2015 Yes , it works but dont work correclty . I want to create this script to output in chatbox who make spawnkill . If someone kill me when i dont have 3 minutes nothing happen . If i use /kill will show " Player stefutz101 is suspect for spawnkill " Link to comment
Wumbaloo Posted August 12, 2015 Share Posted August 12, 2015 addEventHandler("onPlayerWasted",root,function(killer) local alivetime = getElementData(source,"alivetime") if tonumber(alivetime)>3 then outputChatBox("Playerul #ffffff"..getPlayerName(killer).."#ff0000 este suspectat de spawnkill!",root,255,0,0,true) end end) Should work Else check this out: OnPlayerWasted Link to comment
stefutz101 Posted August 12, 2015 Author Share Posted August 12, 2015 Attempting to concatenate a boolean value outputChatBox("Playerul #ffffff"..getPlayerName(killer).."#ff0000 este suspectat de spawnkill!",root,255,0,0,true) I already tested this version but i test again . Link to comment
t3wz Posted August 12, 2015 Share Posted August 12, 2015 you've to check if killer isn't false. addEventHandler( "onPlayerWasted", root, function( _, killer ) if killer and isElement ( killer ) and killer ~= source then local alivetime = getElementData( source, "alivetime" ) local name = getPlayerName( killer ) if tonumber( alivetime ) > 3 then outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) end end end ) Link to comment
Wumbaloo Posted August 12, 2015 Share Posted August 12, 2015 Because you don't die by a player Link to comment
stefutz101 Posted August 22, 2015 Author Share Posted August 22, 2015 addEventHandler( "onPlayerWasted", root, function( _, killer ) local name = getPlayerName( killer ) local alivetime = getElementData( playerSource, "alivetime" ) if tonumber(alivetime) == nil then outputChatBox( "Playerul #ffffff"..getPlayerName(killer).."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) elseif tonumber (alivetime) <= 3 then outputChatBox( "Playerul #ffffff"..getPlayerName(killer).."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) end end ) Attempting to compare number with boolean -- 7. What i must change ? I aleready try to put ..name.. Link to comment
stefutz101 Posted August 22, 2015 Author Share Posted August 22, 2015 Help , please ? Link to comment
Walid Posted August 22, 2015 Share Posted August 22, 2015 Help , please ? addEventHandler( "onPlayerWasted", root, function( _, killer ) if killer and getElementType(killer) == "player" and killer ~= source then local alivetime = getElementData( source, "alivetime" ) or 0 local name = getPlayerName( killer ) if tonumber( alivetime ) > 3 then outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) else outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) end end end ) Link to comment
stefutz101 Posted August 22, 2015 Author Share Posted August 22, 2015 Help , please ? addEventHandler( "onPlayerWasted", root, function( _, killer ) if killer and getElementType(killer) == "player" and killer ~= source then local alivetime = getElementData( source, "alivetime" ) or 0 local name = getPlayerName( killer ) if tonumber( alivetime ) > 3 then outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) else outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) end end end ) Noting happen , and btw : if tonumber( alivetime ) > 3 then outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) else outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) end thats wrong because if player have more than 3 minutes will show is spawnkill I can fix that but i dont under stand why dont enter in first if , i think it's wrong this script to get player name Link to comment
Walid Posted August 22, 2015 Share Posted August 22, 2015 i don't undrestand nothing explaine your problem better there is no timer in your code. also 3 minutes = 180000 milliseconds you can't use the number 3 show me the code where you stored the elementData "alivetime". Link to comment
stefutz101 Posted August 22, 2015 Author Share Posted August 22, 2015 Alivetime , is saved in MTA DayZ resources . First time i think too , but i made a command to see my alivetime and it work . I want to make a script what show a mesage on global chat ( x made spawnkill on y.) if y had under 3 minutes of life . Some players stay at spawn and kill players when they spawned. 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