Jump to content

WhoAmI

Members
  • Posts

    1,248
  • Joined

  • Last visited

Everything posted by WhoAmI

  1. I'm not at computer atm, but here is my old topic I go the same problem. viewtopic.php?f=91&t=72058&hilit=+sound that should help you
  2. WhoAmI

    Team Data?

    I'd do this with tables, which is in my opinion better way. With loops this code would have half of his current lines.
  3. Create blip server side. With sound is other story. You have to trigger for all players from server side event which is added client side, then it would be hearable for all players.
  4. As far as I can see, you want to call server function in client side. I'm afraid it's not possible. Use this function instead Pelo que eu vejo, você quer chamar uma função do lado server no lado client. Isso não é possível. Você deve usar esta função: triggerServerEvent
  5. WhoAmI

    The last reply

    I'd do this if I could.
  6. You have to get player serverside and trigger server event for everyone. It should look like -- server addCommandHandler ( "bark", function ( player ) triggerClientEvent ( "barkEvent", player ) end ) -- client function Bark () local x, y, z = getElementPosition(source) local int = getElementInterior(source) local dim = getElementDimension(source) local px, py, pz = getElementPosition(source) if (getDistanceBetweenPoints3D(x, y, z, px, py, pz)<50) then local sound = playSound3D("Barking.wav", x, y, z) setSoundMaxDistance(sound, 40) setElementDimension(sound, dim) setElementInterior(sound, int) attachElements ( sound, source ) if (isPedInVehicle(source)) then setSoundVolume(sound, 0.5) else setSoundVolume(sound, 1.0) end end end addEvent ( "barkEvent", true ) addEventHandler ( "barkEvent", root, Bark )
  7. Well, he can if he wants to. Just you have to open ports and in mtaserver.conf you have to put your IP address.
  8. outputChatBox("Żyjesz! Lecz masz tylko 1hp udaj się do szpitala po leki.") Jak widzisz, funkcja outputChatBox jest wykonywana TYLKO dla gracza lokalnego, czyli localPlayer. Na przykład ouputChatBox ( "wiadomość", 255, 255, 255, true ) Wyświetli wiadomość dla gracza, dla którego wykonywana jest funkcja, czyli gracza lokalnego. Zastosowanie w komendzie addCommandHandler ( "napisz", -- dodajemy komende function ( cmd ) ouputChatBox ( "WIadomość wyświetlona dla gracza, który użył komendy /napisz" ) -- outputujemy wiadomość end ) Funkcje używane w komendzie są wykonywane głównie dla jednego gracza, przeciwnie po stronie servera, gdzie koniecznością jest podanie gracza w argumencie funkcji outputChatBox.
  9. Wiadomości po stronie clienta są zawsze wysyłane dla jednego gracza i nie potrzebny elemnt jako argument funkcji outputChatBox
  10. Refreshing each second is pointless. Just refresh it when player joins, quits and when player is opening the window.
  11. local screenX, screenY = guiGetScreenSize ( ) local skinID = getElementModel ( localPlayer ) addEventHandler ( "onClientRender", root, function ( ) dxDrawImage ( screenX * 0.8505 , screenY * 0.0915, 104, 104, "img/" .. skinID .. ".png" ) end ) That works for sure, check if image is in meta.
  12. WhoAmI

    Team Data?

    Show us the code.
  13. You want to set player's nick colored his team's color on chat? If so function RGBToHex ( red, green, blue, alpha ) if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then return nil end if ( alpha ) then return string.format ( "#%.2X%.2X%.2X%.2X", red, green, blue, alpha ) else return string.format ( "#%.2X%.2X%.2X", red, green, blue ) end end addEventHandler ( "onPlayerChat", root, function ( message, messageType ) if ( messageType == 0 ) then cancelEvent ( ) local team = getPlayerTeam ( source ) if ( team ) then local r, g, b = getTeamColor ( team ) local hexCode = RGBToHex ( r, g, b ) local name = getPlayerName ( source ) outputChatBox ( hexCode .. name .. "#FFFFFF: " .. message, root, 255, 255, 255, true ) end end )
  14. Not sure if it works, but function onPlayerTargetA ( player ) if ( isPlayerInTeam ( source, "Police" ) ) then if ( isElement ( player ) and getElementType ( player ) == "player" ) then if ( not isPlayerInTeam ( player, "Police" ) ) then bindKey ( source, "N", "down", function() exports [ "TopBarChat" ] : sendClientMessage ( "You have given " .. getPlayerName ( player ) .. " a ticket , Wait for him to pay it", source, 255, 0, 0, true ) exports [ "TopBarChat" ] : sendClientMessage ( "You have gotten a ticket ! Press 'H' to pay it!", player, 255, 0, 0, true ) bindKey ( player, "H", "down", payTheTicket, source, player ) end ) end end end end addEventHandler ( "onPlayerTarget", root, onPlayerTargetA ) function payTheTicket ( _, _, _, theCop, thePlayer ) givePlayerMoney ( theCop, 200 ) takePlayerMoney ( thePlayer, 200 ) exports [ "TopBarChat" ] : sendClientMessage ( "The ticket has been paid by " .. getPlayerName ( thePlayer ), theCop, 255, 0, 0, true ) exports [ "TopBarChat" ] : sendClientMessage ( "You have paid the ticket to " .. getPlayerName ( theCop ), thePlayer, 255, 0, 0, true ) unbindKey ( thePlayer, "H", "down", paytTheTicket ) end
  15. Exactly. And delete 'thePlayer' from server side function's argument and in functions which are inside use 'source' instead.
  16. LUW - Lets Use Whitelist OPG
  17. I'll do it tomorrow morning if someone wouldn't be faster.
  18. Firstly, add this resource to acl as admin. Secondly, you are not triggering username and password when player clicks the login and register button.
  19. As far as I can see, you want to make this code when police aims at player, but this function is executing when the player is aiming at the cop and when he has 1 star of wanted level.
  20. Well, as I can see, source should be theCop and theCop should be source in onPlayerTargetA function. I'm not sure. Anyway fo you get any errors?
  21. WhoAmI

    Stop triggering

    Explain more. Tell us how it works and eventually put code.
  22. WhoAmI

    Stop triggering

    Just use removeEventHandler to stop onClientRender event.
×
×
  • Create New...