Jump to content

Why not work?


Tomek123

Recommended Posts

Posted

Hi all :D

This script no work i die all time :o

safecol = createColCuboid ( 100.16635131836, 1820.5823974609, 17.289850234985, 200, 150, 100 ) 
safeZoneRadar = createRadarArea ( 100.16635131836,1820.5823974609, 200, 150, 0, 255, 0, 120 ) 
  
  
function enterZone(hitPlayer,thePlayer) 
local acl = getElementModel (hitPlayer) 
      if ( acl == GANG ) then 
    toggleControl (hitPlayer, "fire", false ) 
    toggleControl (hitPlayer, "aim_weapon", false) 
    toggleControl (hitPlayer, "vehicle_fire", false) 
    outputChatBox("Welcome, in moderator zone!", hitPlayer, 0, 255, 0) 
       else 
         killPed (hitPlayer) 
end 
end 
addEventHandler( "onColShapeHit", safecol, enterZone ) 
  
function leaveZone(hitPlayer,thePlayer) 
local skin = getElementModel (hitPlayer) 
    toggleControl (hitPlayer, "fire", true) 
    toggleControl (hitPlayer, "aim_weapon", true) 
    toggleControl (hitPlayer, "vehicle_fire", true) 
    outputChatBox("* WARNING: You left moderator zone!", hitPlayer, 255, 0, 0) 
 if not ( acl == GANG )  then 
  killPed (hitPlayer) 
end 
end 
addEventHandler( "onColShapeLeave", safecol, leaveZone ) 

What is wrong i set my name in ACL on GANG and i die :cry:

  • Replies 104
  • Created
  • Last Reply

Top Posters In This Topic

Posted

WTF?! acl = getElementModel() lol?, i don't know what are you trying to do but this really fails.

If you want to check a acl then do this:

safecol = createColCuboid ( 100.16635131836, 1820.5823974609, 17.289850234985, 200, 150, 100 ) 
safeZoneRadar = createRadarArea ( 100.16635131836,1820.5823974609, 200, 150, 0, 255, 0, 120 ) 
  
  
function enterZone(hitPlayer,machingDimension) 
local accountname = getAccountName(getPlayerAccount(hitPlayer)) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) then 
    toggleControl (hitPlayer, "fire", false ) 
    toggleControl (hitPlayer, "aim_weapon", false) 
    toggleControl (hitPlayer, "vehicle_fire", false) 
    outputChatBox("Welcome, in moderator zone!", hitPlayer, 0, 255, 0) 
    else 
     killPed (hitPlayer) 
end 
end 
addEventHandler( "onColShapeHit", safecol, enterZone ) 
  
function leaveZone(hitPlayer,machingDimension) 
local accountname = getAccountName(getPlayerAccount(hitPlayer)) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) then 
    toggleControl (hitPlayer, "fire", true) 
    toggleControl (hitPlayer, "aim_weapon", true) 
    toggleControl (hitPlayer, "vehicle_fire", true) 
    outputChatBox("* WARNING: You left moderator zone!", hitPlayer, 255, 0, 0) 
   else 
   killPed (hitPlayer) 
end 
end 
addEventHandler( "onColShapeLeave", safecol, leaveZone ) 

try it.

P.S: wrong section.

Posted

Why this script not work?

addEventHandler("onResourceStart", resourceRoot, 
    function() 
        for i,player in ipairs(getElementsByType("player")) do 
            spawn(player) 
        end 
    end 
) 
  
function spawn(player) 
    if not isElement(player) then return end 
    repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(0,0) ) 
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
end 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        spawn(source) 
    end 
) 
  
addEventHandler("onPlayerWasted", root, 
    function() 
        setTimer(spawn, 1800, 1, source) 
                repeat until spawnPlayer ( player, 1611+math.random(0,1),1822+math.random(0,1), 10.6, 90, math.random(0,0) ) 
    end 
) 

Posted
addEventHandler("onPlayerWasted", getRootElement(), spawnToHospital) 
function spawnToHospital() 
    local x,y,z = 1000, 1000, 0 -- enter hospital co-ordinates here 
    spawnPlayer(source, x, y, z) 
end 

Try this.

Posted

Try this.

again, spawnToHospital is nil when you're calling event handler.

it's the same as defining x,y,z AFTER spawnPlayer(source, x, y, z).

  
function spawnToHospital() 
    local x,y,z = 1000, 1000, 0 -- enter hospital co-ordinates here 
    spawnPlayer(source, x, y, z) 
end 
addEventHandler("onPlayerWasted", getRootElement(), spawnToHospital) 
  
-- or 
  
addEventHandler("onPlayerWasted", getRootElement(), function() 
    local x,y,z = 1000, 1000, 0 -- enter hospital co-ordinates here 
    spawnPlayer(source, x, y, z) 
end) 
  

Posted (edited)

OMG i try make skin saver and don't work again ! :cry:

What is wrong :cry:

function onPlayerQuit ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            clothes = getPedClothes(source,"PlayerClothes") 
            setAccountData ( playeraccount, "play.clothes", playerclothes ) 
      end 
end 
  
function onPlayerJoin ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            local playerclothes = getAccountData ( playeraccount, "play.clothes" ) 
            if ( playerclothes ) then 
            setPedClothes ( source, "PlayerClothes", clothes ) 
            end 
      end 
end 
  
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoin ) 

Edited by Guest
Posted

This is for client.this script must show on scoreboard money stats.

Somthing is wrong but i don' know what :\

local root = getRootElement() 
local player = getLocalPlayer() 
local counter = 0 
local starttick 
local currenttick 
addEventHandler("onClientRender",root, 
    function() 
        if not starttick then 
            starttick = getTickCount() 
        end 
        counter = counter + 1 
        currenttick = getTickCount() 
        if currenttick - starttick >= 1000 then 
            setElementData(player,"money",counter) 
            counter = 0 
            starttick = false 
        end 
    end 
) 

Posted

Why do you have the variable counter in there? And why are you using it as your money :P

local starttick, currenttick 
local player = getLocalPlayer() 
addEventHandler("onClientRender",getRootElement(), 
    function() 
        if not starttick then 
            starttick = getTickCount() 
        end 
        currenttick = getTickCount() 
        if currenttick - starttick >= 1000 then 
            setElementData(player,"money",getPlayerMoney( player ) ) 
            starttick =  getTickCount() 
        end 
    end 
) 

Btw, it would be easier to use a serverside timer for this, there's no need to do it clientside in onClientRender

function updateMoney() 
    for k, v in ipairs(getElementsByType('player')) do 
        local money = getPlayerMoney(v) 
        setElementData(v,"money",money ) 
    end 
end 
setTimer(updateMoney, 1000, 0) 

Posted
myMarker = createMarker() 
  
function onHit(hitPlayer, matchingDimension) 
setElementPosition(hitPlayer,0,0,1000) 
end 
addEventHandler("onMarkerHit",myMarker,onHit) 

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