Jump to content

How to make this script?


Recommended Posts

 

Hi guys. I have a doubt.

I want to make a script in which according to the "zombie kills" an image is created on the screen of that player.

Now, to get the account information I need to use "getAccountData" and "getPlayerAccount", but these functions are only "server side", while "dxDrawImage" is a client and I also have to use "onClientRender".

The question is .. How can I make this script?
Edited by NodZen_42
Link to comment
--SERVER-SIDE
function getAccount() 
    local acc = getAccountName(getPlayerAccount(source))
    triggerClientEvent(source, "sendAcc", source, acc) 
end 
addEvent("getAcc", true) 
addEventHandler("getAcc", root, getAccount) 


----------------------------------------------------------------------


--CLIENT-SIDE

triggerServerEvent("getAcc", localPlayer) 

addEvent("sendAcc", true);
addEventHandler("sendAcc", root,
function(acc)
	account = acc or "N/A"
end)

EDIT: Not tested

 

Edited by Tommy.
Link to comment
7 hours ago, NodZen_42 said:

 


Hi guys. I have a doubt.

I want to make a script in which according to the "zombie kills" an image is created on the screen of that player.

Now, to get the account information I need to use "getAccountData" and "getPlayerAccount", but these functions are only "server side", while "dxDrawImage" is a client and I also have to use "onClientRender".

The question is .. How can I make this script?

Make it so it gets saved on the element's data. (Show me your function on how the data is saved on players when they kill a zombie)
 

local screenW, screenH = guiGetScreenSize()

addEventHandler("onClientRender", root, function()
local zombieKills = tonumber(getElementData(localPlayer, "zombieKills")) or 'None'
dxDrawRectangle(screenW * 0.0454, screenH * 0.6263, screenW * 0.1691, screenH * 0.0404, tocolor(0, 0, 0, 155), false)
dxDrawText("Zombie Kills: ".. zombieKills .."", screenW * 0.0527, screenH * 0.6406, screenW * 0.2072, screenH * 0.6536, tocolor(255, 255, 255, 255), 1.20, "clear", "center", "center", false, false, false, false, false)
end)

 

Link to comment
2 hours ago, Infinity# said:

Make it so it gets saved on the element's data. (Show me your function on how the data is saved on players when they kill a zombie)
 


local screenW, screenH = guiGetScreenSize()

addEventHandler("onClientRender", root, function()
local zombieKills = tonumber(getElementData(localPlayer, "zombieKills")) or 'None'
dxDrawRectangle(screenW * 0.0454, screenH * 0.6263, screenW * 0.1691, screenH * 0.0404, tocolor(0, 0, 0, 155), false)
dxDrawText("Zombie Kills: ".. zombieKills .."", screenW * 0.0527, screenH * 0.6406, screenW * 0.2072, screenH * 0.6536, tocolor(255, 255, 255, 255), 1.20, "clear", "center", "center", false, false, false, false, false)
end)

 

Pm.

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