Jump to content

AMARANT

Members
  • Posts

    748
  • Joined

  • Last visited

Everything posted by AMARANT

  1. You know it's not very simple to read your code without lua tag.
  2. AMARANT

    Radar Area

    I dind't mean coleditor. I meant /showcol command in development mode. You have to create your colshape with some arithmetic calculations anyway. The more comfortable way is unknown. But if you want to check someone in this area whay don't you use "isInsideRadarArea" function?
  3. AMARANT

    Radar Area

    You can set showcol command via the console and that will be much more easer to create your colshape than via coleditor.
  4. Ясно, значит теперь буду спокойно спать)
  5. Кстати, Kernell, хотел спросить не сильно ли грузят сервак такие пробежки по аккаунтам всех игроков в поиске нужной "account data"?
  6. How is it possible to check if player is running? "getControlState" only checks if player pressed "sprint" button.
  7. Потому что это игра - классика. В ней есть своя специфическая атмосфера, большая свобода действий и очень много возможностей. Кому-то по душе "кульная графа", а кто-то ограничивается играми, которые в свое время сделали прорыв и люди до сих пор в них играют. Вспомните Варкрафт например. Конечно тут не обошлось без помощи мультиплееров - они очень удлиняют жизнь играм. Недостатки в стрельбе это просто мелочь, даже и не задумывался об этом, да и вообще при чем тут это, ГТА это ж не шутер какой-нибудь...
  8. Блин да накосячил я там сверху) Хотел просто пример дать для Astari, так сказать подтолкнуть чтоб дальше сам сделал как хотел, но "не получилось, не фартануло" А вообще когда-то давно сделал у себя на сервере это ограничение, но забыл в точности в примере указать. Вот если что, правда с серва выдрано: local chatRadius = 25.5 local megaphoneRadius = 100.0 function sendMessageToNearbyPlayers( message, messageType ) if messageType == 0 and not getElementData(source,"speaking") then if message==")" then local posX, posY, posZ = getElementPosition( source ) local chatSphere = createColSphere( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" ) destroyElement( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do outputChatBox( getPlayerName(source).." smiles", nearbyPlayer, 147, 112, 219 ) end else local posX, posY, posZ = getElementPosition( source ) local chatSphere = createColSphere( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" ) destroyElement( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do outputChatBox( getPlayerName(source)..": "..message, nearbyPlayer, 255, 255, 255 ) end end elseif messageType == 1 then local posX, posY, posZ = getElementPosition( source ) local chatSphere = createColSphere( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" ) destroyElement( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do outputChatBox( getPlayerName(source).." "..message, nearbyPlayer, 147, 112, 219 ) end end end addEventHandler( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers ) function blockChatMessage(message, messageType) cancelEvent() end addEventHandler( "onPlayerChat", getRootElement(), blockChatMessage )
  9. AMARANT

    Timer

    And please use lua-tag. It makes your code easer to understand.
  10. AMARANT

    Timer

    It should help: function ZombieDies(ammo,killer) if (killer) then local zombieKills = getElementData(killer,"Zabite Zombie") setElementData(killer,"Zabite Zombie",zombieKills+1) end end addEventHandler("onPedWasted", getRootElement(), ZombieDies)
  11. AMARANT

    Timer

    You chose a bad way to update the scoreboard. Instead of checking every player on the server every second you should make it like this: function ZombieDies(ammo,killer) local zombieKills = getElementData(killer,"Zabite Zombie") setElementData(killer,"Zabite Zombie",zombieKills+1) end addEventHandler("onPedWasted", getRootElement(), ZombieDies) -- I'm not sure how you made your zombies but I guess they're peds anyway...
  12. AMARANT

    Timer

    When you kill a zombie add to player's element data 1 kill. Just set it via "setElementData" function because scoreboard works only with element data. It's very easy.
  13. AMARANT

    Timer

    First thing you need to have dxscoreboard resource. Then you have to add somewhere in your script a function named "scoreboardAddColumn". Having passed required arguments through that function you can display your kills in scoreboard. But keep in mind that you have to set element data in order it to work.
  14. Пардон, я совсем забыл про это Спасибо _Dark_, исправил код вверху.
  15. Конечно, это очень просто: function sendMessage( message, messageType ) cancelEvent() local players = getAlivePlayers() for _,player in ipairs(players) do if getElementData(player,"yourelementdata") then outputChatBox(message,player) end end end addEventHandler( "onPlayerChat", getRootElement(), sendMessage ) function blockChatMessage(message, messageType) cancelEvent() end addEventHandler( "onPlayerChat", getRootElement(), blockChatMessage )
  16. That's client-side example. Here's server-side: function displayLoadedRes ( res ) if res==getThisResource() then -- Some stuff... end end addEventHandler ( "onResourceStart", getRootElement(), displayLoadedRes )
  17. You mean this? addEventHandler( "onClientResourceStart", getRootElement( ), function ( startedRes ) if startedRes==getThisResource() then -- Some stuff... end end )
  18. There's no event for your function. It should be like this: addEventHandler("onClientGUIClick",getRootElement(), function () local cash = guiGetText (worktxt) if (source == storebtn) then outputChatBox("should work...") triggerServerEvent ("withdraw", lp, cash) end if (source == withdrawbtn) then outputChatBox("should work...") triggerServerEvent ("deposit", lp, cash) end end)
  19. I'll explain it via comments: Server side: triggerClientEvent( "menuShow", getRootElement(), cash ) -- Instead of getRootElement() you should define your specific player if you want to show it to him. Root element will show you window to everyone. 'cash' is your money argument. It can be whatever you want. Client side: addEvent("menuShow", true ) function menuShow ( thePlayer, cash ) -- 'thePlayer' is unnecessary variable here. It should be just menuShow ( cash ). 2nd argument from server-side will be 'source' of your client-side function so it's not required here. Leave here just 'cash'. visableornot = guiGetVisible (bankwindow) if (visableornot == true) then guiSetVisible (bankwindow, false) showCursor (false) end if (visableornot == false) then guiSetText ( balancelbl, "Your Balance : $" .. cash ) guiSetVisible (bankwindow, true) showCursor (true) end end addEventHandler("menuShow", getRootElement(), menuShow) -- I use here getLocalPlayer() as a rule.
  20. You have to create a function server-side which receives arguments from client-side. In client-side function you have to pass required arguments. Something like this: triggerServerEvent ("withdraw", lp, cash) -- All needed arguments can be passed after lp (local player which will be 'source' of the server function. 'cash' might be your argument representing your money to be received from client.)
  21. Obviously your account data 'bankMoney" returns false. It means that there's no any data saved in your internal database. You should check that there's something in it or any script makes it set correctly.
  22. You might have had an empty account data "bankMoney". Check if it saved correctly in your internal.db or by debug messages: function storeMoney( thePlayer, command, cash) local account = getPlayerAccount ( thePlayer ) local bankMoney = getAccountData ( account, "bankcash" ) local store = bankMoney+tonumber(cash) -- Convert string to number here. It might cause an error too. outputChatBox("DEBUG: bankMoney is: "..tostring(bankMoney)) takePlayerMoney ( cash ) setAccountData ( account, "bankCash", store ) outputChatBox ( "You stored $" .. cash .. "in your bank!", thePlayer) end addCommandHandler ( "store" , storeMoney )
  23. I don't know try to write this line on your own.
×
×
  • Create New...