CallumD Posted November 8, 2009 Posted November 8, 2009 I made some random strip along the bottom of every players screen using a GUI Window. I know how to change the text when an event is triggered but I don't get how to output the players name. Say for example I wanted to make it say " has died!" how would I get ? Because GUI is client-side if I use getLocalPlayer it just say to each player their own nick. How would I get a certain players name then make it work on the client-side script?
MOH Posted November 9, 2009 Posted November 9, 2009 outputChatBox ( name.. " has a god damn " ..weapon, getRootElement(), 255, 100, 0 ) lolz
50p Posted November 9, 2009 Posted November 9, 2009 outputChatBox ( name.. " has a god damn " ..weapon, getRootElement(), 255, 100, 0 ) lolz I think you should learn how to help first. CallumD, show us your code. There are events that are triggered for every client (with source of remote player). You can use one of them or make your own and pass the remote player in triggerEvent or triggerClientEvent.
jkub Posted November 12, 2009 Posted November 12, 2009 I wrote this off top. In the meantime I guess you can try this. server script function randomFunctionName ( ammo, killer, weapon, bodypart ) triggerClientEvent ( "server_PlayerDied", killer, getPlayerName(killer), getPlayerName(source) ) end addEventHandler ( "onPlayerWasted", getRootElement(), randomFunctionName ) client script addEvent ( "server_PlayerDied", true ) local delay = 2500 addEventHandler ( "server_PlayerDied", getRootElement(), function ( killerName, victimName ) guiSetText ( whateverYourTextElementInYourGuiWindowIsCalled, tostring(victimName).. " has died!" ) setTimer ( guiSetText, delay, 1, whateverYourTextElementInYourGuiWindowIsCalled, "" ) end )
50p Posted November 12, 2009 Posted November 12, 2009 I wrote this off top. In the meantime I guess you can try this.server script function randomFunctionName ( ammo, killer, weapon, bodypart ) triggerClientEvent ( "server_PlayerDied", killer, getPlayerName(killer), getPlayerName(source) ) end addEventHandler ( "onPlayerWasted", getRootElement(), randomFunctionName ) client script addEvent ( "server_PlayerDied", true ) local delay = 2500 addEventHandler ( "server_PlayerDied", getRootElement(), function ( killerName, victimName ) guiSetText ( whateverYourTextElementInYourGuiWindowIsCalled, tostring(victimName).. " has died!" ) setTimer ( guiSetText, delay, 1, whateverYourTextElementInYourGuiWindowIsCalled, "" ) end ) Why did you use server-side event and triggerClientEvent when you have the same event client-side https://wiki.multitheftauto.com/wiki/OnC ... ayerWasted (read the description at the top)
CallumD Posted November 12, 2009 Author Posted November 12, 2009 Because client-side there is no syntax to get the player name (as far as I know of) and show it to all players without it just showing their own name.
50p Posted November 12, 2009 Posted November 12, 2009 Because client-side there is no syntax to get the player name (as far as I know of) and show it to all players without it just showing their own name. What getPlayerName function does? Hmm, I don't know, do you? And if you could read what I say you'd know what onClientPlayerWasted is.
subenji99 Posted November 12, 2009 Posted November 12, 2009 https://wiki.multitheftauto.com/wiki/Eve ... ent_source Read, and learn how events work. Especially the "source" hidden variable.
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