Jump to content

GrubaS

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by GrubaS

  1. GrubaS

    [Question]

    I dont want make a new post so i'll write here. I want block command kill in race gamemode its possible? (this function dont working) addEventHandler ( "onPlayerCommand", root, function (cmd) if ( cmd == "kill" ) then outputChatBox("u can't use kill command") cancelEvent () end end )
  2. GrubaS

    [Question]

    I can block commands like "reconnect" or "quit" ?
  3. GrubaS

    [HELP] KILL

    Guys, thanks for help
  4. GrubaS

    [HELP] KILL

    Hello again, i wanted make kill on Bind (enter). I don't know what write in client ;( server.lua addEvent('KillPlayer', true) addEventHandler('KillPlayer', resourceRoot, function(player, resourceRoot) if not source == resourceRoot then return end setTimer(setElementHealth, 5000, 1, player, 0) end) client.lua function kill() triggerServerEvent('KillPlayer', resourceRoot) end addCommandHandler('kill',kill) addCommandHandler('Commit suicide',kill) bindKey ( next(getBoundKeys"enter_exit"), "down", "Commit suicide" )
  5. GrubaS

    [HELP] KILL

    Yea, u're right WhoAmI, thanks for helps guys it's working
  6. GrubaS

    [HELP] KILL

    and now it's killing me every 5 secound, its working without command
  7. It's fixed thanks for helps
  8. GrubaS

    [HELP] KILL

    I want make a script, when someone use command kill then after 5 sec he'll die whats wrong? addCommandHandler("kill", function (player) setTimer(5000, 0, player) setElementHealth(player, 0) end)
  9. g_Root = getRootElement() function Initiate() country = getPlayerCountry(source) if country == nil or country == false then country = "n/a" end setElementData(source, "country", country) end addEventHandler('onPlayerJoin', g_Root, Initiate) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() -- You can remove this if you want outputChatBox('#ffffff[C_ID] #ffff00Initiating CID system... #ffffffDONE', getRootElement(), 255, 100, 100, true) call(getResourceFromName("scoreboard"),"addScoreboardColumn","country", getRootElement(), 9, 50) setTimer( function() country = getPlayerCountry(source) if country == nil or country == false then country = "n/a" end setElementData(source, "country", country) end, 4000, 1) end ) aCountries = {} function getPlayerCountry ( player ) return getIpCountry ( getPlayerIP ( player ) ) end function getIpCountry ( ip ) local ip_group = tonumber ( gettok ( ip, 1, 46 ) ) local ip_code = ( gettok ( ip, 1, 46 ) * 16777216 ) + ( gettok ( ip, 2, 46 ) * 65536 ) + ( gettok ( ip, 3, 46 ) * 256 ) + ( gettok ( ip, 4, 46 ) ) if ( #aCountries == 0 ) then loadIPGroups () end if ( not aCountries[ip_group] ) then aCountries[ip_group] = {} end for id, group in ipairs ( aCountries[ip_group] ) do if ( ( group.rstart <= ip_code ) and ( ip_code <= group.rend ) ) then return group.rcountry end end return false end -- Load all IP groups from "conf/IpToCountryCompact.csv" function loadIPGroups () unrelPosReset() local readFilename = "conf/IpToCountryCompact.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local buffer = "" while true do local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) local parts = split( line, string.byte(',') ) if #parts > 2 then local rstart = tonumber(parts[1]) local rend = tonumber(parts[2]) local rcountry = parts[3] -- Relative to absolute numbers rstart = unrelRange ( rstart ) rend = unrelRange ( rend ) local group = math.floor( rstart / 0x1000000 ) if not aCountries[group] then aCountries[group] = {} end local count = #aCountries[group] + 1 aCountries[group][count] = {} aCountries[group][count].rstart = rstart aCountries[group][count].rend = rend aCountries[group][count].rcountry = rcountry end end end fileClose(hReadFile) end -- Make a stream of absolute numbers relative to each other local relPos = 0 function relPosReset() relPos = 0 end function relRange( v ) local rel = v - relPos relPos = v return rel end -- Make a stream of relative numbers absolute local unrelPos = 0 function unrelPosReset() unrelPos = 0 end function unrelRange( v ) local unrel = v + unrelPos unrelPos = unrel return unrel end -- IP2C logging function outputHere( msg ) --outputServerLog ( msg ) outputChatBox ( msg ) end ---------------------------------------------------------------------------------------- -- -- Set to true to enable commands "makecsv" and "iptest" -- ---------------------------------------------------------------------------------------- local makeAndTestCompactCsv = false if makeAndTestCompactCsv then local makeCor -- Takes a 'IPV4 CSV' file sourced from [url=http://software77.net/geo-ip/]http://software77.net/geo-ip/[/url] -- and makes a smaller one for use by Admin addCommandHandler ( "makecsv", function () local status = makeCor and coroutine.status(makeCor) if (status == "suspended") then outputHere( "Please wait" ) return end makeCor = coroutine.create ( makeCompactCsvWorker ) coroutine.resume ( makeCor ) end ) function makeCompactCsvWorker () outputHere ( "makeCompactCsv started" ) relPosReset() local readFilename = "conf/IpToCountry.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local writeFilename = "conf/IpToCountryCompact.csv"; local hWriteFile = fileCreate( writeFilename, true ) if not hWriteFile then fileClose(hReadFile) outputHere ( "Cannot create " .. writeFilename ) return end local tick = getTickCount() local buffer = "" while true do if ( getTickCount() > tick + 50 ) then -- Execution exceeded 50ms so pause and resume in 50ms setTimer(function() local status = coroutine.status(makeCor) if (status == "suspended") then coroutine.resume(makeCor) elseif (status == "dead") then makeCor = nil end end, 50, 1) coroutine.yield() tick = getTickCount() end local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) -- If not a comment line if string.sub(line,1,1) ~= '#' then -- Parse out required fields local _,_,rstart,rend,rcountry = string.find(line, '"(%w+)","(%w+)","%w+","%w+","(%w+)"' ) if rcountry then -- Absolute to relative numbers rstart = relRange( rstart ) rend = relRange( rend ) -- Output line fileWrite( hWriteFile, rstart .. "," .. rend .. "," .. rcountry .. "\n" ) end end end end fileClose(hWriteFile) fileClose(hReadFile) outputHere ( "makeCompactCsv done" ) end function ipTestDo( ip ) local country = getIpCountry ( ip ) outputHere ( "ip " .. ip .. " is in " .. tostring(country) ) end function ipTest() ipTestDo ( "46.1.2.3" ) ipTestDo ( "88.1.2.3" ) ipTestDo ( "46.208.74.201" ) ipTestDo ( "102.1.2.3" ) end
  10. Still doesn't working function flag () setElementData(getPlayerName("SheTi"),"country","EU") end addEventHandler ( "onPlayerJoin", getRootElement(), flag )
  11. Hello, i want make a script when guy with nick "SheTi" come in server then his flag chaning to EU function flag() setElementData(getPlayerFromName("SheTi"),"country","EU") end
  12. GrubaS

    [HELP] Runcode

    Thanks, it's working
  13. kk fixed, thanks for help.
  14. i deleted this line ( outputChatBox... ) in client but now same error but in server.lua 22 lines.. whats now?
  15. It still dont working, Debugscript: "client.lua:9: attempt to concatenate local 'v'(a boolean value)"
  16. when i write /checkvideo it's showing only resolution
  17. GrubaS

    Help pls,

    Hi , anyone who can create anti-fraps script for MTA? DD section is full of cheaters , who abuse fraps for stronger car . Fraps makes your fps droping and it's unfair. It is possible?? Thanks
  18. GrubaS

    Help Please,

    Hello guys, I'm doing a script at the moment and I could need some help. The line is below searchBox = guiCreateEdit(0.04, 0.04, 0.44, 0.06, "Search(not work idk why)", true, tabMaps) mapsList = guiCreateGridList(0.04, 0.13, 0.44, 0.83,true,tabMaps) guiGridListSetSelectionMode(mapsList, 2) guiGridListAddColumn(mapsList,"Maps",1) guiCreateLabel ( 0.76, 0.79, 0.3, 0.05, "rounds:", true, tabMaps) roundsEdit = guiCreateEdit(0.86, 0.78, 0.095, 0.07, roundsOnMap or defaultRounds, true, tabMaps) guiEditSetMaxLength (roundsEdit, 2 ) saveButton2 = guiCreateButton(0.52,0.88,0.31,0.08,"Save",true,tabMaps) closeButton2 = guiCreateButton(0.86,0.88,0.1,0.08,"X",true,tabMaps) downButton = guiCreateButton(0.52,0.78,0.1,0.08,"Down",true,tabMaps) upButton = guiCreateButton(0.634,0.78,0.1,0.08,"Up",true,tabMaps) ------------ mapsList2 = guiCreateGridList(0.52, 0.04, 0.44, 0.7,true,tabMaps) guiGridListSetSelectionMode(mapsList2,2) guiGridListAddColumn(mapsList2,"Added maps",1) The problem is that searcher does not work, can you help? thx it's full client local players = getElementsByType("player") local gme = getLocalPlayer () local x,y = guiGetScreenSize () local addedTeams = {} local addedMaps = {} local addedMapsEdit = {} local countTable = {} local countTableEdit = {} local alivept = {} local showTeams = false local defaultRounds = "5" function openCloseWindow (maps) mapsTable = maps if not guiGetVisible(addsWindow) then guiSetVisible(addsWindow,true) showCursor(true) local r, g, b if getPlayerTeam(gme) then r, g, b = getTeamColor(getPlayerTeam(gme)) else r, g, b = 255, 255, 255 end --callServerFunction("outputChatBox","* "..getPlayerName(gme).."#ffffff opened CWShit window", root, r, g, b,true) fillingColumns() else guiSetVisible(addsWindow,false) showCursor(false) --fillingColumns() end end function fillingColumns() guiGridListClear(teamsList) local teams = getElementsByType("team") for i, v in ipairs (teams) do row = guiGridListAddRow ( teamsList ) guiGridListSetItemText (teamsList, row, 1, getTeamName(v), false, false) end -------- guiGridListClear(teamsList2) for i, v in ipairs (addedTeams) do row = guiGridListAddRow (teamsList2) guiGridListSetItemText (teamsList2, row, 1, getTeamName(v), false, false) guiGridListSetItemText (teamsList2, row, 2, countTable[getTeamName(v)], false, false) end -------- guiGridListClear(mapsList) if mapsTable then for i, v in ipairs (mapsTable) do row = guiGridListAddRow ( mapsList ) guiGridListSetItemText (mapsList, row, 1, mapsTable[i], false, false) end end -------- guiGridListClear(mapsList2) --outputChatBox(#addedMaps.." "..#addedMapsEdit) for i, v in ipairs (addedMaps) do row = guiGridListAddRow (mapsList2) guiGridListSetItemText (mapsList2, row, 1, v, false, false) end -------- end addsWindow = guiCreateWindow(520,20,450,400,"CWShit",false) tabPanel = guiCreateTabPanel ( 0, 0.065, 1, 1, true, addsWindow ) tabTeams = guiCreateTab( "Teams", tabPanel ) tabMaps = guiCreateTab( "Maps", tabPanel ) guiSetVisible(addsWindow, false) ------------ teamsList = guiCreateGridList(0.04, 0.04, 0.44, 0.92,true,tabTeams) guiGridListSetSelectionMode(teamsList, 2) teamsColumn = guiGridListAddColumn(teamsList,"Teams",1) guiGridListSetColumnWidth ( teamsList, teamsColumn, 0.9, true ) saveButton1 = guiCreateButton(0.52,0.88,0.31,0.08,"Save",true,tabTeams) closeButton1 = guiCreateButton(0.86,0.88,0.1,0.08,"X",true,tabTeams) ------------ teamsList2 = guiCreateGridList(0.52, 0.04, 0.44, 0.66,true,tabTeams) guiGridListSetSelectionMode(teamsList2, 1) addedTColumn = guiGridListAddColumn(teamsList2,"Added teams",1) countColumn = guiGridListAddColumn(teamsList2,"Count", 2) guiGridListSetColumnWidth ( teamsList2, addedTColumn, 0.61, true ) guiGridListSetColumnWidth ( teamsList2, countColumn, 0.2, true ) minusCountButton = guiCreateButton(0.52,0.74,0.08,0.085,"-",true,tabTeams) countEdit = guiCreateEdit(0.63, 0.74, 0.095, 0.08,"", true, tabTeams) guiEditSetMaxLength (countEdit, 2 ) plusCountButton = guiCreateButton(0.75,0.74,0.08,0.085,"+",true,tabTeams) ------------------------------------------------------------------ searchBox = guiCreateEdit(0.04, 0.04, 0.44, 0.06, "Search(not work idk why)", true, tabMaps) mapsList = guiCreateGridList(0.04, 0.13, 0.44, 0.83,true,tabMaps) guiGridListSetSelectionMode(mapsList, 2) guiGridListAddColumn(mapsList,"Maps",1) guiCreateLabel ( 0.76, 0.79, 0.3, 0.05, "rounds:", true, tabMaps) roundsEdit = guiCreateEdit(0.86, 0.78, 0.095, 0.07, roundsOnMap or defaultRounds, true, tabMaps) guiEditSetMaxLength (roundsEdit, 2 ) saveButton2 = guiCreateButton(0.52,0.88,0.31,0.08,"Save",true,tabMaps) closeButton2 = guiCreateButton(0.86,0.88,0.1,0.08,"X",true,tabMaps) downButton = guiCreateButton(0.52,0.78,0.1,0.08,"Down",true,tabMaps) upButton = guiCreateButton(0.634,0.78,0.1,0.08,"Up",true,tabMaps) ------------ mapsList2 = guiCreateGridList(0.52, 0.04, 0.44, 0.7,true,tabMaps) guiGridListSetSelectionMode(mapsList2,2) guiGridListAddColumn(mapsList2,"Added maps",1) addEventHandler( "onClientGUIDoubleClick", teamsList, function() local selectedRow, selectedCol = guiGridListGetSelectedItem( teamsList ) local selectedTeam = guiGridListGetItemText( teamsList, selectedRow, selectedCol ) if selectedTeam then table.insert (addedTeams, getTeamFromName (selectedTeam)) row = guiGridListAddRow (teamsList2) guiGridListSetItemText (teamsList2, row, 1, selectedTeam, false, false) end end, false ) addEventHandler( "onClientGUIDoubleClick", teamsList2, function() local selectedRow, selectedCol = guiGridListGetSelectedItem( teamsList2 ) local selectedTeam = guiGridListGetItemText( teamsList2, selectedRow, selectedCol ) table.remove (addedTeams, selectedRow+1) guiGridListRemoveRow (teamsList2, selectedRow) end, false ) addEventHandler( "onClientGUIClick", root, function() if source == closeButton1 or source == closeButton2 then openCloseWindow () elseif source == saveButton1 then if addedTeams[2] then for i, team in ipairs (addedTeams) do if not countTableEdit[getTeamName(team)] then countTableEdit[getTeamName(team)] = 0 end end countTable = countTableEdit callServerFunction("serverAddTeamsCount", gme, addedTeams, countTable) else outputChatBox ("*#E01B2F Error:#ffffff must add at least 2 teams.", 255, 255, 255, true ) end elseif source == saveButton2 then if addedMapsEdit[1] then local rounds = nil if guiGetText (roundsEdit) > "0" then rounds = tonumber(guiGetText (roundsEdit)) end -- addedMaps = addedMapsEdit callServerFunction("serverAddMapsRounds", gme, addedMapsEdit, rounds or defaultRounds) else outputChatBox ("*#E01B2F Error:#ffffff must add at least one card.", 255, 255, 255, true ) end elseif source == teamsList2 then selectedRow, selectedCol = guiGridListGetSelectedItem( teamsList2) selectedTeam = guiGridListGetItemText( teamsList2, selectedRow, selectedCol ) if countTableEdit[selectedTeam] then guiSetText (countEdit, countTableEdit[selectedTeam] ) end elseif source == plusCountButton and countTableEdit[selectedTeam] then countTableEdit[selectedTeam] = countTableEdit[selectedTeam] + 1 guiSetText (countEdit, countTableEdit[selectedTeam]) guiGridListSetItemText (teamsList2, selectedRow, 2, guiGetText (countEdit) , false, false) elseif source == minusCountButton then countTableEdit[selectedTeam] = countTableEdit[selectedTeam] - 1 guiSetText (countEdit, countTableEdit[selectedTeam]) guiGridListSetItemText (teamsList2, selectedRow, 2, guiGetText (countEdit) , false, false) elseif source == upButton then local selectedRow, selectedCol = guiGridListGetSelectedItem( mapsList2 ) local selectedMap = guiGridListGetItemText( mapsList2, selectedRow, selectedCol ) if selectedMap and selectedRow >= 1 then addedMapsEdit[selectedRow+1], addedMapsEdit[selectedRow] = addedMapsEdit[selectedRow], addedMapsEdit[selectedRow+1] row = guiGridListInsertRowAfter(mapsList2, selectedRow-2) guiGridListSetItemText (mapsList2, row, selectedCol,selectedMap, false, false) guiGridListRemoveRow (mapsList2, selectedRow+1) end elseif source == downButton then local selectedRow, selectedCol = guiGridListGetSelectedItem( mapsList2 ) local selectedMap = guiGridListGetItemText( mapsList2, selectedRow, selectedCol ) if selectedMap and selectedRow >= 0 and selectedRow < #addedMapsEdit-1 then addedMapsEdit[selectedRow+1], addedMapsEdit[selectedRow+2] = addedMapsEdit[selectedRow+2], addedMapsEdit[selectedRow+1] row = guiGridListInsertRowAfter(mapsList2, selectedRow+1) guiGridListSetItemText (mapsList2, row, selectedCol,selectedMap, false, false) guiGridListRemoveRow (mapsList2, selectedRow) end end end) addEventHandler( "onClientGUIDoubleClick", mapsList, function() local selectedRow, selectedCol = guiGridListGetSelectedItem( mapsList ) local selectedMap = guiGridListGetItemText( mapsList, selectedRow, selectedCol ) if selectedMap then table.insert (addedMapsEdit, selectedMap) row = guiGridListAddRow (mapsList2) guiGridListSetItemText (mapsList2, row, 1, selectedMap, false, false) end end, false ) addEventHandler( "onClientGUIDoubleClick", mapsList2, function() local selectedRow, selectedCol = guiGridListGetSelectedItem( mapsList2 ) local selectedMap = guiGridListGetItemText( mapsList2, selectedRow, selectedCol ) table.remove (addedMapsEdit, selectedRow+1) guiGridListRemoveRow (mapsList2, selectedRow) end, false ) function refreshMapsRounds (maps, rounds) addedMaps = maps addedMapsEdit = maps roundsOnMap = rounds guiSetText (roundsEdit, roundsOnMap) fillingColumns() end function refreshTablichka(teamsTable, count, state) addedTeams = teamsTable countTable = count --countTableEdit = count showTeams = state fillingColumns() end --function checkAfk() --end function startMapClient () for i, team in ipairs (addedTeams) do alivept[getTeamName(team)] = 0 end end addEventHandler ( "onClientPlayerVehicleEnter", root, function () if getPlayerTeam(source) then teamName = getTeamName(getPlayerTeam(source)) if not alivept[teamName] then alivept[teamName] = 0 end alivept[teamName] = alivept[teamName] + 1 end end) addEventHandler ( "onClientPlayerWasted", root, function () if getPlayerTeam(source) then teamName =
  19. GrubaS

    Help Please.

    Thank You very much.
  20. GrubaS

    Help Please.

    Hello guys, I'm doing a script at the moment and I could need some help. The line is below iif isObjectInACLGroup("user."..accountName,aclGetGroup("RPC")) then -- 4 The problem is that I don't want this to be RPC, I want it to work ONLY with my account name, which is GrubaS can you help? thx.
×
×
  • Create New...