Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. function DestructionWin( ) local alivePlayers = getAlivePlayers( ) if #alivePlayers == 1 then local account = getPlayerAccount( alivePlayers[1] ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Wins",tostring( getAccountData( account,"Race Wins" ) or 0 ) +1 ) end local playername = getPlayerName( alivePlayers[1] ) outputChatBox ( "#FFA824The player " .. playername .. " won!", root, 255, 255, 255, true ) end end addEventHandler( "onPlayerWasted", root, function( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Loses",tostring( getAccountData( account,"Race Loses" ) or 0 )+1 ) end end ) function ratioCalculator( player ) local KDR_DECIMAL_PLACES = 2 local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local raceLoses = getAccountData( account,"Race Loses" ) if raceLoses == 0 then setAccountData( account, "Ratio", "-") else local kdr = round( getAccountData( account, "Race Wins" ) / raceLoses, KDR_DECIMAL_PLACES ) setAccountData( account, "Ratio", tostring(kdr)) end end end addEventHandler( "onPlayerQuit",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local timePlayed = getElementData( source, "Time played" ) if not timePlayed then setAccountData( account, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) setAccountData( account, "Time played", tostring( hours or 0 ) ..":".. tostring( mins or 0 ) ..":".. tostring( secs or 0 ) ) end end ) addEventHandler( "onPlayerLogin",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local raceWins = getAccountData( account,"Race Wins" ) or 0 local raceLoses = getAccountData( account,"Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 setElementData( source,"Race Wins",tostring( raceWins ) ) setElementData( source,"Race Loses",tostring( raceLoses ) ) setElementData( source,"Ratio",tostring( ratio ) ) end setTimer( function( player ) local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local timePlayed = getAccountData( account, "Time played" ) if not timePlayed then setElementData( player, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) local hours = tonumber( hours ) or 0 local mins = tonumber( mins ) or 0 local secs = tonumber( secs ) or 0 local newsec if hours and mins and secs then newsec = secs + 1 if ( newsec >= 60 ) then newsec = 0 mins = mins + 1 end if ( mins >= 60 ) then mins = 0 hours = hours + 1 end setElementData ( player, "Time played", tostring( hours ) ..":".. tostring( mins ) ..":".. tostring( newsec ) ) end end end ,1000,1, source ) end ) function publicstatsinfo( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local askdname = getPlayerName( source ) local wins = getAccountData( account, "Race Wins" ) local loses = getAccountData( account, "Race Loses" ) local ratio = getAccountData( account, "Ratio" ) local timePlayed = getAccountData( account, "Time played" ) if loses and wins then outputChatBox("#FFA824*" .. askdname .. " won " .. wins .. " times and he/she lost " .. loses .. " times, his/her ratio is " .. ratio .. " and the total time played he/she is: " ..tostring( timePlayed ), root, 255, 12, 15, true) else outputChatBox("*You don't losed or won" , root, 255, 12, 15, true) end end end addEvent( "stats", true ) addEventHandler( "stats", root, publicstatsinfo ) function checkCommand( message, messageType ) if messageType == 0 then if message == "!stats" then cancelEvent( ) setTimer( triggerEvent, 100, 1, "stats", source ) end end end addEventHandler( "onPlayerChat", root, checkCommand ) Try it. P.S update code
  2. try addEventHandler( "onResourceStart",resourceRoot, function( ) exports.scoreboard:addScoreboardColumn( "Race Loses" ) exports.scoreboard:addScoreboardColumn( "Race Wins" ) exports.scoreboard:addScoreboardColumn( "Ratio" ) exports.scoreboard:addScoreboardColumn( "Time played" ) -- add to scoreboard end ) function DestructionWin( ) local alivePlayers = getAlivePlayers( ) if #alivePlayers == 1 then local playername local account = getPlayerAccount( alivePlayers[1] ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Wins",tostring( getAccountData( account,"Race Wins" ) or 0 ) +1 ) end playername = getPlayerName( alivePlayers[1] ) outputChatBox ( "#FFA824The player " .. playername .. " won!", root, 255, 255, 255, true ) end end addEventHandler( "onPlayerWasted", root, function( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Loses",tostring( getAccountData( account,"Race Loses" ) or 0 )+1 ) end end ) function ratioCalculator( player ) local KDR_DECIMAL_PLACES = 2 local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local raceLoses = getAccountData( account,"Race Loses" ) if raceLoses == 0 then setAccountData( account, "Ratio", "-") else local kdr = round( getAccountData( account, "Race Wins" ) / raceLoses, KDR_DECIMAL_PLACES ) setAccountData( account, "Ratio", tostring(kdr)) end end end addEventHandler( "onPlayerLogin",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local raceWins = getAccountData( account,"Race Wins" ) or 0 local raceLoses = getAccountData( account,"Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 setElementData( account,"Race Wins",tostring( raceWins ) ) setElementData( account,"Race Loses",tostring( raceLoses ) ) setElementData( account,"Ratio",tostring( ratio ) ) end setTimer( function( player ) local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local timePlayed = getAccountData( account, "Time played" ) if not timePlayed then setElementData( player, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) local hours = tonumber( hours ) local mins = tonumber( mins ) local secs = tonumber( secs ) if hours and mins and secs then local newsec = secs + 1 if ( newsec >= 60 ) then newsec = 0 mins = mins + 1 end if ( mins >= 60 ) then mins = 0 hours = hours + 1 end setElementData ( player, "Time played", tostring( hours ) ..":".. tostring( mins ) ..":".. tostring( newsec ) ) end end end ,1000,1, source ) end ) function publicstatsinfo( ) local account = getPlayerAccount( source ) if isGuestAccount( account ) then return end local askdname = getPlayerName( source ) local wins = getAccountData( account, "Race Wins" ) local loses = getAccountData( account, "Race Loses" ) local ratio = getAccountData( account, "Ratio" ) local timePlayed = getAccountData( account, "Time played" ) if loses and wins then outputChatBox("#FFA824*" .. askdname .. " won " .. wins .. " times and he/she lost " .. loses .. " times, his/her ratio is " .. ratio .. " and the total time played he/she is: " ..tostring( timePlayed ), root, 255, 12, 15, true) else outputChatBox("*You don't losed or won" , root, 255, 12, 15, true) end end addEvent( "stats", true ) addEventHandler( "stats", root, publicstatsinfo ) function checkCommand( message, messageType ) if (messageType == 0) then if (message == "!stats") then cancelEvent() setTimer(triggerEvent, 100, 1, "stats", source) end end end addEventHandler( "onPlayerChat", root, checkCommand )
  3. Fro, Молодец! Хорошая работа
  4. Kenix

    i need help :'(

    This code is same you just create outside function and create a cursor ( and check window showing ). He can create it. P.S If you need show code you need use tabulation otherwise user can't understand your code.
  5. Kenix

    i need help :'(

    function welcomegui( ) GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(78,70,642,498,"",false) GUIEditor_Image[1] = guiCreateStaticImage(0.2555,0.0462,0.4782,0.2369,"images/KraZWorld.png",true,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(0.0187,0.2671,0.9626,0.253,"KraZ'World is a MTA:SA Roleplay server based on the real world. We aim to create a laidback server fun for everyone with tons of jobs and activites throughout. We noticed that most RPG server admins were being a bit rough on their players and not playing their role as admin. When we choose staff we only pick the people who are serious but also give chance. This roleplay server is owned by [staff]KraZ and no one else you can find the staff members and other information below.\n\nWebsite & Forums:: [url=http://www.KraZKraft.co.uk]http://www.KraZKraft.co.uk[/url]",true,GUIEditor_Window[1]) GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0187,0.5422,0.9626,0.4257,true,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Commands:",GUIEditor_TabPanel[1]) GUIEditor_Memo[2] = guiCreateMemo(0.0065,0.0372,0.9871,0.9415,"Commands are features you can access in-game to give to easier access to items/cars/objects.\nYou can also use commands for fun features which will be listed below. Commands can be used by going to your chatbox (T - Deafult) and typing the commands like so: (Say:/Commandname) then by pressing enter.\nCommands availible:\n/reconnect\n\n[More commands will be added soon]",true,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Rules:",GUIEditor_TabPanel[1]) GUIEditor_Memo[3] = guiCreateMemo(0.0065,0.0319,0.9871,0.9468,"Rules are Rules, All rules must be followed or you can face up to a month in ban or jail time. You can appeal permanent bans on the forums.\n\n1. - No Deathmatching (Deathmatching is allowed to a certain extent for example if you are a police officer going for somone wanted or if you'r a criminal and you want to go turf wars, We do allow some deathmatching but not always depends which staff member you get when the report is filed\nJail time for this offence: 800 minutes)\n\n2. - No Bug Abuse/Mods/Cheats (Using cheats or mods or abusing a bug are a serious offence on KraZ'World and you can get up to a month ban for using them, We do allow some mods like: e.g car mods, Skin mods, Jail time for this offence: MONTH BAN)\n\n3. - Listen To Staff Members (Staff members are located with the [staff] Tag, Listen to these people and do not ignore them, Jail time for this offence: 500 minutes)\n\n4. - Use /local chat before using Global, (Don't go abusing globalchat, use /local chat first\nJail time for this offence: 100 minutes)\n\n5. - Do not abuse the /support chat (/Support chat is only if you need support please no advertising or general conversation. Jail time for this offence: 200 minutes)\n\n6. - No Spamming Chat (Do not spam chat with the same sentance or advertising of anykind,\n Jail time for this offence: 300 minutes\n",true,GUIEditor_Tab[2]) GUIEditor_Tab[3] = guiCreateTab("Getting Started:",GUIEditor_TabPanel[1]) GUIEditor_Memo[4] = guiCreateMemo(0.0049,0.0213,0.9887,0.9574,"Okay, This tab is like a tutorial for new beginners, First off you'r going to want to get a job to earn some money, Do this by walking into a red marker, Pick a skin and accept the job, For this example i will post some jobs below,\n\nBus Driving - \nYou can get this job by going to unity station in Los Santos and picking the skin required for that job, Then you will need to get in a bus by entering a yellow marker and then drive to the bus stops, Simple.\n\nPolice/Medic - \nYou can get this job by going into the Red marker at a police station or hospital, pick the skin required get a car/ambulance then drive off and look for wanted players/low health players.\n\nPilot - \nGo to any airport except for the Abandoned one in Las Venturas, Go into the Red Marker and pick the skin required for the job, get in a plane by entering a yellow marker, and do your job as a pilot.\n\nJobs can be located by pressing F11 and looking for the job marker on the minimap (Jobs are Yellow blips on the minimap and the Large map)\n\n",true,GUIEditor_Tab[3]) GUIEditor_Tab[4] = guiCreateTab("Support:",GUIEditor_TabPanel[1]) GUIEditor_Memo[5] = guiCreateMemo(0.0049,0.0213,0.9903,0.9574,"If you need support its fairly simple just follow the instructions below:\n\nIf you need support fast, type this command into the chatbox - /Support yourmessagehere\n\nIf you need support but on something a staff member can help on go to the website and forums and post in the Support category of the forum.\n\nIf you need help on any other category ask some players of KraZ'World,",true,GUIEditor_Tab[4]) GUIEditor_Tab[5] = guiCreateTab("Staff Members:",GUIEditor_TabPanel[1]) GUIEditor_Memo[6] = guiCreateMemo(0.0049,0.016,0.9903,0.266,"There are 3 types of staff members: The following ranks and staff members are \nModerators, SuperModerators, Admins Below in the next box:",true,GUIEditor_Tab[5]) GUIEditor_Memo[7] = guiCreateMemo(0.0049,0.2819,0.9903,0.6755,"KraZ - [Admin] Dylan - [Admin] Taran - [Admin]\n\n\n",true,GUIEditor_Tab[5]) GUIEditor_Tab[6] = guiCreateTab("Donation Information:",GUIEditor_TabPanel[1]) GUIEditor_Memo[8] = guiCreateMemo(0.0049,0.0266,0.9903,0.9521,"Donating helps the server pay for fees and more, therfore you will recive more privlages than most players, you can donate by visiting the website and forums and clicking the donate button there.\n\n[NOTE]: To get the privlages you want you must donate over 7.50 British Pounds Sterlin.\n\nDonating helps us alot, feel free to help us out by donating after you have donating 7.50, If you donate over a certain ammount we will decide if you should be ranked as [staff]\n\n",true,GUIEditor_Tab[6]) guiSetVisible( GUIEditor_Window[1],false ) end bindKey( "F9","down", function( ) if guiGetVisible( GUIEditor_Window[1] ) then guiSetVisible( GUIEditor_Window[1],false ) else guiSetVisible( GUIEditor_Window[1],true ) end end ) welcomegui( ) https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI
  6. Kenix

    what is wrong?

    You mean it? Server local barrier = {} function isUser( source,name ) if isElement( source ) and type( name ) == "string" then local acc = getPlayerAccount( source ) if acc then if isObjectInACLGroup( "user."..getAccountName( acc ),aclGetGroup( name ) ) then return true end return false end return false end return false end function createBarrier ( thePlayer ) if isUser( thePlayer,"Admin" ) then -- check if player Admin for example local getTeam = getTeamFromName ("Army") if (getTeam) then local x, y, z = getElementPosition (thePlayer) barrier[thePlayer] = createObject (3578, x, y, z, 0, 0, 0) end end end addCommandHandler ("barrier", createBarrier) function removeBarrier ( thePlayer ) if isUser( thePlayer,"Admin" ) then -- check if player Admin for example if isElement( barrier[thePlayer ] ) then destroyElement( barrier[thePlayer ] ) barrier[ thePlayer ] = nil end end end addCommandHandler ("rbarrier", removeBarrier)
  7. He right tim260:You need read it https://wiki.multitheftauto.com/wiki/Scr ... troduction
  8. Ещё кстати есть идейка увеличение текста , а патом уменьшение ( пульсирование проще говоря ).
  9. This is example with client side. Server addEvent( "onMoneyChange",true ) addEventHandler( "onMoneyChange",root, function( oldMoney,newMoney ) -- .... end ) function _givePlayerMoney( ... ) local args = { ... } if isElement( args[1] ) and type( args[2] ) == "number" then if triggerEvent( "onMoneyChange",args[1],getPlayerMoney( args[1] ),args[2] ) and givePlayerMoney( ... ) then return true end return false end end
  10. Kenix

    Gate

    I rly not understand you
  11. Kenix

    Object Delete

    https://wiki.multitheftauto.com/wiki/RemoveWorldModel
  12. Search MTA_FOLDER\server\mods\deathmatch\acl.xml and find add this line <object name="resource.your_resource_name" /> example ... <group name="Admin"> <acl name="Moderator" /> <acl name="SuperModerator" /> <acl name="Admin" /> <object name="resource.admin" /> <object name="resource.your_resource_name" /> ... </group> ...
  13. Kenix

    What is wrong

    Try local gui = { } function build_Form( ) gui._placeHolders = { } local screenWidth, screenHeight = guiGetScreenSize( ) local windowWidth, windowHeight = 842, 498 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 showCursor( true ) gui["_root"] = guiCreateWindow( left, top, windowWidth, windowHeight, "Form", false ) guiWindowSetSizable( gui["_root"], false ) gui["tabWidget"] = guiCreateTabPanel( 0, 75, 821, 431, false, gui["_root"] ) gui["tab"] = guiCreateTab( "United States Department of Homeland Security ", gui["tabWidget"] ) gui["plainTextEdit"] = guiCreateMemo( 10, 10, 401, 361, [[The Department of homeland security was founded in this server by tim260. Its now lead by tim260 and is not active yet we are devloping it. ]], false, gui["tab"] ) guiMemoSetReadOnly( gui["plainTextEdit"], true ) gui["label_2"] = guiCreateLabel( 460, 90, 271, 221, "", false, gui["tab"] ) guiLabelSetHorizontalAlign( gui["label_2"], "left", false ) guiLabelSetVerticalAlign( gui["label_2"], "center" ) gui["tab_3"] = guiCreateTab( "Joining", gui["tabWidget"] ) gui._placeHolders["line"] = { left = 27, top = 180, width = 751, height = 20, parent = gui["tab_3"] } gui["tab_2"] = guiCreateTab( "Members", gui["tabWidget"] ) gui["label"] = guiCreateLabel( 290, 25, 411, 31, "Homeland security info panel", false, gui["_root"] ) guiLabelSetHorizontalAlign( gui["label"], "left", false ) guiLabelSetVerticalAlign( gui["label"], "center" ) return gui, windowWidth, windowHeight end addCommandHandler ( "homeland", build_Form ) function close( ) destroyElement( gui["_root"] ) gui["_root"] = nil showCursor( false ) end addCommandHandler ( "closehomeland", close )
  14. Kenix

    Table question

    Correct stopTable = { {1812.65198, -1889.86047, 13.41406}, {1825.22791, -1635.03711, 13.38281}, {1855.01685, -1430.47449, 13.39063}, {1732.81580, -1296.87122, 13.44294}, {1473.19226, -1295.77124, 13.48315}, {1443.60376, -1498.26660, 13.37650}, {1426.37280, -1716.12439, 13.38281}, {1315.06909, -1656.43799, 13.38281}, {1359.06250, -1432.39734, 13.38281}, {1169.82983, -1392.34473, 13.41728}, {930.76508, -1392.92627, 13.26561}, {815.24756, -1317.91345, 13.44460}, {585.04199, -1320.53748, 13.40609}, {526.99365, -1624.20361, 16.63225} } function stopMarkerHit( Element,dim ) -- code end function startBusMission( ) for i, _ in pairs( stopTable ) do local stopMarker = createMarker( unpack( stopTable[i] ) ) setElementData( stopMarker, "stopID", i, false ) addEventHandler( "onClientMarkerHit", stopMarker, stopMarkerHit ) end end
  15. Try Client function createGUI( ) showCursor( true ) setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316 ) toggleAllControls( true ) GUIEditor_Button = { } GUIEditor_Label = { } GUIEditor_Grid = { } rgbtn = guiCreateButton( 386,360,99,20,"Inregistreaza-te",false ) lgbtn = guiCreateButton( 494,360,99,20,"Logheaza-te",false ) un = guiCreateLabel( 375,294,88,21,"Username: ",false ) ps = guiCreateLabel( 377,322,88,21,"Password: ",false ) whatsnew = guiCreateLabel( 374,405,202,19,"Ce e nou?",false ) guiLabelSetHorizontalAlign( whatsnew,"center",false ) thenewstuff = guiCreateLabel( 384,434,191,18,"- Sistem de login/register terminat",false ) uned = guiCreateEdit( 443,294,103,20,"",false ) psed = guiCreateEdit( 443,321,103,20,"",false ) upstuff = guiCreateGridList( 0,0,1015,176,false ) guiGridListSetSelectionMode( upstuff,2 ) guiSetAlpha( upstuff,0.34999999403954 ) downstuff = guiCreateGridList( 0,592,1015,176,false ) guiGridListSetSelectionMode( downstuff,2 ) guiSetAlpha( downstuff,0.5 ) end -- Direct X Drawing addEventHandler( "onClientRender",root, function( ) dxDrawText( "RDK Freeroam",277.0,162.0,411.0,219.0,tocolor( 255,255,255,255 ),3.0,"diploma","left","top",false,false,false ) end ) addEventHandler( "onClientResourceStart", resourceRoot, createGUI ) addEventHandler( "onClientGUIClick", lgbtn, function( ) local chec1 = guiGetText( uned ) local check2 = guiGetText( psed ) if chec1 and check2 then triggerServerEvent( "login", localPlayer, check1, check2 ) end end ,false ) addEventHandler( "onClientGUIClick", rgbtn, function( ) local chec1 = guiGetText( uned ) local check2 = guiGetText( psed ) if chec1 and check2 then triggerServerEvent( "register", localPlayer, check1, check2 ) end end ,false ) function logged( ) guiSetVisible( rgbtn, false ) guiSetVisible( lgbtn, false ) guiSetVisible( un, false ) guiSetVisible( ps, false ) guiSetVisible( uned, false ) guiSetVisible( psed, false ) guiSetVisible( upstuff, false ) guiSetVisible( downstuff, false ) guiSetVisible( whatsnew, false ) guiSetVisible( thenewstuff, false ) toggleAllControls( false, false, false ) end addEvent( "loggedin", true ) addEventHandler( "loggedin", root, logged ) Server function reg ( name,pass ) local regAlready = false if not regAlready then addAccount( name, pass ) local regAlready = true outputChatBox( "Register succes!" ) end end function loginS ( name,pass ) local acc = getAccount( name,pass ) if acc then logIn( source, acc, pass ) spawnPlayer ( source, 0.0, 0.0, 5.0, 90.0, 0 ) triggerClientEvent( source,"loggedin", source ) outputChatBox( "Login succes!" ) else outputChatBox( "Error login!" ) end end addEvent( "register", true ) addEvent( "login", true ) addEventHandler( "login", root, loginS ) addEventHandler( "register", root, reg )
  16. Client addEvent( "onClientMoneyChange",true ) addEventHandler( "onClientMoneyChange",root, function( oldMoney,newMoney ) -- .... end ) function _givePlayerMoney( ... ) local args = { ... } if type( args[1] ) == "number" then if triggerEvent( "onClientMoneyChange",localPlayer,getPlayerMoney( ),args[1] ) and givePlayerMoney( ... ) then return true end return false end end
  17. Добавил в пост функцию. Добавил ещё одну новую функцию
  18. Спасибо вам большое .Что-то не обратил внимания на аргументы в обработчике события ...
  19. Вообщем когда я кликаю на гуи-окно то все события сразу срабатывают , но у меня все события при аттачены к гуи-кнопкам.
×
×
  • Create New...