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

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

  • 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

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.

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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