Szerző Téma: Basicrp script weaponsave  (Megtekintve 1503 alkalommal)

Basicrp script weaponsave
« Dátum: 2014. június 26. - 21:57:52 »
0 Show voters
Hali mindenki,a basicrp-ben van egy adminduty parancs.Ezzel nincs baj,működik de fel szeretném túrózni ;)
Találtam egy scriptet http://community.multitheftauto.com/index.php?p=resources&s=details&id=5812 egy helyen látsik is,hogy megpróbáltam beillszteni,de persze nem sikerült :D
Itt a rész:
 
-- ~ [ADMINDUTY] ~ --
addCommandHandler(\"adminduty\",
function(player, cmd)
if exports.brpExports:isPlayerAdmin(player) then
   if getElementData(player, \"admin.duty\") == 1 then
      setPlayerNametagColor(player, 255, 255, 255)
      setElementData(player, \"admin.duty\", 0)
      outputServerLog(\"[ADMIN] [CMD/ADMINDUTY]: \" .. getPlayerName(player) .. \" went off duty.\")
      for i,v in ipairs(getElementsByType(\"player\")) do
         if exports.brpExports:isPlayerAdmin(v) then
            outputChatBox(getPlayerName(player) .. \" went off duty.\", v, 255, 0, 0, false)                  
            exports.notifications:showBox (\"info\",exports.notifications:showBox (\"info\",\"(getPlayerName(player) .. \")\"adminszolgáltaba lépett\")
         end
      end
   else
      setPlayerNametagColor(player, 255, 255, 0)
      setElementData(player, \"admin.duty\", 1)
      outputServerLog(\"[ADMIN] [CMD/ADMINDUTY]: \" .. getPlayerName(player) .. \" came on duty.\")
      for i,v in ipairs(getElementsByType(\"player\")) do
         if exports.brpExports:isPlayerAdmin(v) then
            outputChatBox(getPlayerName(player) .. \" came on duty.\", v, 255, 0, 0, false)
         end
      end
   end
end
end
)
« Utoljára szerkesztve: 2014. június 26. - 22:38:48 írta botiapa »

Basicrp script weaponsave
« Válasz #1 Dátum: 2014. június 26. - 22:07:42 »
0 Show voters
addCommandHandler(\"adminduty\",
function(player, cmd)
if exports.brpExports:isPlayerAdmin(player) then
   if getElementData(player, \"admin.duty\") == 1 then
      setPlayerNametagColor(player, 255, 255, 255)
      setElementData(player, \"admin.duty\", 0)
      outputServerLog(\"[ADMIN] [CMD/ADMINDUTY]: \" .. getPlayerName(player) .. \" went off duty.\")
      for i,v in ipairs(getElementsByType(\"player\")) do
         if exports.brpExports:isPlayerAdmin(v) then
            exports.notifications:showBox(getRootElement(), \"info\", \"\" .. getPlayerName(player) .. \" kilépett a szolgálatból.\")
         end
      end
   else
      setPlayerNametagColor(player, 255, 255, 0)
      setElementData(player, \"admin.duty\", 1)
      outputServerLog(\"[ADMIN] [CMD/ADMINDUTY]: \" .. getPlayerName(player) .. \" came on duty.\")
      for i,v in ipairs(getElementsByType(\"player\")) do
         if exports.brpExports:isPlayerAdmin(v) then
            exports.notifications:showBox(getRootElement(), \"info\", \"\" .. getPlayerName(player) .. \" adminszolgálatba lépett!\")
         end
      end
   end
end
end
)

 
Hiba a notifications:showbox lekérés volt, mivel az adminduty server fájlban van ezért lekell kérni hogy kinek jelezze.
thePlayer = Az adott játékos
getRootElement() = Mindenkinek
targetPlayer(lekéréssel együtt müködik) = Cél játékos
localPlayer = Helyi játékos
De admindutynál általába getRootElement()-et szoktak írni.
UI:Szerkesztettem, kihagytam 2 sort!
« Utoljára szerkesztve: 2014. június 26. - 22:11:39 írta Exmine »

Basicrp script weaponsave
« Válasz #2 Dátum: 2014. június 26. - 22:18:54 »
0 Show voters
Nagyon köszi,segítenél még egy picit?  :-\\
Van itt egy másik rész,csak annyi a lényege,egy adott játékosnak ad egy fegyvert,egy másik aprancs pedig ammot.
 
-- ~ [GIVEWEAPON, GIVEWEP, GIVEGUN, MAKEWEAPON, MAKEGUN] ~ --
addCommandHandler({\"giveweapon\", \"givewep\", \"givegun\", \"makeweapon\", \"makegun\"},
function(player, cmd, name, weapon)
if exports.brpExports:isPlayerLeadAdmin(player) then
   if name and weapon then
      local target = exports.brpExports:findPlayer(name, player)
      if target then
         if tonumber(weapon) then
            local weaponName = getWeaponNameFromID(weapon)
            giveWeapon(target, weapon, 1, true)
            for i,v in ipairs(getElementsByType(\"player\")) do
               if exports.brpExports:isPlayerAdmin(v) then
                  outputChatBox(\"[Wep]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" a weapon (\" .. weaponName .. \").\", v, 255, 0, 0, false)
               end
            end
            outputServerLog(\"[ADMIN] [CMD/GIVEWEAPON]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" a weapon (\" .. weaponName .. \")\")
         else
            local weaponID = getWeaponIDFromName(weapon)
            local weaponIDName = getWeaponNameFromID(weaponID)
            giveWeapon(target, weaponID, 1, true)
            for i,v in ipairs(getElementsByType(\"player\")) do
               if exports.brpExports:isPlayerAdmin(v) then
                  outputChatBox(\"[Wep]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" a weapon (\" .. weaponIDName .. \").\", v, 255, 0, 0, false)
               end
            end
            outputServerLog(\"[ADMIN] [CMD/GIVEWEAPON]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" a weapon (\" .. weaponIDName .. \")\")
         end
      else
         outputChatBox(\"No players or multiple were found.\", player, 255, 0, 0, false)
      end
   else
      outputChatBox(\"Syntax: /\" .. cmd .. \" <player> <weapon>\", player, 220, 220, 0, false)
   end
end
end
)
-- ~ [GIVEWEAPONAMMO, GIVEAMMO, GIVEWEPAMMO, MAKEAMMO, GIVEGUNAMMO] ~ --
addCommandHandler({\"giveweaponammo\", \"giveammo\", \"givewepammo\", \"makeammo\", \"givegunammo\"},
function(player, cmd, name, ammo, weapon)
if exports.brpExports:isPlayerLeadAdmin(player) then
   if name and ammo and weapon then
      if tonumber(ammo) then
         local target = exports.brpExports:findPlayer(name, player)
         if target then
            if tonumber(weapon) then
               local weaponName = getWeaponNameFromID(weapon)
               giveWeapon(target, weapon, ammo, true)
               for i,v in ipairs(getElementsByType(\"player\")) do
                  if exports.brpExports:isPlayerAdmin(v) then
                     outputChatBox(\"[WepAmmo]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" bullets (\" .. ammo .. \") to a weapon (\" .. weaponName .. \").\", v, 255, 0, 0, false)
                  end
               end
               outputServerLog(\"[ADMIN] [CMD/GIVEWEAPONAMMO]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" bullets (\" .. ammo .. \") to a weapon (\" .. weaponName .. \").\")
            else
               local weaponID = getWeaponIDFromName(weapon)
               local weaponIDName = getWeaponNameFromID(weaponID)
               giveWeapon(target, weaponID, ammo, true)
               for i,v in ipairs(getElementsByType(\"player\")) do
                  if exports.brpExports:isPlayerAdmin(v) then
                     outputChatBox(\"[WepAmmo]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" bullets (\" .. ammo .. \") to a weapon (\" .. weaponIDName .. \").\", v, 255, 0, 0, false)
                  end
               end
               outputServerLog(\"[ADMIN] [CMD/GIVEWEAPONAMMO]: \" .. getPlayerName(player) .. \" gave \" .. getPlayerName(target) .. \" bullets (\" .. ammo .. \") to a weapon (\" .. weaponIDName .. \").\")
            end
         else
            outputChatBox(\"No players or multiple were found.\", player, 255, 0, 0, false)
         end
      else
         outputChatBox(\"Syntax: /\" .. cmd .. \" <player> <ammo> <weapon>\", player, 220, 220, 0, false)
      end
   else
      outputChatBox(\"Syntax: /\" .. cmd .. \" <player> <ammo> <weapon>\", player, 220, 220, 0, false)
   end
end
end
)

 
Ez is működik,de nem menti el ha kilépek!Mindent elment kivéve az ammot,és a fegyvert:
 
function saveAccount(player)
local account = getPlayerAccount(player)
if isGuestAccount(account) then return end
local money = getPlayerMoney(player)
local bank = getElementData(player, \"account.bank\")
local faction = getElementData(player, \"factions.player\")
local fname = getElementData(player, \"factions.fplayer\")
local factionleader = getElementData(player, \"factions.leader\")
local health = getElementHealth(player)
local armor = getPedArmor(player)
local x, y, z = getElementPosition(player)
local interior = getElementInterior(player)
local dimension = getElementDimension(player)
local model = getElementModel(player)
local rx, ry, rz = getElementRotation(player)
setAccountData(account, \"basicrp.money\", tonumber(money))
setAccountData(account, \"basicrp.bank\", tonumber(bank))
setAccountData(account, \"basicrp.factionleader\", tonumber(factionleader))
setAccountData(account, \"basicrp.faction\", tonumber(faction))
setAccountData(account, \"basicrp.fname\", tostring(fname))
setAccountData(account, \"basicrp.health\", tonumber(health))
setAccountData(account, \"basicrp.armor\", tonumber(armor))
setAccountData(account, \"basicrp.model\", tonumber(model))
setAccountData(account, \"basicrp.interior\", tonumber(interior))
setAccountData(account, \"basicrp.dimension\", tonumber(dimension))
setAccountData(account, \"basicrp.posx\", tonumber(x))
setAccountData(account, \"basicrp.posy\", tonumber(y))
setAccountData(account, \"basicrp.posz\", tonumber(z))
setAccountData(account, \"basicrp.rotx\", tonumber(rx))
setAccountData(account, \"basicrp.roty\", tonumber(ry))
setAccountData(account, \"basicrp.rotz\", tonumber(rz))
end

Basicrp script weaponsave
« Válasz #3 Dátum: 2014. június 27. - 01:29:18 »
0 Show voters
function saveAccount(player)
local account = getPlayerAccount(player)
if isGuestAccount(account) then return end
local money = getPlayerMoney(player)
local bank = getElementData(player, \"account.bank\")
local faction = getElementData(player, \"factions.player\")
local fname = getElementData(player, \"factions.fplayer\")
local factionleader = getElementData(player, \"factions.leader\")
local health = getElementHealth(player)
local armor = getPedArmor(player)
local x, y, z = getElementPosition(player)
local interior = getElementInterior(player)
local dimension = getElementDimension(player)
local model = getElementModel(player)
local rx, ry, rz = getElementRotation(player)
        local weapons = getElementData(player, \"weapons\")
        local ammo = getElementData(player, \"ammo\")
setAccountData(account, \"basicrp.money\", tonumber(money))
setAccountData(account, \"basicrp.bank\", tonumber(bank))
setAccountData(account, \"basicrp.factionleader\", tonumber(factionleader))
setAccountData(account, \"basicrp.faction\", tonumber(faction))
setAccountData(account, \"basicrp.fname\", tostring(fname))
setAccountData(account, \"basicrp.health\", tonumber(health))
setAccountData(account, \"basicrp.armor\", tonumber(armor))
setAccountData(account, \"basicrp.model\", tonumber(model))
setAccountData(account, \"basicrp.interior\", tonumber(interior))
setAccountData(account, \"basicrp.dimension\", tonumber(dimension))
setAccountData(account, \"basicrp.posx\", tonumber(x))
setAccountData(account, \"basicrp.posy\", tonumber(y))
setAccountData(account, \"basicrp.posz\", tonumber(z))
setAccountData(account, \"basicrp.rotx\", tonumber(rx))
setAccountData(account, \"basicrp.roty\", tonumber(ry))
setAccountData(account, \"basicrp.rotz\", tonumber(rz))
        setAccountData(account, \"basicrp.weapons\", tonumber(weapons))
        setAccountData(account, \"basicrp.ammo\", tonumber(ammo))
end

 
hát próbáld ezt. bár nem vagyok 100%-ig biztos benne

Basicrp script weaponsave
« Válasz #4 Dátum: 2014. június 27. - 10:51:44 »
0 Show voters
Sajnos,nem megy,nem ír semmi hibát.

Elérhető Legend

  • Adminisztrátor
  • 1830
    • Profil megtekintése
Basicrp script weaponsave
« Válasz #5 Dátum: 2014. július 25. - 17:24:32 »
0 Show voters
[admin]Elég rég nem érkezett már hozzászólás, így zárom.[/admin]

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal