Jump to content

New in script Please Help me :(


E-mail

Recommended Posts

Posted

Hi iam making a New anti!-Fist Form My Server :D

Please Fix it :D

outputChatBox("No-TbGes|x[Dev-PoinT]x",255,255,0) 
function stopMinigunDamage ( attacker, weapon, bodypart ) 
    if ( weapon == 0 ) then 
              outputChatBox("Dontkill with Fist!!",0,255,) 
        cancelEvent() 
    end 
end 
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage) 

:cry:

Posted (edited)
outputChatBox("No-TbGes|x[Dev-PoinT]x",255,255,0) 
function stopMinigunDamage( attacker, weapon, bodypart ) 
    if ( weapon == 0 ) then 
              outputChatBox("Dontkill with Fist!!",0,255,0) 
              cancelEvent() 
    end 
end 
addEventHandler ( "onClientPlayerDamage", root, stopMinigunDamage) 

Edited by Guest
  • MTA Team
Posted
code

That was useless, lol.

What doesn't work? Do /debugscript 3 and tell us your errors. Help us to help you!

meta.xml

  
<meta> 
     <script src="c.lua" type="client/> 
</meta> 
  

c.lua

outputChatBox("No-TbGes|x[Dev-PoinT]x",255,255,0) 
function stopMinigunDamage( attacker, weapon, bodypart ) 
   if source === getLocalPlayer() then return end 
    if ( weapon == 0 ) then 
              outputChatBox("Dontkill with Fist!!",0,255,0) 
              cancelEvent() 
    end 
end 
addEventHandler ( "onClientPlayerDamage", root, stopMinigunDamage) 

Posted

Useless??

I bet the problem was that he didn't see the message.

And that:

if source === getLocalPlayer() then return end 

I never used it, and my client events still worked.

Posted

Try:

Server side:

addEvent("sendMsgToAttacker", true) 
addEventHandler("sendMsgToAttacker", root, 
function() 
 outputChatBox("Dontkill with Fist!!",source,0,255,0) 
end) 

Client side:

outputChatBox("No-TbGes|x[Dev-PoinT]x",255,255,0) 
function stopMinigunDamage( attacker, weapon, bodypart ) 
    if ( weapon == 0 ) then 
              outputChatBox("Dontkill with Fist!!",0,255,0) 
              cancelEvent() 
              triggerServerEvent("sendMsgToAttacker", attacker) 
    end 
end 
addEventHandler ( "onClientPlayerDamage", root, stopMinigunDamage) 

Both players will see the message.

You can remove outputChatBox in the client side, so only the attacker see the message.

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...