Jump to content

[HELP]Gata


Best-Killer

Recommended Posts

group_s.lua:430:bad argument @ 'getElmentData' [Expected element at argument 1, got string 'oussama']

code : Group_s.lua

function getPlayerGroup ( player )  
    local g = getElementData ( player, "Group" ) or "None" 
    if ( g:lower ( ) == "none" ) then 
        g = nil 
    end 
    return g 
end  
  
  
function refreshPlayerGroupPanel ( player ) 
    triggerClientEvent ( player, "SAEGGroups->pEvents:onPlayerRefreshPanel", player ) 
  
    -- memory sweep  
    player = nil 
end  

and that Gate Code :

function onBaseGateMarkerHit(hitPlayer) 
    if not hitPlayer then return end 
    if not gateMarkers[source] then return end 
    local account = getPlayerAccount(hitPlayer) 
    if not account or isGuestAccount(account) then return end 
    local playerAcc = getAccountName(account) 
    local gang = exports["SAEGGroups"]:getPlayerGroup(playerAcc) 
    if (gang == tostring(gateMarkers[source].clan)) then 
        if getElementData(source,"gateMoving") then return end 
        setElementData(source,"gateMoving",true) 
        moveObject(gateMarkers[source].gate, gateMarkers[source].speed, unpack(gateMarkers[source].moveTo)) 
        table.insert(playersInGate[source], hitPlayer) 
        --if not isTimer(gateTimers[source]) then 
            --gateTimers[source] = setTimer(checkGate,1000,0,source) 
            setTimer(moveObject,gateMarkers[source].moveBack or 3000,1,gateMarkers[source].gate,gateMarkers[source].speed,unpack(gateMarkers[source].gatePos)) 
            setTimer(setElementData,3000,1,source,"gateMoving",false) 
        --end 
    end 
end 

Link to comment

If this is line 430:

local g = getElementData ( player, "Group" ) or "None" 

Then the error occurs where you call this function:

function getPlayerGroup ( player ) 

To solve this, look for something like these:

getPlayerGroup("oussama") 
getPlayerGroup(getPlayerName(player)) 

This function expects a player element to be passed but instead you send a string of what looks like a player name. If you can't solve it yourself post the part where getPlayerGroup is called.

Link to comment
function onBaseGateMarkerHit(hitPlayer) 
    if not hitPlayer then return end 
    if not gateMarkers[source] then return end 
    local account = getPlayerAccount(hitPlayer) 
    if not account or isGuestAccount(account) then return end 
    local playerAcc = getAccountName(account) 
    [color=#FF0000]local gang = exports["SAEGGroups"]:getPlayerGroup(playerAcc)[/color] 
    if (gang == tostring(gateMarkers[source].clan)) then 
        if getElementData(source,"gateMoving") then return end 
        setElementData(source,"gateMoving",true) 
        moveObject(gateMarkers[source].gate, gateMarkers[source].speed, unpack(gateMarkers[source].moveTo)) 
        table.insert(playersInGate[source], hitPlayer) 
        --if not isTimer(gateTimers[source]) then 
            --gateTimers[source] = setTimer(checkGate,1000,0,source) 
            setTimer(moveObject,gateMarkers[source].moveBack or 3000,1,gateMarkers[source].gate,gateMarkers[source].speed,unpack(gateMarkers[source].gatePos)) 
            setTimer(setElementData,3000,1,source,"gateMoving",false) 
        --end 
    end 
end 

Link to comment

Alright, you're passing the account name as a string to the getPlayerGroup function which expects a player element, the player element should be in hitPlayer but we can't be 100% sure of that, so here's what you have to do:

Replace line 2 from this:

if not hitPlayer then return end 

to this:

if not hitPlayer or getElementType(hitPlayer) ~= "player" then return end 

This way it's 100% guaranteed that hitPlayer is a player element. Then change line 7 from this:

local gang = exports["SAEGGroups"]:getPlayerGroup(playerAcc) 

to this:

local gang = exports["SAEGGroups"]:getPlayerGroup(hitPlayer) 

Link to comment
Alright, you're passing the account name as a string to the getPlayerGroup function which expects a player element, the player element should be in hitPlayer but we can't be 100% sure of that, so here's what you have to do:

Replace line 2 from this:

if not hitPlayer then return end 

to this:

if not hitPlayer or getElementType(hitPlayer) ~= "player" then return end 

This way it's 100% guaranteed that hitPlayer is a player element. Then change line 7 from this:

local gang = exports["SAEGGroups"]:getPlayerGroup(playerAcc) 

to this:

local gang = exports["SAEGGroups"]:getPlayerGroup(hitPlayer) 

not work :/ 0 errors 0 warning but gate don't move

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