Jump to content

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


Tr0JaNz0r

Recommended Posts

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

Link to comment

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

Link to comment

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

Link to comment

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 ) 
  

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