Jump to content

clientside problem[SOLVED]


villr

Recommended Posts

code

function damageCheck(attacker, weapon) 
local playeraccount = getPlayerAccount ( source ) 
if ( playeraccount ) and not isGuestAccount(playeraccount) then 
if getAccountData ( playeraccount, "carshow" ) then 
    if(weapon == 5)then 
    local x, y, z = getElementPosition(getLocalPlayer()) 
    setElementPosition(getLocalPlayer(), x + 20, y + 50, z + 80) 
else 
  
end 
end 
end 
end 
addEventHandler( "onClientPlayerDamage", getLocalPlayer ( ), damageCheck ) 

problem client.lua attemp to call globar 'getPlayerAccount' (a nil value

somebody can help me :/

the script is when i hit with my basebool bat its only for the peoples with the accountdata 'carshow' that can use it,its for use at carshows like throw out,but i cant get it to work for only them :/

anybody out there that can help me?

Edited by Guest
Link to comment
    function damageCheck(attacker, weapon) 
    local playeraccount = getPlayerAccount ( source ) 
    if ( playeraccount ) and not isGuestAccount(playeraccount) then 
    if getAccountData ( playeraccount, "carshow" ) then 
        if(weapon == 5)then 
        local x, y, z = getElementPosition(source) 
        setElementPosition(source, x + 20, y + 50, z + 80) 
    else 
      
    end 
    end 
    end 
    end 
    addEventHandler( "onPlayerDamage", getRootElement(), damageCheck ) 

Just made your script server-side. I have no idea if it works as you intend it to.

Link to comment
    function damageCheck(attacker, weapon) 
    local playeraccount = getPlayerAccount ( source ) 
    if ( playeraccount ) and not isGuestAccount(playeraccount) then 
    if getAccountData ( playeraccount, "carshow" ) then 
        if(weapon == 5)then 
        local x, y, z = getElementPosition(source) 
        setElementPosition(source, x + 20, y + 50, z + 80) 
    else 
      
    end 
    end 
    end 
    end 
    addEventHandler( "onPlayerDamage", getRootElement(), damageCheck ) 

Just made your script server-side. I have no idea if it works as you intend it to.

dosent work :/

Link to comment
  
--client 
function damageCheck(attacker, weapon) 
local playeraccount = getPlayerAccount ( source ) 
    if ( getElementData(getLocalPlayer(),"carshow") == true ) then 
        if(weapon == 5)then 
            local x, y, z = getElementPosition(getLocalPlayer()) 
            setElementPosition(getLocalPlayer(), x + 20, y + 50, z + 80) 
        end 
    end 
end 
addEventHandler( "onClientPlayerDamage", getLocalPlayer ( ), damageCheck ) 
  

  
--server 
addEventHandler("onPlayerLogin",root, 
function() 
local playeraccount = getPlayerAccount ( source ) 
    if ( playeraccount ) and not isGuestAccount(playeraccount) then 
        if (  getAccountData ( playeraccount, "carshow" ) == true ) then 
        setElementData(source,"carshow",true) 
        end 
    end 
end 
) 
  

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