Jump to content

Ryancit2

Members
  • Posts

    266
  • Joined

  • Last visited

Everything posted by Ryancit2

  1. ryan.mta -- Main exams ke baad full active ho jaoun ga.
  2. Jee haan, btw aap CCV/Bilal ho?
  3. Maine functions hi banaye hain jin ko aap normal MTA functions ki tarha use kar saktay ho.
  4. wohi tou manie banaya hai, tum onPlayerHijack wali event parfunction daalo updateJobProgress(accountName, "Criminals", 1) 1 at end is optional, aap chahein tou ye number daaleing ya phir rehnay dein, ye 1 point de ga. Ye lo ye code aakhir main daalo aur check karo: --> Below are events which will update job progresses. function hijackPoints(plr, seat, jack) local plrAcc = getAccountName(getPlayerAccount(plr)) -- Get account name of player who entered vehicle. local plrTeam = getTeamName(getPlayerTeam(plr)) -- Get his team name. if seat ~= 0 or not jacked or plrTeam ~= "Criminals" then return end -- If he is not at driver's seat OR he is not hijacking a player OR he is not a Criminal then don't proceed any further. local jackTeam = getTeamName(getPlayerTeam(plr)) -- Get team name of player who got hijacked. local points = 1 -- Default points the criminal would get by ordinary hijack. if jackTeam == "Law-Enforcements" then points = 3 end -- If the player who is jacked, is Cop, then the criminal would get 3 points for his bravery. updateJobProgress(plrAcc, "Criminals", points) -- Update points. outputChatBox("Job Progress: Earned +"..points.." job progress by hijacking this player!", plr, 100, 100, 0) -- Tell the criminal that he succeeded. end addEventHandler("onVehicleEnter", root, hijackPoints) function arrestPoints(ammo, plr) if (not plr) or (getElementType(plr) ~= "player") or (getTeamName(getPlayerTeam(source)) ~= "Law-Enforcements") then return end local wanted = tonumber(getPlayerWantedLevel(plr)) or 0 if wanted < 1 then return end local plrAcc = getAccountName(getPlayerAccount(plr)) updateJobProgress(plrAcc, "Law-Enforcements", wanted) outputChatBox("Job Progress: Earned +"..wanted.." job progress by killing a wanted criminal!", source, 100, 100, 0) end addEventHandler("onPlayerWasted", root, arrestPoints) function myRank(plr, cmd, arg) -- /myrank local acc = getAccountName(getPlayerAccount(plr)) -- Get account name of player who typed cmd. if not jobPoints[arg] then return end -- Did he entered the right job name followed by myrank cmd? outputChatBox("Job Progress: Your job progress for "..arg.." is "..getJobProgress(acc, arg).."(Points) with rank "..updateJobRank(acc, arg), plr, 100, 100, 0) -- Output his job stats. end addCommandHandler("myrank", myRank)
  5. Aap ki info edit kar di hai, Motorolla ki profile ID ka link chahiye ho ga.
  6. Job wali script main, aur tumhain pata chal gaya na kaise ye functions use karnay hain? Maine end main example daal di hai + outputdebug wali lines ko comment-out kar do, warna wo spam karengi.
  7. That's why i am browsing my Urdu board 24/7 to help my mates, you can see every [HELP] topic is answered by me atleast once Firstly, i am not asking to get votes, i just wanted to get nominated in it. Secondly, i don't wanna get powers, i am just free enough to help here on this board. For me, Mr.ShariQ is also mature + older than me, i respect him
  8. :phew: finally maine bana li, though 30 minutes lagay lekin maine dynamic system banya hai, tum table main unlimited job names daal do aur unlimited ranks daal do, ye phir bhi un ko read/write karega. -- Local tables cache, gets reset once script is stopped: jobRanks = { ["Criminals"] = { {"Street Rat", 0}, {"Mugger", 100}, }, ["Law-Enforcements"] = { {"Street Cop", 0}, {"Street Detective", 100}, } } jobPoints = { ["Criminals"] = {}, ["Law-Enforcements"] = {} } function updateJobProgress(acc, job, pts) if (not acc) or (not job) then return end local pts = tonumber(pts) or 1 jobPoints[job][acc] = getJobProgress(acc, job) + pts updateJobRank(acc, job) return true end function updateJobRank(acc, job) if (not acc) or (not job) then return end local prog = getJobProgress(acc, job) local rank = 0 for k, v in pairs(jobRanks[job]) do if prog > v[2] then rank = rank + 1 end end if #jobRanks[job] < rank then rank = #jobRanks[job] end if rank < 1 then rank = 1 end return jobRanks[job][rank][1] end function getJobProgress(acc, job) if (not acc) or (not job) then return end return tonumber(jobPoints[job][acc]) or 0 end function updateOnStop(res) if res ~= getThisResource() then return end for k, v in pairs(jobPoints) do for i, d in pairs(v) do local acc = getAccount(i) or nil setAccountData(acc, "jobsProgress."..k, d or 0) outputDebugString("UJP for: "..getAccountName(acc).." - Job: "..k.." - Progress: "..d) end end end addEventHandler("onResourceStop", root, updateOnStop) createTeam("Criminals") createTeam("Law-Enforcements") function updateOnStart(res) if res ~= getThisResource() then return end local accounts = getAccounts() local teams = getElementsByType("team") for k, v in pairs(accounts) do for i, d in pairs(teams) do local acc = getAccountName(v) local job = getTeamName(d) local progress = tonumber(getAccountData(v, "jobsProgress."..job)) or 0 if jobPoints[job] then jobPoints[job][acc] = progress outputDebugString("GJP for: "..acc.." - Job: "..job.." - Progress: "..progress) end end end end addEventHandler("onResourceStart", root, updateOnStart) function ranks(plr, cmd, state, job, pts) local acc = getAccountName(getPlayerAccount(plr)) if state == "ujp" then updateJobProgress(acc, job, pts) outputChatBox("Job progress updated for "..job, plr) elseif state == "ujr" then outputChatBox("Your job rank is: "..updateJobRank(acc, job), plr) else outputChatBox("Your job progress is: "..getJobProgress(acc, job), plr) end end addCommandHandler("jp", ranks) End main maine aik test code dala hai, go ig, type /jp [ujp or ujr or gjp] JobName points iss command ka ye matla hai: /jobprogres [updatejobprogress or updatejobrank or getjobprogress] jobName points (Sab short forms hain) Aur jobName MUST be a job, warna masla ho ga. Ye script job progress ko local tables main save karegi aur resource stop honay par isay account data main daal de gi, phir resource start honay par wapis table main daal de gi. Aur tests + debugging ke liye maine outputDebugString use kiya hai, uss ka output aisa ho ga: UJP for: AccountName - Job: jobName - Progress: progress -- Updated job progress for... GJP for: AccountName - Job: jobName - Progress: progress -- Gotjob progress for... Koi edit main help chahiye ho to poocho.
  9. Haan main ye forums din main 12+ hours browse karta hoon, to help you guys
  10. Iss ka koi evident proof? Ho sakta hai ke infamous honay ki waja se support na karta ho ya phir pakistani banks na support karta ho ya phir pakistani currency na support karta ho?
  11. Maine tumharay liye abhi abhi fresh SQL db tutorial banaya hai, hope you like it. Neechay diye gaye kuch steps aap ko SQLite DB setting up or usage ki complete maloomaat daingay aur aap easily SQLite set up kar sakengay. Step#1: (Setting up) local dbcon = dbConnect ( "sqlite" , "myDB.db" ) -- Iss se same folder main myDB.db name ki dB file create ho gi. local dbcon = dbConnect ( "sqlite" , ":resourceName/myDB.db" ) -- Iss se kisi aur resourceName folder main myDB name ki dB file create ho gi. local dbcon = dbConnect ( "sqlite" , ":/myDB.db" ) -- Iss se MTA SA global database folders main myDB.db name ki dB file create ho gi. Wesay tou dB file same folder main ho prefer ki jati hai. Iss file ki successful creation ke baad iss puray server-side code main ye database file edit karnay ke lye hamain dbcon variable ki zaroorat ho gi, jo ke file creation ke kaam aya hai. Step#2: (Making tables) SQL databases tamaam entries ko tables main save karti hain. Un tables ke under rows aur columns ki entires hoti hai takay hum har entry ko uniquely select kar sakain. dbcon walay variable ke baad ye code dalain jo ke hamara global table ho ga. local tableQ = dbQuery ( dbcon, "CREATE TABLE IF NOT EXISTS globalTable (colIndex TEXT,colValue TEXT)" ) Iss main maine dbQuery ka function use kiya hai jo ke database table ko query karta hai, iss main first argument dbcon hai jo kay hum ne Step#1 main bana hai. dbQuery jahan bhi use ho isay aik dbFile chahiye hoti hai jo ke dbConnect see generate ya read hot hai. Ab hum ne query main aik table banaya hai jis main 2 columns hain, in columns ka name kuch bhi ho sakta hai, maine in ka name colIndex & colValue rakha hai. In column names ke baad maine TEXT likha hai, iss ka matlab hai ke ye column text values hi store karengay, agar koi aur value save karnay ki attempt ki gayi to debug error milega. Iss TEXT ki jaga hum NULL INTEGER REAL STRING BLOB waghera bhi use kar saktay hain aur ya phir isay khali bhi chhor saktay hai, ye optional statement hai. Step#3: (Calling tables) SQL tables call karnay ke liye hamain dbConnection (Step#1), tableQuery (Step#2 jaisi lekin wo nahi) aur dbPoll ko use karna ho ga. Kuch aisay: local localDB = {} -- Ye local table hai server side par, iss main database ki values save hoon gi takay hamain baar baar SQL db call na karna paray. local qh = dbQuery(dbcon, "SELECT * FROM globalTable") local data = dbPoll(qh, -1) -- Loop the db table named as globalTable. if (#data > 0) then -- Kiya db table main kuch data hai? for i, v in pairs(data) do -- Agar haan to is ko loop karain. local ind = v.colIndex -- v.colIndex wo column hai jo hum ne Step#2 main banaya tha. local val = v.colValue -- v.colValue wo column hai jo hum ne Step#2 main banaya tha. if (not localDB[ind]) then localDB[ind] = val -- Local table main db entries save karain. end end end Yahan maine apna local table is liye banaya hai takay hamain db connection baar baar na call karna paray aur server ki performance sahi rahay. Iss ka aik aur fayeda ye bhi hai ke hum onResourceStart par iss ko dalain to ye resource start hotay hi tamaam db data apnay main save kar le ga aur jab tak ye script chalay gi, hum wohi local table main data save kartay rahain gay aur aakhir main onResourceStop par wo local table ko call kar ke wapis dbTable main save kar sakain gay. Iss ki complete example maine aakhir main likhi hai. Step#4: (Saving tables) Ab hum ne db main entries ka table bhi bana liya hai, uss main entries save karnay ke liye hamain dbPoll ka istamaal karna ho ga. local exec = dbQuery(dbcon, "DROP TABLE IF EXISTS globalTable") -- Hum ne pehlay se bana hua db table remove kar diya hai takay hum apna local table save kar sakain, warna local table aur puranay db table ki entries same ho sakti hain. local query = dbQuery(dbcon, "CREATE TABLE IF NOT EXISTS globalTable (colIndex TEXT,colValue TEXT)") -- Dobara table banaya hai. for i, v in pairs (localDB) do -- LocalDB aik local table hai jo kay hum ne Step#3 main banaya tha, iss table main hamari entries save hui theen. if (v) then dbExec(dbcon, "INSERT INTO globalTable(colIndex, colValue) VALUES(?, ?)", i, v) -- Ab hum ne wo local table ki entries ko apnay new db table main dal diya hai. end end Step#5: (Editing/Adding new entries to local table we created) Hum ne jo local table Step#3 main banaya tha wo hamari db entries save karega, uss main entries save/edit karnay ke liye hum ordinary Lua tables ka format use karengay. -- Suppose we have a value and a key for it. Value = val and key = key. localDB[key] = val -- Iss se localDB table main 'key' ke under value save karega, agar pehlay se hi iss key main value hai to usay edit karega. localDB[key] = nil -- Iss se localDB main saved entry ko delete karega. for k, v in pairs(localDB) do --[[some code]] end -- Iss se hum localDB ko loop kar saktay hain aur CPU usage bhi nahi ho gi, agar hum baar baar dbQuery ko loop karain to CPU usage bohat zyada bhi ho sakti hai. Step#6 (Example) Uper diye gaye tamaam steps ke functions ko maine aik hi example main likha hai takay aap ko sahi samajh a jaye. local connection = dbConnect("sqlite", "playerKills.db") local kills = { --["Account"] = kills, } addEventHandler("onResourceStop", resourceRoot, function(resource) if resource ~= getThisResource() then return end local exec = dbQuery(connection, "DROP TABLE IF EXISTS playerKills") local query = dbQuery(connection, "CREATE TABLE IF NOT EXISTS playerKills (account TEXT, kills INTEGER)") for i, v in pairs (kills) do if (v) then dbExec(connection, "INSERT INTO playerKills(account, kills) VALUES(?, ?)", i, v) end end end ) addEventHandler("onResourceStart", resourceRoot, function(resource) if resource ~= getThisResource() then return end local data = dbPoll(dbQuery(connection, "SELECT * FROM playerKills"), -1) if (#data > 0) then for i, v in pairs(data) do local acc = v.account local kills = v.kills kills[acc] = kills end end end ) function addKill(acc) if (not acc) then return end local oldKills = kills[acc] or 0 kills[acc] = oldKills + 1 return kills[acc] end -- Abd hum iss function ko call kar saktay hain jab bhi player ki kills increase karni hoon, sirf addKill(account name) likhain aur ye 1 kill uss ki previouse kills main add karega aur sath hi uss ki total kills batayega.
  12. Well i know this information for months but still that doesn't matters for me because its a common fact that a company worldwide famous with 1.8 billion + users and currently MILLIONS of beta testers would just track my passwords down? :phew: no way Yes, and about google chrome, they've recently detected about 1000+ chrome extensions which used keyloggers so better be careful about that too.
  13. Hmmm... plan cancelled phir jani.
  14. Mujhay bhi MHS wala hi doubt hai.
  15. Its a custom disconnection, yes but still, i am facing packet loss. The disconnection is not the subject but packet loss is. I've added Edit#2 please check the first post.
  16. Nice work, main dekhoon ga aap ki videos.
  17. I am nightly user but never played on any other server, will try. Any other tips?
  18. Hey guys, I've helped about 500 players in MTA who faced packet loss issue but this time mine is way too different, it disconnects me after 2-5 minutes of connection to server. However if I'm not logged in to server, it doesn't crashes (in cit2.net). This started happening after installing Windows 10 technical preview build 10041 and higher (currently its build 10061, the latest). I was wondering if this is because of new color schemes being imposed in windows or new search engines and other network related tools? If so, I'd like to know the possible fixes. Also, in soon future when Windows 10 will be released publically, many MTA users will try it and so they'll face the issue too so I would like to know it. NOTE: Please don't say change your OS because I won't do that, I'm taking part in windows beta testers program and I'd like to know if there is issue with windows, so that I can report this issue to Microsoft. Edit#1: My ping is constant 170-180, FPS is max (60). My graphics card is 3 GB NVIDIA, RAM is also 3GB, Processor is 3 ~GHz Core2Duo. Edit#2: The packet loss disappears after some time but the FPS decreases (to 5-6 from 50-60) on regular intervals and in crowds too, that's not the server issue right? Since MTA uses Windows 8's special settings, maybe that's the issue?
  19. Great job yaar, aap ko zaroor success milega keep it up
  20. Apni post se ye remove karo: "I REQUEST ADMINS TO MOVE ALL THE HELP RELATED TOPIC AND POSTS HERE!" ye bohat messy lag raha hai aur ye kaam main karwata rahoon ga, main daily 16+ hours forums continuously browse karta hoon to update bhi rakhoon ga.
  21. Ryancit2

    ammo

    Make table like that and add checks when giving ammo like this: maxAmmo = { ["m4"] = 200, ["mp5"] = 128, ["grenade"] = 5, ["colt45"] = 30, ["silenced"] = 24, ["deagle"] = 24, ["shotgun"] = 30, ["uzi"] = 120, ["ak47"] = 200, ["rifle"] = 30, ["sniper"] = 30, ["rocketlaucher"] = 4, ["heatseeker"] = 4, ["moltov"] = 5 } function giveAmmo(player, wep, ammo) if (not tonumber(ammo)) or (not tonumber(wep)) or (not player) then return end local current = getPedTotalAmmo(player, wep) if current >= (maxAmmo[wep] or 4) then setWeaponAmmo(player, wep, maxAmmo[wep]) return end -- If player have more than max ammo then it will set ammo to max. local new = setWeaponAmmo(player, wep, (maxAmmo[wep] or 4)) end -- And then call this function in other events by giveAmmo(playerToGive, wep, ammo) and it will give maxx ammo to player.
  22. Haan Anubhav sahi keh raha hai, main ye saare topics merge karwa deta hoon phir aik hi topic par baar baar help lena
  23. Do you mean this: setPedWalkingStyle If not then what?
×
×
  • Create New...