Jump to content

dxDrawImage for 1 player


Recommended Posts

Posted

how could i draw a dx image just for localPlayer?

i got some element data and i got couple of pictures and if player has like data 200 it should draw '1.png'

or if data is 400 it should draw image '2.png'

how could i draw image for just 1 player?so not everyone has same picture

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

what do i need triggerServerEvent for?

i can trigger events as much as i like but i dont know how to draw different image just for 1 PLAYER

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

omg im already using element data,and i know how to make image.............................................

i just dont know how to separate players so i could draw image just for 1 person

one player had element data 200 and i 400 and it drawn image for both of us instead of me

do you get it now,what im trying to do?

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted
triggerClientEvent 

Read the wiki, you will see a argument called "sendTo".

You are checking the player's data, so if you use getElementData by a player and it has 200, then put that player who has that value by 'sendTo'.

server

        elseif (tonumber(exp) >= 560001 and tonumber(exp) <=600000) then 
        setElementData(killer, "LV", 100) 
        triggerClientEvent("onLevelHundred",killer) -- killer is defined already so no worries about it 

client

function onLevelHundred() 
dxDrawImage ( screenWidth/3.25, screenHeight/1.045, 32, 32, '1.png', 0, -120 ) 
end 
addEvent("onLevelHundred",true) 
addEventHandler("onLevelHundred",localPlayer,onLevelHundred) 
  
function HandleTheRendering ( ) 
    addEventHandler("onClientRender", getRootElement(), onLevelHundred)  -- Keep everything visible with onClientRender. 
end 
addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) 

im using just 1 pic at the moment for LV(level) 100 but it draws image for anyone

im unsure how to trigger client event properly,its confusing me as i dont understand the examples out there

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

i put it like that and even players who dont have any data which im setting can see the image

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted
  
function funcc(ammo, killer, weapon, bodypart) 
    if (killer and getElementType(killer) == "player" and killer ~= source) then 
-- defining some things 
  
  
  
  
  
  
--getting lots of numbers and if its that number(e.g above 600k) then 
--it triggers client event for drawning image 
  

i doubt that u really need whole script for this

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

i really hope there is someone else who can help me,because noone answered in here yet except you

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

i re-edited this post so much,i will just reply if i find any problem because i think i know what i have been doing wrong

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

okay sry for 3rd post but i have been doing some things and i found where is the problem but i dont know how to fix it

function onLevelHundred() 
dxDrawImage ( screenWidth/3.25, screenHeight/1.045, 32, 32, '1.png', 0, -120 ) 
end 
addEvent("onLevelHundred",true) 
addEventHandler("onLevelHundred",localPlayer,onLevelHundred) 
  
function HandleTheRendering ( ) 
    addEventHandler("onClientRender", getRootElement(), onLevelHundred)  -- Keep everything visible with onClientRender. 
end 
addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) 

in second function handletherendering getRootElement() or resourceRoot or both cause the image to be visible to everyone,but i dont know how to fix this. i tried changing it to localPlayer but no success

anyone knows how to fix this?

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

Of course, how stupid that I didn't see that... Anyway, you start the function onLevelHundred when the resource gets started, this is for every client. You could check client-side which data the client has, to check or it needs to draw the picture or not. (Not sure or that will work) You can also send some stuff with the trigger to the client, like the data and then check which picture you have to draw with that data.

(Sorry if it didn't make sense, I'm extremely tired :P)

Posted

its not the problem about checking players data,i have a problem how can i draw it for just 1 player?

i can use my lines of code and check if player has wdiqwjeioqwjeqwoiqwej data but if it has,its still gonna draw picture for everyone lol

i just need help how to draw it for one player..(killer)

(i currently have only 1 picture but it still draws for everyone)

please help

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

serverside part where i trigger client event as u told me how to

        elseif (tonumber(exp) >= 560001 and tonumber(exp) <=600000) then 
        setElementData(killer, "LV", 100) 
        triggerClientEvent(killer,"onLevelHundred",killer) 

client

function onLevelHundred() 
dxDrawImage ( screenWidth/3.25, screenHeight/1.045, 32, 32, '1.png', 0, -120 ) --  
end 
addEvent("onLevelHundred",true) 
addEventHandler("onLevelHundred",localPlayer,onLevelHundred) 
  
function HandleTheRendering ( ) 
    addEventHandler("onClientRender", getRootElement(), onLevelHundred)  -- Keep everything visible with onClientRender. 
end 
addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) 

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

im sorry but i dont understand what you mean..

first event handler makes sure dx function text gets drawn in every frame but second event handler just starts the function to draw it

im really sorry could you show me how the code is suppost to look like?im still new at scripting

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

Rather confused as to what you want, but is it something like this you need?

function drawLevelHundredImage_Handler() 
    dxDrawImage(screenWidth/3.25, screenHeight/1.045, 32, 32, '1.png', 0, -120) 
end 
     
function onClientLevelHundred_Handler() 
    addEventHandler("onClientRender", getRootElement(), drawLevelHundredImage_Handler) -- Only start drawing when the event "onLevelHundred" is triggered. 
end 
addEvent("onLevelHundred", true) 
addEventHandler("onLevelHundred", root, onClientLevelHundred_Handler) 

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

@Dealman, no im just trying to draw it for each person differently(probs localPlayer)

@Et-win, sry but replace that line with what exactly?

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

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