Fury Posted August 25, 2012 Share Posted August 25, 2012 client: local vehModel = nil local screen_x, screen_y = guiGetScreenSize() local font = "bankgothic" local scale = screen_x / 1000 local message = "" local messWidth = 1 local messHeight = 1 addEventHandler("onClientVehicleCollision", root, function(collider) if collider then if getElementType(collider)=="vehicle" and getElementHealth(source)>250 and isElementInWater(source)==false then triggerServerEvent("vehicleCollision", source, collider) end end end ) addEvent("showDeathMess", true) addEventHandler("showDeathMess", getRootElement(), function(theKiller) if(source ~= getLocalPlayer())then return end addEventHandler("onClientRender", getRootElement(), kill) message = "Killed by: "..theKiller messWidth = dxGetTextWidth(message, scale, font) messHeight = dxGetFontHeight(scale, font) setTimer(function() removeEventHandler("onClientRender", getRootElement(), kill) end, 5000, 1) end) function kill() dxDrawText(message, screen_x/2 - messWidth/2, screen_y/2 - messHeight/2, screen_x, screen_y, tocolor(255, 0, 0, 150), scale, font) end server: function collider ( collider ) outputChatBox ( "Killer: " .. collider, source ) local acc = getPlayerAccount( collider ) local kills = getAccountData( acc,"kills" ) or 0 setAccountData( acc,"kills", kills+1) triggerClientEvent("showDeathMess", source, collider) end addEvent( "vehicleCollision", true ) addEventHandler( "vehicleCollision", getRootElement(), collider ) function wasted() local acc = getPlayerAccount( source ) local deaths = getAccountData( acc,"deaths" ) or 0 setAccountData( acc,"deaths", deaths+1) end addEventHandler( "onPlayerWasted", getRootElement(), wasted ) what i am doing wrong? Link to comment
CheiN Posted August 25, 2012 Share Posted August 25, 2012 getAcc data is when player exit setAcc data is when player login Link to comment
Fury Posted August 25, 2012 Author Share Posted August 25, 2012 getAcc data is when player exit setAcc data is when player login well i havent problem on account things for now. i cant define the "killer" Link to comment
Castillo Posted August 25, 2012 Share Posted August 25, 2012 @Vendetta: What is the problem exactly? does it output any debugscript error? @SunLight: What you just said makes no sense. Link to comment
CheiN Posted August 25, 2012 Share Posted August 25, 2012 read onPlayerWasted on wiki here u can see how to define it Link to comment
Fury Posted August 25, 2012 Author Share Posted August 25, 2012 @Vendetta: What is the problem exactly? does it output any debugscript error? when i hit some car its output: read onPlayerWasted on wiki here u can see how to define it i wanna define the "killer" not the "killed" Link to comment
Castillo Posted August 25, 2012 Share Posted August 25, 2012 That's because is a element, you should use: tostring ( ): outputChatBox ( "Killer: ".. tostring ( collider ), source ) Link to comment
Fury Posted August 25, 2012 Author Share Posted August 25, 2012 That's because is a element, you should use: tostring ( ): outputChatBox ( "Killer: ".. tostring ( collider ), source ) its dont output chat anything. also dont show the killer on screen Link to comment
Anderl Posted August 25, 2012 Share Posted August 25, 2012 That's because is a element, you should use: tostring ( ): outputChatBox ( "Killer: ".. tostring ( collider ), source ) Output an element in Chat Box? If it's a player element you should use getPlayerName, not tostring. Link to comment
Castillo Posted August 25, 2012 Share Posted August 25, 2012 I don't know, that's what he had, so I though he was checking if it's sending a "killer" at all. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now