Jump to content

سؤال عن فنكشن .؟


Recommended Posts

function getPedWeapons(ped) 
local playerWeapons = {} 
if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then 
for i=1,12 do 
local wep = getPedWeapon(ped,i); 
if wep and wep ~= 0 then 
table.insert(playerWeapons,wep); 
end 
end 
else 
return false 
end 
return playerWeapons 
end 

Link to comment

واجهت اخطاء هنا

  
  
  
  
  
addEventHandler("onResourceStart",root 
function ( ) 
executeSQLQuery("CREATE TABLE IF NOT EXISTS `SaveAcc` (Acc TEXT , Serial TEXT)") 
end 
) 
  
addEventHandler("onPlayerJoin",root 
function ( ) 
local Serial = getPlayerSerial(source) 
local Account = getPlayerAccount(source) 
local Results = executeSQLQuery("SELECT * FROM `SaveAcc` WHERE Acc=? WHERE Serial=?",Account,Serial) 
if ( type ( Results ) == "table" and #Results == 0 or not Results ) then 
local Accc = math.random(1,100000) 
executeSQLQuery ( "INSERT INTO `SaveAcc` (Acc,Serial) VALUES(?,?)",Accc,Serial) 
s = executeSQLQuery ("SELECT * FROM SaveAcc WHERE Acc =?",Accc) 
local GetAcc = s[1]["Acc"] 
addAccount(GetAcc,admin) 
logIn(source,GetAcc,admin) 
else 
logIn(source,Account,admin) 
end 
end 
) 
  
  

--

وهنا

  
addEventHandler("onClientKey",root, 
function( button ) 
if isElementWithinMarker(source,Marker) and button == "K" then 
triggerServerEvent("TakeAnyThing",localPlayer) 
elseif isElementWithinMarker(source,Marker) and button == "M" then 
triggerServerEvent("GiveMe",localPlayer) 
end 
) 
  

  
function Markres123() 
 for i,v in ipairs ( getElementsByType ( "vehicle" ) ) do  
  Marker = createMarker(0,0,0,"cylinder",4,0,0,255) 
  attachElements(v,Marker,0,0,4) 
 end 
end 
addEventHandler("onVehicleEnter",root,Markres123) 
addEventHandler("onResourceStart",root,Markres123) 
addEventHandler("onVehicleExit",root,Markres123) 
addEventHandler("onVehicleRespawn",root,Markres123) 
Markres123() 
  
function getPedWeaponss(Ped) 
 local Weapons 
 if getElementType(Ped) == "ped" then 
  Weapons = {} 
  for ID = 0, 40 do 
   if type(getPedAmmoInClip(Ped, ID)) == "number" and getPedAmmoInClip(Ped) ~= 0 then 
    table["insert"](Weapons, ID) 
   end 
  end 
  return Weapons 
 end 
end 
  
addEvent("TakeAnyThing",true) 
addEvent("TakeAnyThing",root,function() 
local Money = getPlayerMoney(source) 
local TableWeapons = {} 
local Weaons = getPedWeaponss(source) 
local Wammo = getPedAmmoInClip(source) 
table.insert(TableWeapons,Weaons) 
if Money == 0 then return end 
 if #TableWeapons == 0 then return end 
    setElementData(Marker,'DataMarker',Money,Weaons,Wammo) 
    takePlayerMoney(source,Money) 
    takeAllWeapons(source) 
end) 
  
  
addEvent("GiveMe",true) 
addEventHandler("GiveMe",root,function () 
if getElementData(Marker,'DataMarker') == 'true' then 
givePlayerMoney(source,Money) 
giveWeapon(source,Weapon,Wammo) 
end 
end) 
  

للمعلومه هناك مودين

Link to comment

اول كود انت وش تبي تسوي فيه بالضبط؟؟

ثاني كود :

السورس غير معرف , وناقصك اند, والماركر غير معرف الا اذا كان موجود داخل السكربت.

ثالث كود تراك مخبص بالدنيا ومسوي اشياء غلط ف غلط واستخدم هالكود عشان تجيب الاسلحه مع لوب طبعاً:

getPedWeapons = function ( ped ) 
    local playerWeapons = {  }; 
        if ped and isElement ( ped ) and getElementType ( ped ) == "ped" or getElementType ( ped ) == "player" then 
            for i = 0, 12 do 
            if i == 1 then i = 0 end 
                local wep = getPedWeapon ( ped, i ); 
                if wep and wep > 0 then 
                    table.insert ( playerWeapons, wep ); 
                end 
            end 
        else 
        return false 
        end 
        return playerWeapons 
    end 
Link to comment
واجهت اخطاء هنا
  
  
  
  
  
addEventHandler("onResourceStart",root 
function ( ) 
executeSQLQuery("CREATE TABLE IF NOT EXISTS `SaveAcc` (Acc TEXT , Serial TEXT)") 
end 
) 
  
addEventHandler("onPlayerJoin",root 
function ( ) 
local Serial = getPlayerSerial(source) 
local Account = getPlayerAccount(source) 
local Results = executeSQLQuery("SELECT * FROM `SaveAcc` WHERE Acc=? WHERE Serial=?",Account,Serial) 
if ( type ( Results ) == "table" and #Results == 0 or not Results ) then 
local Accc = math.random(1,100000) 
executeSQLQuery ( "INSERT INTO `SaveAcc` (Acc,Serial) VALUES(?,?)",Accc,Serial) 
s = executeSQLQuery ("SELECT * FROM SaveAcc WHERE Acc =?",Accc) 
local GetAcc = s[1]["Acc"] 
addAccount(GetAcc,admin) 
logIn(source,GetAcc,admin) 
else 
logIn(source,Account,admin) 
end 
end 
) 
  
  

--

وهنا

  
addEventHandler("onClientKey",root, 
function( button ) 
if isElementWithinMarker(source,Marker) and button == "K" then 
triggerServerEvent("TakeAnyThing",localPlayer) 
elseif isElementWithinMarker(source,Marker) and button == "M" then 
triggerServerEvent("GiveMe",localPlayer) 
end 
) 
  

  
function Markres123() 
 for i,v in ipairs ( getElementsByType ( "vehicle" ) ) do  
  Marker = createMarker(0,0,0,"cylinder",4,0,0,255) 
  attachElements(v,Marker,0,0,4) 
 end 
end 
addEventHandler("onVehicleEnter",root,Markres123) 
addEventHandler("onResourceStart",root,Markres123) 
addEventHandler("onVehicleExit",root,Markres123) 
addEventHandler("onVehicleRespawn",root,Markres123) 
Markres123() 
  
function getPedWeaponss(Ped) 
 local Weapons 
 if getElementType(Ped) == "ped" then 
  Weapons = {} 
  for ID = 0, 40 do 
   if type(getPedAmmoInClip(Ped, ID)) == "number" and getPedAmmoInClip(Ped) ~= 0 then 
    table["insert"](Weapons, ID) 
   end 
  end 
  return Weapons 
 end 
end 
  
addEvent("TakeAnyThing",true) 
addEvent("TakeAnyThing",root,function() 
local Money = getPlayerMoney(source) 
local TableWeapons = {} 
local Weaons = getPedWeaponss(source) 
local Wammo = getPedAmmoInClip(source) 
table.insert(TableWeapons,Weaons) 
if Money == 0 then return end 
 if #TableWeapons == 0 then return end 
    setElementData(Marker,'DataMarker',Money,Weaons,Wammo) 
    takePlayerMoney(source,Money) 
    takeAllWeapons(source) 
end) 
  
  
addEvent("GiveMe",true) 
addEventHandler("GiveMe",root,function () 
if getElementData(Marker,'DataMarker') == 'true' then 
givePlayerMoney(source,Money) 
giveWeapon(source,Weapon,Wammo) 
end 
end) 
  

للمعلومه هناك مودين

:arrowup::arrowup:

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...