Jump to content

Events/Functions.


CapY

Recommended Posts

It would be good to add things like :

onZoneEnter 

Required Arguments:

-Zonename

onZoneLeave 

Required Arguments:

-Zonename

isPlayerLogged 

Required Arguments:

-thePlayer

-bool

Example:

if isPlayerLogged(source,true) then 
--do something 
end 

onResourceRestart 

I'm not so good at explaining.

Waiting for your opinion. ;)

Link to comment

onZoneEnter may be applied to GTA SA built-in zones like Idlewood? Then, yeah, it would be good.

isPlayerLoggedIn can be done via scripting, here you have:

function isPlayerLoggedIn ( player ) 
    if getElementType ( player ) ~= "player" then return end 
    return not isGuestAccount ( getPlayerAccount ( player ) ) 
end 

Link to comment

all the events, and function except onResourceRestart, which can be made by making a custom command to restart resources, or by checking the time difference between onResourceStop and onResourceStart.

local oldZone = "" 
local oldCity = "" 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
function() 
    addEventHandler("onClientRender", getRootElement(), checkZone) 
end) 
  
function checkZone() 
    local posX, posY, posZ = getElementPosition(getLocalPlayer()) 
    local zone = getZoneName(posX, posY, posZ, false) 
    local city = getZoneName(posX, posY, posZ, true) 
    if(zone ~= oldZone)then 
        if(oldZone ~= "" and oldCity ~= "")then 
            triggerEvent("onZoneLeave", getLocalPlayer(), oldZone, oldCity) 
        end 
        oldZone = zone 
        oldCity = city 
        triggerEvent("onZoneEnter", getLocalPlayer(), zone, city) 
    end 
end 
  
function isPlayerLogged(player) 
    local account = getPlayerAccount(player) 
    if(account == false)then 
        return false 
    end 
    return (not isGuestAccount(account)) 
end 
  

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...