Ayush Rathore

Members
  • Content count

    125
  • Joined

  • Last visited

  • Days Won

    1

Ayush Rathore last won the day on March 11

Ayush Rathore had the most liked content!

Community Reputation

43 Good

5 Followers

About Ayush Rathore

  • Rank
    Sucka
  • Birthday April 27

Details

  • Gang
    NONE
  • Location
    India
  • Occupation
    Killing People
  • Interests
    Scripting(server,client,gui,sql),Mapping
  1. Remaining Time

    You could do one thing make a account data vip_hours in which you set a real time stamp(when you given a vip to a player) in millisecond and then every time a player logs in to a account check it with the server time if the difference is greater than 100 then remove the vip use mta wiki for reference of getRealTime function
  2. HoursToDay

    if you pass 360 in function or any other value result would be like this totalHours = 360 hours = (360/60) -- > 6 hours = 360 - (6*60) -- > 0 and btw i cant understand why you doing this
  3. Cents

    Try this btw seeing your code you might get an error function takeMoney(player, price) local cash = getElementData(player, "player:money") if cash then cash = tonumber(cash) if cash >= tonumber(price) then setElementData(player, "player:money", cash-price) return true else return false end else setElementData(player,"player:money",0) return false end end function giveCash(player, price) local cash = getElementData(player, "player:money") if cash then setElementData(player, "player:money", cash+price) return true else setElementData(player, "player:money", 0) return false end end addEvent("giveCash", true) addEventHandler("giveCash", root, function(value) if client and value then giveCash(client, value) end end) addEvent("takeCash", true) addEventHandler("takeCash", root, function(price) if client and price then takeMoney(client, price) end end)
  4. I can't find the bug here

    my bad sorry try this local screenWidth, screenHeight = guiGetScreenSize() local visible = false local window = nil local browser = nil local theBrowser = nil addCommandHandler("youtube",function() visible = not visible if visible == true then window = guiCreateWindow( (screenWidth-800)/2 , (screenHeight-600)/2, 800, 600, "Web Browser", false ) browser = guiCreateBrowser( 0, 28, 800, 600, false, false, false, window ) theBrowser = guiGetBrowser( browser ) addEventHandler("onClientBrowserCreated", theBrowser, function() loadBrowserURL(source, "http://www.youtube.com") end) elseif visible == false then destroyElement(browser) destroyElement(window) browser = nil window = nil theBrowser = nil end showCursor(visible) end) if you like my work please like and follow me happy scripting .
  5. I can't find the bug here

    local screenWidth, screenHeight = guiGetScreenSize() local webBrowser = nil local visible = false function webBrowserRender() if visible then dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true) end end addEventHandler("onClientRender", root, webBrowserRender) addEventHandler("onClientBrowserCreated", webBrowser, function() loadBrowserURL(webBrowser, "http://www.youtube.com") end) addCommandHandler("youtube",function() visible = not visible webBrowser = createBrowser(screenWidth, screenHeight, false, false) showCursor(visible) end) This would fix your problem
  6. [Question] how to use onClientResourceStart

    Man you really cracked it so i suggest you to first tell all about the mission i will give you a working script in a day or 2 ok ? happy scripting P.S. give me your original script read my message above
  7. Event-Sytem

    Any time no problem your welcome
  8. Event-Sytem

    Sure i will help u but seriously u don't know scripting, local commands = { ['event'] = true, ['participate'] = true } function checkForEventJoining(commandName) if commands[commandName] then local playerResponsible = source if commandName == "event" then if (exports.integration:isPlayerLeadAdmin(playerResponsible)) then local playerName = getPlayerName ( playerResponsible ) outputChatBox("Admin Joined the Event Script Works!", playerResponsible, 255, 194, 14) else outputChatBox("You need Admin for joining event!", playerResponsible, 255, 194, 14) end elseif commandName == "participate" then if (exports.integration:isPlayerLeadAdmin(playerResponsible)) then local playerName = getPlayerName ( playerResponsible ) outputChatBox("Admin participated Script Works!", playerResponsible, 255, 194, 14) else outputChatBox("You need Admin for participating in event!", playerResponsible, 255, 194, 14) end end end end addEventHandler("onPlayerCommand", root, checkForEventJoining) help yourself by learning scripting and also see above how to do it Please re read my post as i edited it
  9. Event-Sytem

    first read how to post in this forum your code hurt my eyes and also go to mta wiki to learn some coding btw let me help you function joinEvent(thePlayer, commandName, ...) if (exports.integration:isPlayerLeadAdmin(thePlayer)) then local playerName = getPlayerName ( thePlayer ) outputChatBox("Adminul '" .. playerName.. "' testeaza un script personal.", thePlayer, 255, 194, 14) outputChatBox("Scrie /event pentru a participa !", thePlayer, 255, 194, 14) outputChatBox("Test", thePlayer, 255, 194, 14) else outputChatBox("Trebuie sa fi 'Lider Admin' pentru aceasta comanda !", thePlayer, 255, 194, 14) outputChatBox("Script creat de 'Griffin_Connor'.", thePlayer, 255, 194, 14) end end addCommandHandler("event", joinEvent) this should be correct as i don't know your language .
  10. [Question] how to use onClientResourceStart

    Try this btw u have to change many things in addEventHandler Thingy as : see below --// Made by: MoPoMaN --//Tables and other stuff tableLocationsX = {} tableLocationsY = {} tableLocationsZ = {} tableMoney = {} locationCount = 3 --//Location 1 tableLocationsX[1] = 2253.7 tableLocationsY[1] = -84.0 tableLocationsZ[1] = 25.3 tableMoney[1] = 500 --//Location 2 tableLocationsX[2] = 1093.7 tableLocationsY[2] = -931.6 tableLocationsZ[2] = 41.9 tableMoney[2] = 550 --//Location3 tableLocationsX[3] = -47.3 tableLocationsY[3] = -1137.5 tableLocationsZ[3] = 0.07 tableMoney[3] = 500 function startScript () --Marker marker = createMarker (2776.6, -2425.5, 12.6, "cylinder", 1.1, 0, 255, 0) addEventHandler ("onClientMarkerHit", marker, startMission) --Objects and Ped ped = createPed (302, 2776.7, -2428.1, 13.6) tableObj = createObject (2205, 2775.9, -2426.8, 12.6) chairObj = createObject (2309, 2776.7, -2427.4, 12.6) addEventHandler ("onClientPedWasted", getRootElement(), respawnPed) --Blip startBlip = createBlip (2776.9, -2423.9, 12.7, 51) end function startMission (hitElement) if getElementType (hitElement) == "player" then truck = createVehicle (515, 2779.6, -2437.2, 14.7, 0, 0, 90) trailer = createVehicle (450, 2789.2, -2437.1, 14.2, 0, 0, 90) randomLoc = math.random (1, locationCount) finish = createMarker (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], "cylinder", 3, 0, 200, 55, 255, hitElement) blip = createBlip (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], 0, 2, 255, 0, 0, 255, 0, 10000, hitElement) --addEventHandlers addEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) addEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) addEventHandler ("onClientMarkerHit", finish, reward) addEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other setVehicleLocked (truck, true) destroyElement (startBlip) player = hitElement outputChatBox ("#ffaa00***#ffffffDrive to the red blip on the map #ffaa00***", player, 255, 255, 255, true) setElementPosition (marker, -406, -64, 2.4) warpPedIntoVehicle (hitElement, truck) -- end else return false end end function trailerDetach () if source == trailer then --destroyThings outputChatBox ("#ffffffMission failed, go back for more cargo!", player, 255, 255, 255, true) destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) else return false end end function vehicleExit (leaver) if source == truck and leaver == player then setVehicleLocked (truck, false) outputChatBox ("#ffaa00// #ffffffGo back to the truck in 10 seconds!", leaver, 255, 255, 255, true) destroyTimer = setTimer (destroyVehicle, 10000, 1) addEventHandler ("onClientVehicleEnter", getRootElement(), destrTimer) else return false end end function destrTimer (thePlayer) if source == truck and thePlayer == player then local team = getPlayerTeam (thePlayer) if getTeamName (team) == "Freeroam" or getTeamName (team) == "The Police" then return false else killTimer (destroyTimer) removeEventHandler ("onClientVehicleEnter", getRootElement(), destrTimer) setVehicleLocked (truck, true) end else return false end end function destroyVehicle () if destroyTimer then --destroyThings destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientVehicleEnter", getRootElement(), destrTimer) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) else return false end end function onQuit () if source == player then --destroyThings destroyElement (truck) destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) end end function reward (hitElement) if hitElement == truck then --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) outputChatBox ("#ffaa00// #ffffffGood job! You've been rewarded " .. tableMoney[randomLoc] .. "$", player, 255, 255, 255, true) setElementPosition (marker, 2776.6, -2425.5, 12.6) occupant = getVehicleOccupant (truck, 0) givePlayerMoney (occupant, tableMoney[randomLoc]) --destroyThings destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) else return false end end function respawnPed () if source == ped then timer = setTimer (pedRespawn, 5000, 1) else return false end end function pedRespawn () killTimer (timer) destroyElement (ped) ped = createPed (302, 2776.7, -2428.1, 13.6) end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), startScript)
  11. Make player login after finishing download

    use this tag in meta file its the easiest way --in meta.xml of every resource you want to download earlier than login panel <download_priority_group>1</download_priority_group> --increse the value in every resource by one <download_priority_group>2</download_priority_group> <download_priority_group>3</download_priority_group> <download_priority_group>4</download_priority_group> --...... all resources you want to be downloaded before login --and lastly add the below line in meta.xml of login <download_priority_group>0</download_priority_group>
  12. How to sort table by key

    function pairsByKeys (t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end function aktualizujKontakty() lista={} for i,v in ipairs(getElementsByType("player")) do if v~=localPlayer then lista[getPlayerName(v)]={v,getElementData(localPlayer,"PW:"..getPlayerName(v)) or ""} end end end function wyswietlKontakty() guiGridListClear(gridlist[1]) for i,v in pairsByKeys(lista) do -- see this line r=guiGridListAddRow(gridlist[1]) guiGridListSetItemText(gridlist[1],r,1,skipColorCode(i),false,false) guiGridListSetItemData(gridlist[1],r,1,i) if nieodczytane[i] then guiGridListSetItemColor(gridlist[1],r,1,0,255,0) end if zablokowany[i] then guiGridListSetItemColor(gridlist[1],r,1,255,0,0) end end end This will sort table by key and will add players automatically
  13. Getting client's MAC address

    So i would ask u if you can make changes to your saving system by adding two column for banAccount and banTime and then on player Login by that account he can never cheat and also go to below link and u will get to know that Mac Addresses can also be changed so my above method will be best
  14. SNIPER BUG

    BTW you should first read mta wiki if u are a scripter Server Side : function playerDamageCheckForSniper ( attacker, weapon, bodypart, loss ) if ( weapon == 34 ) then killPed ( source, attacker, weapon, bodypart ) end end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamageCheckForSniper ) this would do the trick
  15. Getting client's MAC address

    In my opinion only serial will suffice for your ban system as serial cant be changed of a pc or laptop and also if you have a data saving system make it store values on basis of serial key which means SERIALNUMBER WILL BE PRIMARY KEY OF YOUR DATABASE Happy scripting making it unexploitable