Jump to content

koi mujha script da ga


Recommended Posts

Client - side:

  
function punishPlayer(attacker) 
    if source ~= attacker then 
        cancelEvent() 
        triggerServerEvent("onPlayerPunished", root, attacker) 
    end 
end 
addEventHandler("onClientPlayerDamage", root, punishPlayer) 
  

Server - side:

  
function onPlayerPunished(player) 
    if getElementZoneName(player, true) ~= "Los Santos" then return end  
    kickPlayer(player, player, "Deathmatching is not allowed!") 
end 
addEvent("onPlayerPunished", true) 
addEventHandler("onPlayerPunished", root, onPlayerPunished) 
  

Edited by Guest
Link to comment
if getElementZoneName(player, true) ~= "Los Santos" then return end

kickPlayer(player, player, "Deathmatching is not allowed!")

ye parh kar mujhe lagta ha ka LS mein maar kar ho ga.

~= means not equal to. So the code does this:

if player ka zone ( cities enabled ) is not equal to "Los Santos" fir return kardo aur if ko end kardo.

Return makes it return false ( in-case-here ). So the function not goes ahead. Its aborted!

Link to comment

Your script will be using too much cpu since it's using root which is not needed even localPlayer will do that since the event will be heard in other all resources even if you don't have an event handler so it's better to use resourceRoot which will use less cpu.

  
function punishPlayer(attacker) 
    if source ~= attacker then 
        cancelEvent() 
        triggerServerEvent("onPlayerPunished", resourceRoot, attacker) -- just changing this 
    end 
end 
addEventHandler("onClientPlayerDamage", root, punishPlayer) 
  

P.S phool gaya ke ye urdu section hain.. Anyway meine tumhara topic dhek liya tha liken mujhe pata nahi tha ke tum zone ke bare mein baat ker rahay thay. ;)

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