Jump to content

Two problems


Xeno

Recommended Posts

1. The safe area you guys made in the previous post just suddenly stopped working? Zombies can now walk through it?

local greenzone = createColRectangle ( 903, -1325, 150,100 ) 
local greenzonemaparea = createRadarArea (903,-1325, -150, -100, 0, 255, 0) 
  
function greenzoneEnter ( element, matchingDimension ) 
    local t = getElementType( element ) 
    if t == "player" then 
    
    elseif t == "ped" then 
        killPed ( element ) 
    end 
end 
addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) 
  
  
  
  
function greenzoneExit ( thePlayer, matchingDimension, player) 
if getElementType( thePlayer ) ~= "player" then return end 
  
        triggerClientEvent (player, "onMarkerHitText1", getRootElement()) 
end 
  
addEventHandler ( "onColShapeLeave", greenzone, greenzoneExit ) 
  

2. I made a script to count the number of zombies killed on the score board, and I dont knwo how to make it so it saves on logout/reconnect ect, could you help me please?

addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",root, 
function (killer) 
    givePlayerMoney(killer,100) 
    addPlayerZombieKills(killer) 
end) 
  
function addPlayerZombieKills(killer) 
    local account = getPlayerAccount(killer) 
    if isGuestAccount(account) then return end 
    local zombieKills = getAccountData(account,"Zombie kills") 
    if not zombieKills then setAccountData(account,"Zombie kills",0) end 
    setAccountData(account,"Zombie kills",tonumber(zombieKills)+1) 
end 
  
addEventHandler("onPlayerLogin",root, 
function () 
    local account = getPlayerAccount(source) 
    if isGuestAccount(account) then return end 
    local zombieKills = getAccountData(account,"Zombie kills") 
    if zombieKills then 
        setElementData(source,"Zombie kills",tostring(zombieKills)) 
    else 
        setElementData(source,"Zombie kills",0) 
    end 
end) 

- I promise, I will soon stop asking as frequently as I do! :D

Link to comment
1. The safe area you guys made in the previous post just suddenly stopped working? Zombies can now walk through it?
local greenzone = createColRectangle ( 903, -1325, 150,100 ) 
local greenzonemaparea = createRadarArea (903,-1325, -150, -100, 0, 255, 0) 
  
function greenzoneEnter ( element, matchingDimension ) 
    local t = getElementType( element ) 
    if t == "player" then 
    
    elseif t == "ped" then 
        killPed ( element ) 
    end 
end 
addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) 
  
  
  
  
function greenzoneExit ( thePlayer, matchingDimension, player) 
if getElementType( thePlayer ) ~= "player" then return end 
  
        triggerClientEvent (player, "onMarkerHitText1", getRootElement()) 
end 
  
addEventHandler ( "onColShapeLeave", greenzone, greenzoneExit ) 
  

2. I made a script to count the number of zombies killed on the score board, and I dont knwo how to make it so it saves on logout/reconnect ect, could you help me please?

addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",root, 
function (killer) 
    givePlayerMoney(killer,100) 
    addPlayerZombieKills(killer) 
end) 
  
function addPlayerZombieKills(killer) 
    local account = getPlayerAccount(killer) 
    if isGuestAccount(account) then return end 
    local zombieKills = getAccountData(account,"Zombie kills") 
    if not zombieKills then setAccountData(account,"Zombie kills",0) end 
    setAccountData(account,"Zombie kills",tonumber(zombieKills)+1) 
end 
  
addEventHandler("onPlayerLogin",root, 
function () 
    local account = getPlayerAccount(source) 
    if isGuestAccount(account) then return end 
    local zombieKills = getAccountData(account,"Zombie kills") 
    if zombieKills then 
        setElementData(source,"Zombie kills",tostring(zombieKills)) 
    else 
        setElementData(source,"Zombie kills",0) 
    end 
end) 

- I promise, I will soon stop asking as frequently as I do!

Question 1.

function greenzoneExit ( thePlayer, matchingDimension, player) 

Why do you use 'thePlayer' and 'player' as arguments?

Question 2.

function quitPlayer ( quitType ) 
--save data nao! 
-- kthxbai 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) 

https://wiki.multitheftauto.com/wiki/OnPlayerQuit

Link to comment

Question 1.

function greenzoneExit ( thePlayer, matchingDimension, player) 

Why do you use 'thePlayer' and 'player' as arguments?

Question 2.

function quitPlayer ( quitType ) 
--save data nao! 
-- kthxbai 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) 

https://wiki.multitheftauto.com/wiki/OnPlayerQuit

1. I dont know, ill fix it now.

2. I know how to do onPlayerQuit, its the saving bit I dont know how to do.

-PS, the zombie kill count now saves? I must of tested it wrong. But I still need help with the first question

-PS Never mind, i fixed both, thanks all!

Link to comment

Question 1.

function greenzoneExit ( thePlayer, matchingDimension, player) 

Why do you use 'thePlayer' and 'player' as arguments?

Question 2.

function quitPlayer ( quitType ) 
--save data nao! 
-- kthxbai 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) 

https://wiki.multitheftauto.com/wiki/OnPlayerQuit

1. I dont know, ill fix it now.

2. I know how to do onPlayerQuit, its the saving bit I dont know how to do.

-PS, the zombie kill count now saves? I must of tested it wrong. But I still need help with the first question

-PS Never mind, i fixed both, thanks all!

Try using the code, that you know works, from the previous topic. If it worked at some point, it still has to work :D

Look through your code. Must be something you have created AFTER adding the greenzone code thats causing a problem.

Link to comment

Question 1.

function greenzoneExit ( thePlayer, matchingDimension, player) 

Why do you use 'thePlayer' and 'player' as arguments?

Question 2.

function quitPlayer ( quitType ) 
--save data nao! 
-- kthxbai 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) 

https://wiki.multitheftauto.com/wiki/OnPlayerQuit

1. I dont know, ill fix it now.

2. I know how to do onPlayerQuit, its the saving bit I dont know how to do.

-PS, the zombie kill count now saves? I must of tested it wrong. But I still need help with the first question

-PS Never mind, i fixed both, thanks all!

Try using the code, that you know works, from the previous topic. If it worked at some point, it still has to work :D

Look through your code. Must be something you have created AFTER adding the greenzone code thats causing a problem.

I already fixed it, I didn't set the cood's correctly.

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