Jump to content

Yazir

Members
  • Posts

    101
  • Joined

  • Last visited

Everything posted by Yazir

  1. Solved: I've replaced scoreboard with a fresh one - I didn't even look into the scoreboard but it worked . . .
  2. Yazir

    why

    It is serverside script, yes? if getTeamName(team) == "Survivors" then blips[vehicles] = createBlipAttachedTo(vehicle, 51, nil,nil,nil,nil,nil,nil,nil,getPlayersInTeam("Survivors")) return end Replace line 3.
  3. Hello! I have a problem with Scoreboard resource. It has been working but the next day I've check it just broke and I don't know why. There's the code (it's clientside). I've removed most of the scoreboard coluns for the sake of testing but it won't work anyway. There's no errors in debug. local players = getElementsByType( "player" ) function setScoreboard( ) call ( getResourceFromName( "scoreboard" ), "scoreboardResetColumns") call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "test", 70, "tetsefeas") --call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "murders", 70, "Player kills", 12) --call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "zombieskilled", 70, "Zombie kills",13) --call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "headshots", 70, "Headshots",15) --call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "daysalive", 70, "Days Alive",16) --call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "totalkills", 70, "Total Frags",14) --call ( getResourceFromName( "scoreboard"), "scoreboardSetColumnPriority", "name", 11) for theKey,thePlayer in ipairs(players) do setElementData( thePlayer, "test", 20 ) end end addEventHandler( "onClientResourceStart", getRootElement( ), setScoreboard ) Here is how it looks in game.
  4. @LoPollo There are no errors, everything in the script is fired. I think I need to start a new topic about that issue.
  5. It's clientside script so the syntax is bool scoreboardAddColumn ( string name, [ int width = 70, string friendlyName = name, int priority = slot after "name" column, function textFunction = nil ] ) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "test", 70, "tetsefeas",17) name, width, friendlyname and priority.
  6. @LoPollo this is other question that you might know the answer. Instead of spamming I'll write it here. Why when I set scoreboard to this local players = getElementsByType( "player" ) function setScoreboard( ) call ( getResourceFromName( "scoreboard" ), "scoreboardResetColumns") call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "test", 70, "tetsefeas",17) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "murders", 70, "Player kills", 12) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "zombieskilled", 70, "Zombie kills",13) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "headshots", 70, "Headshots",15) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "daysalive", 70, "Days Alive",16) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "totalkills", 70, "Total Frags",14) call ( getResourceFromName( "scoreboard"), "scoreboardSetColumnPriority", "name", 11) for theKey,thePlayer in ipairs(players) do setElementData( thePlayer, "test", 20 ) outputChatBox( "3") end end addEventHandler( "onClientResourceStart", getRootElement( ), setScoreboard ) It shows me this in game: It worked before. The next day it went to this. @edit Oh I know what I'm doing wrong here. Let me check if it is the reason. @edit2 It won't work but I've updated the code anyway.
  7. I mean when I stop the server the resource is on. Just don't mind. I'll check it myself
  8. Will event "onPlayerQuit" be activated when server gets shut down (not when it crashes, of course it won't then). That's the third time I ask this question and I'll probably check it myself.
  9. Maybe I didn't make it clear. When there are players on the server and I type shutdown in the console. Will onPlayerQuit still get triggered?
  10. I've tried using accounts but client can't read it (i guess that's good) so I think I'll have to load it when player connects and save when he disconnects. If server is shutdown, does "onPlayerQuit" fire for every player on the server? Or I could save it when the money changes.
  11. I know what is the reason. I thought the ElementData stays on players even when they disconnect. It doesn't so I have another question. How can i save that data so it could be retrieved when the player connects? If you have any quick answers, please do. In the meantime I'll be looking around in some already done resources to see how it has been made. To answer your @LoPollo though: 1. Yes 2. Yes. 3. Yes, fragments. 4. There have been errors that this value is a boolean, but it is known why now.
  12. I've already said i use getElementData and setElementData but it won't work @NeverUnbeatable I forgot to mention - init resource is server side while the second part of the code is client side.
  13. I don't really understand how that would change anything. And that misses the point of my question here. Element Data won't work and I don't know why.
  14. I need to check because i don't want the money to be reset. This value is already set but client doesn't see it.
  15. Hello! I have a problem. I can't get getElementData() to work locally. It is initiated by server and synced. -- here's the initiation if getElementData(player,"money") == false then setElementData(player,"money",100) end -- that's code from another resource local money = getElementData( localPlayer, "money") outputChatBox( tostring(money) ) -- return: false And as I said there. I set it at one resource then i want to retrieve it at other. Maybe it's the problem? Yes. I've read the wiki but there's not much on client usage.
  16. Hello! I have a problem. I wanted to ipair a table but it won't go through indexes. Made some debug outputs and these are the code and the result: buildingClasses = { ["Residential"] = { {"Soda Can (Mountain Dew)",2405,2,0,0.28}, {"Watch",2710,2,0,4.20}, {"Compass",1579,2,0,1.40}, {"Map",1277,3,0,0.84}, {"Double-barreled Shotgun",349,1,90,0.84}, {"test",349,1,90,0.84}, }, } outputChatBox(type(buildingClasses)) outputChatBox(table.getn(buildingClasses)) outputChatBox(#buildingClasses) outputChatBox(#buildingClasses["Residential"]) outputChatBox(#buildingClasses["Residential"][1]) --[[ Output: table 0 0 6 5 ]] Got the issue: I've used ipairs instead of pairs
  17. Yazir

    Closing a window

    Oh, I see my mistake. Gui instead of GUI... In moments like this I lose faith in myself. Thanks alot!
  18. Item functions should be handled by server.
  19. Hello! I'm getting a grip on Event system and I can't make "onClientGuiClick" work. I'd be very grateful if anyone could help me. addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), function() marketwindow = guiCreateWindow(428, 238, 1046, 562, "Overload Market", false) guiWindowSetSizable(marketwindow, false) guiSetAlpha(marketwindow, 0.85) listMarket = guiCreateGridList(538, 42, 492, 397, false, marketwindow) guiGridListAddColumn(listMarket, "Item", 0.3) guiGridListAddColumn(listMarket, "Owner", 0.3) guiGridListAddColumn(listMarket, "Cost", 0.3) listEq = guiCreateGridList(10, 42, 492, 397, false, marketwindow) guiGridListAddColumn(listEq, "Item", 0.9) placeItemButton = guiCreateButton(10, 504, 185, 48, "Place item on market", false, marketwindow) buyItemButton = guiCreateButton(845, 449, 185, 48, "Buy item from market", false, marketwindow) priceMemo = guiCreateMemo(75, 456, 120, 38, "", false, marketwindow) priteLabel = guiCreateLabel(10, 456, 185, 38, "Set price", false, marketwindow) guiSetFont(priteLabel, "default-bold-small") guiSetProperty(priteLabel, "Size", "w:0.176864 h:0.067616") guiLabelSetVerticalAlign(priteLabel, "center") closeButton = guiCreateButton(970, 524, 60, 28, "Close", false, marketwindow) --guiSetVisible( marketwindow, false ) showCursor( true, true ) addEventHandler ( "onClientGuiClick", closeButton, onClientGuiClickHandler) end) function toggleMarket() if guiGetVisible(marketwindow) == false then showCursor( true, true ) guiSetVisible( marketwindow, true ) else showCursor( false, false ) guiSetVisible( marketwindow, false ) end end addCommandHandler( "market", toggleMarket) function onClientGuiClickHandler( button ) outputChatBox( "hoi" ) -- this doesn't even run end
  20. It would be nice if i could switch between client and server syntax.
  21. Yazir

    Relative angles?

    If you would use it, you would know what i mean. vehicle velocity + int, doesn't work as planned.
  22. Copy that to server file and use some player trigger https://wiki.multitheftauto.com/wiki/Cl ... yer_events . You can also make clientside script to send a message that your character shoots, or even better, when he starts and stops shooting.
  23. Code will run slower and harder if loops will be longer?
×
×
  • Create New...