DomesticCat Posted October 17, 2014 Share Posted October 17, 2014 Ye script kam kyun nahi karti!! function givePlayerJetpack (Player) outputChatBox ("You've Got A JetPack") end addCommandHandler ("jop", jetPack) Link to comment
Bilal135 Posted October 17, 2014 Share Posted October 17, 2014 commandName = "jop" addCommandHandler (commandName, function(sot) givePlayerJetPack(sot) outputChatBox ("You've Got A Jet Pack", sot, 0, 255, 0) end ) Link to comment
DomesticCat Posted October 17, 2014 Author Share Posted October 17, 2014 commandName = "jop" addCommandHandler (commandName, function(sot) givePlayerJetPack(sot) outputChatBox ("You've Got A Jet Pack", sot, 0, 255, 0) end ) Shukriya! Link to comment
Anubhav Posted October 17, 2014 Share Posted October 17, 2014 mujha offend nahi karna liken commandName variable ki zarovat nahi thi, directly type karla ta. Link to comment
Bilal135 Posted October 17, 2014 Share Posted October 17, 2014 mujha offend nahi karna liken commandName variable ki zarovat nahi thi, directly type karla ta. Kuch aise? addCommandHandler ("jop", givePedJetPack) function givePedJetPack(sot) outputChatBox("You've Got A JetPack", sot, 0, 255, 0) end Link to comment
DomesticCat Posted October 17, 2014 Author Share Posted October 17, 2014 JetPack aa to gaya hai, lekin meu chahata hoon ke use /rjop se remove bhi karoun aur chat meu likha aai ''Jet Pack Has Been Successfully Removed".. Link to comment
Bilal135 Posted October 17, 2014 Share Posted October 17, 2014 JetPack aa to gaya hai, lekin meu chahata hoon ke use /rjop se remove bhi karoun aur chat meu likha aai ''Jet Pack Has Been Successfully Removed".. Is code ko previous code meu add kar do ''end'' ke agge. addCommandHandler ("rjop", removePedJetPack) function removePedJetPack(sot) outputChatBox ("Jet Pack Has Been Successfully Removed", sot, 255, 0, 0) end Link to comment
Anubhav Posted October 17, 2014 Share Posted October 17, 2014 (edited) [lua] addCommandHandler ("jop", function(sot) givePedJetPack(sot) outputChatBox ("You've Got A Jet Pack", sot, 0, 255, 0) end ) addCommandHandler ("rjop", function(sot) removePedJetPack(sot) outputChatBox ("You've removed you Jet Pack", sot, 0, 255, 0) end ) Edited October 17, 2014 by Guest Link to comment
Bilal135 Posted October 17, 2014 Share Posted October 17, 2014 [lua] addCommandHandler ("jop", function(sot) givePedJetPack(sot) outputChatBox ("You've Got A Jet Pack", sot, 0, 255, 0) end ) addCommandHandler ("rop", function(sot) removePedJetPack(sot) outputChatBox ("You've removed you Jet Pack", sot, 0, 255, 0) end ) Scripting karne ke bohat se ways hain, mera bhi work karta hai. Link to comment
Anubhav Posted October 17, 2014 Share Posted October 17, 2014 [lua] addCommandHandler ("jop", function(sot) givePedJetPack(sot) outputChatBox ("You've Got A Jet Pack", sot, 0, 255, 0) end ) addCommandHandler ("rop", function(sot) removePedJetPack(sot) outputChatBox ("You've removed you Jet Pack", sot, 0, 255, 0) end ) Scripting karne ke bohat se ways hain, mera bhi work karta hai. tuna wrapper function bana diya, wo kuch or hi hein. wo sirf output karta hein nikal ta nahi! aur tu kabhi kabhi decrypted functions use karta hein < Link to comment
Bilal135 Posted October 17, 2014 Share Posted October 17, 2014 [lua] addCommandHandler ("jop", function(sot) givePedJetPack(sot) outputChatBox ("You've Got A Jet Pack", sot, 0, 255, 0) end ) addCommandHandler ("rop", function(sot) removePedJetPack(sot) outputChatBox ("You've removed you Jet Pack", sot, 0, 255, 0) end ) Scripting karne ke bohat se ways hain, mera bhi work karta hai. tuna wrapper function bana diya, wo kuch or hi hein. wo sirf output karta hein nikal ta nahi! aur tu kabhi kabhi decrypted functions use karta hein < Mein ne script ko test kiya hai aur ye perfectly kaam karti hai. Link to comment
Anubhav Posted October 17, 2014 Share Posted October 17, 2014 ara wa, chalta hein, tun ne to function ko overwrite kiya tha tho, Dhyan dene de, mein daktha hu Link to comment
Saml1er Posted October 18, 2014 Share Posted October 18, 2014 Is ne arguement sahi istimal kiya ta isliye overwrite kerke wo kaam ker raha tha. Proper method: _getPlayerName = getPlayerName -- copy the function local function getPlayerName (...) -- overwrite it local p = _getPlayerName ( ...) -- call the function we copied if p then -- True or no -- if true then... return p -- don't forget to return it can cause problems if you're loading scripts using loadstring("return CODE")() end end Anyway don't overwrite functions for such small things. This can can cause problems if you're calling the same function fir different script within same script. Link to comment
Bilal135 Posted October 18, 2014 Share Posted October 18, 2014 Is ne arguement sahi istimal kiya ta isliye overwrite kerke wo kaam ker raha tha.Proper method: _getPlayerName = getPlayerName -- copy the function local function getPlayerName (...) -- overwrite it local p = _getPlayerName ( ...) -- call the function we copied if p then -- True or no -- if true then... return p -- don't forget to return it can cause problems if you're loading scripts using loadstring("return CODE")() end end Anyway don't overwrite functions for such small things. This can can cause problems if you're calling the same function fir different script within same script. Muje pata chala ke mera previous code: addCommandHandler ("jop", givePedJetPack) function givePedJetPack(sot) outputChatBox("You've Got A JetPack", sot, 0, 255, 0) end message ko output nahi karta tha, lekin ye code kam karta hai. addCommandHandler ("jop", function(sot) givePedJetPack(sot) outputChatBox ("You've Got A Jet Pack", sot, 0, 255, 0) end ) Link to comment
Saml1er Posted October 18, 2014 Share Posted October 18, 2014 You added the command handler first that's why. Even this will work: addCommandHandler ("jop", givePedJetPack) But anyway just for mire explanation. This will work although it's pretty useless for using wrapper. local _givePedJetPack = givePedJetPack -- copy the function local function givePedJetPack (TheP) -- overwrite it local p = _givePedJetPack ( TheP ) -- call the function we copied if p then -- True or no outputChatBox ("You got a Jet Pack", TheP, 0, 255, 0) -- if true then... return p -- don't forget to return it can cause problems if you're loading scripts using loadstring("return CODE")() end end Link to comment
Bilal135 Posted October 18, 2014 Share Posted October 18, 2014 You added the command handler first that's why. Even this will work: addCommandHandler ("jop", givePedJetPack) But anyway just for mire explanation. This will work although it's pretty useless for using wrapper. local _givePedJetPack = givePedJetPack -- copy the function local function givePedJetPack (TheP) -- overwrite it local p = _givePedJetPack ( TheP ) -- call the function we copied if p then -- True or no outputChatBox ("You got a Jet Pack", TheP, 0, 255, 0) -- if true then... return p -- don't forget to return it can cause problems if you're loading scripts using loadstring("return CODE")() end end Urdu bolo please, aur scripting ke bohat se ways hain...sab ka apna apna way hota hai scripting karne ka. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now