Jump to content

Norhy

Members
  • Posts

    125
  • Joined

  • Last visited

Everything posted by Norhy

  1. Norhy

    first person

    hey guys i have this fp script player = getLocalPlayer() function findRot(x1, y1, x2, y2) local t = -math.deg(math.atan2(x2 - x1, y2 - y1)) return t < 0 and t + 360 or t end addEventHandler("onClientRender", getRootElement(), function() local x, y, z = getPedBonePosition(player, 6) setCameraMatrix(x, y, z) end ) addEventHandler("onClientCursorMove", getRootElement(), function(_, _, _, _, wX, wY, wZ) local x, y, z = getPedBonePosition(player, 6) setPedRotation(player, findRot(x, y, wX, wY)) end ) the problem is, when i move the mouse my rotation is reset . how do i fix it?
  2. Norhy

    key hold

    hey. How do i check if a player is holding a key?
  3. Norhy

    login help

    hey. I am making a login panel and i use the server event onPlayerJoin to display the login panel, however, the panel displays only when the player has the download finished. That means when a player joins for the first time the panel won't show because he is downloading the data, but when he join second time the panel show. How to i fix it?
  4. Please, how do I create a right-click menu like the one in the resource gui editor?
  5. Norhy

    Money

    Please, what's wrong in this code? if (getPlayerMoney(player) > 2500) then -- and then setPlayerMoney(player, getPlayerMoney(player) - 2500 ) It is Client-side.
  6. Norhy

    Login Handler

    triggerServerEvent('submitLogin',localPlayer,username,password)
  7. Norhy

    Login Handler

    addEvent( "submitLogin", true) function loginHandler(username,password) local account = getAccount ( username, password ) if ( account ~= false ) then logIn(source, account, password) triggerClientEvent(source,"HideGui",source) else outputChatBox("Zle zadane Meno alebo Heslo, skus znova prosim.",source) end end addEventHandler("submitLogin",root,loginHandler) And then i have the registerHandler, but that is working fine, just need help with the login.
  8. Norhy

    Login Handler

    Both are defined, also, i tried that method before but it doesn't work.
  9. Norhy

    Login Handler

    Hello guys. I'm making a Login panel, but somehow i cannot log-in. I tried using an another panel and it worked with the same code. local account = getAccount ( username, password ) if ( account ~= false ) then Error: bad argument at getAccount expected string at argument 1, got boolean. I don't see any mistake there, do you?
  10. function deathMoney ( player ) if (getPlayerCount < 2) then outputChatBox ( "Na serveri nie je dostatok (2) hráčov aby si získal odmenu!", getRootElement(), 0, 255, 0, true ) else local reward = math.random(2000, 3000) givePlayerMoney ( source, reward ) outputChatBox ( "Zdochol si! Tvoja odmena za túto mapu je " .. reward .. "$!", getRootElement(), 0, 255, 0, true ) end end addEventHandler ( "onPlayerWasted", getRootElement(), deathMoney ) Tried this, doesn't work.
  11. function deathMoney ( player ) local reward = math.random(2000, 3000) givePlayerMoney ( source, reward ) outputChatBox ( "Zdochol si! Tvoja odmena za túto mapu je " .. reward .. "$!", getRootElement(), 0, 255, 0, true ) end addEventHandler ( "onPlayerWasted", getRootElement(), deathMoney ) This is my code which will give a player between 2k and 3k$. The problem is that the player gets it everytime. I want to make it possible only when there are atleast 2 players online, but don't know how. Any functions?
  12. WARNING: Bad Argument @ 'triggerClientEvent' [Expected element at argument 3, got none ]. I think that it was not needed to remove the argument, however your and mine codes, both don't work
  13. This is my server-side: function showMenu ( ) triggerClientEvent ( source, "ShowAmmu", source ) end addEventHandler ( "onMarkerHit", ammuSell, showMenu, false )
  14. wdwMenu = guiCreateWindow( 0.150, 0.150, 0.70, 0.70, "Ammunation", true ) guiSetVisible ( wdwMenu, false ) showCursor ( false ) function ShowTheMenu ( ) guiSetVisible ( wdwMenu, true ) showCursor ( true ) end addEvent ( "ShowAmmu", true ) addEventHandler ( "ShowAmmu", getRootElement (), ShowTheMenu ) When i enter the menu marker, nothing happens. I had a error but fixed it, still nothing happens. No errors and warnings, something's wrong?
  15. Norhy

    Scoreboard

    So, i've created a scoreboard collum, "deaths". Now if a player dies, he gets +1 death. However the deaths don't show in the collum / scoreboard. Code: addEventHandler("onClientRender",getRootElement(), function() if not starttick then starttick = getTickCount() end currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"deaths", getElementData ( source, "deaths" ) ) starttick = getTickCount() end end ) function updateDeaths() for k, v in ipairs(getElementsByType('player')) do local deaths = tonumber ( getElementData ( v, "deaths" ) ) setElementData(v,"Deaths",deaths ) end end setTimer(updateDeaths, 1000000, 0) Full code: local starttick, currenttick local player = getLocalPlayer() addEventHandler("onClientRender",getRootElement(), function() if not starttick then starttick = getTickCount() end currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"Money",getPlayerMoney( player ) ) starttick = getTickCount() end end ) function updateMoney() for k, v in ipairs(getElementsByType('player')) do local money = getPlayerMoney(v) setElementData(v,"Money",money ) end end setTimer(updateMoney, 1000000, 0) addEventHandler("onClientRender",getRootElement(), function() if not starttick then starttick = getTickCount() end currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"deaths", getElementData ( source, "deaths" ) ) starttick = getTickCount() end end ) function updateDeaths() for k, v in ipairs(getElementsByType('player')) do local deaths = tonumber ( getElementData ( v, "deaths" ) ) setElementData(v,"Deaths",deaths ) end end setTimer(updateDeaths, 1000000, 0) Death, reward code: function killDeaths ( ) local deaths = tonumber ( getElementData ( source, "deaths" ) ) or 0 setElementData ( source, "deaths", deaths + 1 ) end addEventHandler ( "onPlayerWasted", getRootElement (), killDeaths )
  16. Norhy

    Gang Wars

    Hey guys, i'm scripting a Gang Wars gamemode. I wanted to ask you, what you would like to see on a Gang Wars server. You may suggest, but please, not hard things since i'm a beginner..
  17. I've managed to do this. I just removed everything from the Multi Theft Auto folder, installed it again. After that i've joined the server where i played and i had 0 points. Of course i didn't wanted to make this, so i was angry like a pig and stopped playing that server, thought it was the server's mistake.
  18. Norhy

    WebFig pass

    Hi guys. I'm trying to port-forward, however webfig requieres a password. I don't know what password, i tried with no password but it didn't work. Any ideas?
  19. Hey guys. How to create a clickable image, a image on which you can click and something happens after it. Like the phone on SAUR, CIT..
  20. Norhy

    Sell Vehicle

    This code didn't work.
  21. Norhy

    Sell Vehicle

    Hey guys. I made an Sell Vehicle system using a Marker, however the script doesn't work. I don't get any errors / warnings. In my meta.xml the script is client type. What's wrong here? PS: The player should be able to sell a vehicle only every half hour, so it won't be abused.
  22. Norhy

    Scoreboard money

    Thank you very much. Now i can make several collums for other things, thank fo' your example!
  23. Norhy

    Scoreboard money

    I'll try to do that, thanks.
×
×
  • Create New...