Jump to content

[HELP]Got killed by (name) - for race server and Achivements


Tr0JaNz0r

Recommended Posts

Posted

Hello everyone!,

First of all Happy new year :D

Okey, from 4 days ago i bought my new server and i was going to use it as a race server but i wanted to add some thing that are difficult and a (little bit) new but i had some problems while scripting it. well i was trying to make a script which gets the player name you got killed from or last damage i wanted to use it in my race server and to attach it between the killmessages on the left of the screen. but i didn't know which function or event i should i use, i searched the whole wiki upside down.. D:

Well, maybe some one could help me in that!

also i have problems in acvhivments i wanted to add it to my userpanel!

Hope you can help me in that!

Best wishes,

Tr0JaN

Posted

Umm thanks for that but maybe you didn't understand me well or maybe i didn't understand what do you mean lul.

but i On Client ped damage it does only works on body parts?, what i mean that i have a DD server and when he gets killed by someone show his name...

so it stands on (vehicles) now. i want something like get the last name hit your car. if you know what i mean? ;p

Posted

I understand your meaning, but i don't understand that.. usually examples helps me.. but i can't understand it..

maybe you can help me by creating a simple code? please :3

Posted

I do not believe code examples will help you with future learning of the events and/or functions.

Hows this:

This event will trigger when any element hits my car

By reading the event, i understand that the car that hit me (or the ped) is the First argument.

The source, is a car. The source however could be ANY CAR. you can check if this is your car by doing

if ( source == getPedOccupiedVehicle(localPlayer) ) Or when setting the event handler do

addEventHandler("onClientVehicleCollision", MyCar, function(carThatHitMe, so on and so forth)

Then you can find out who is in the car (If its a car that hit you) on the first argument sent to your handler function, by using

https://wiki.multitheftauto.com/wiki/GetVehicleOccupant

Posted

Works if anything hits your car. So the element can be a ped, but dont get confused here

If its a ped driving a car, and their car hits you, it will be their car. If its some angry ped with a golf club, its going to be the angry ped with a gold club

Posted

Okey sorry,

but i understand till when the vehicle get's damaged the part that i don't..

that how to get the play name who hit my car??

and i want to output his name when the car health is 0 :|

Posted
getPlayerName() 
  
getVehicleOccupant(VehicleThatHitYou) 

Make sure to check if the Element that hit you Is indeed a vehicle.

As for everything else, i can help you learn how, not do it for you.

Posted

What about this

function playerDamage_text ( attacker, driver ) --when a player is damaged 
    local driver = getVehicleOccupant ( source ) -- get the player sitting in seat 0 
    if ( attacker ) then 
        local tempString 
           if ( getElementType ( attacker ) == "vehicle" ) then 
    local tempString = getPlayerName ( getVehicleController ( attacker ) ).." killed "..getPlayerName ( source ).." 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 
addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) 
  

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