Plate Posted June 7, 2012 Share Posted June 7, 2012 hola encontre este script en un link (un spotmanager) de spawnee aalgunos y deja de funcionar y sale Bad Argument aqui el script (serverside) --[[ /************************************************************** * * Script: Spot Management System * File: manager_server.lua * Version: 1.0.0 R3 * Date: 2012-05-26 * ***************************************************************/ --]] if not getResourceFromName("zombies") then return end local RADIUS = 10 local COUNT = 0 local SPOT = { } local ZOMBIESINSPOT = { } function setRadius(source,command,radius) if command == "setradius" then if not radius then return false end RADIUS = tonumber(radius) outputChatBox("You have set spot radius to " .. RADIUS,source) playSoundFrontEnd(source,41) end end addCommandHandler("setradius",setRadius) function setCSPOT(source,command,spot) if command == "setcurrentspot" then if not spot then return false end currentSpot = tonumber(spot) outputChatBox("You have set current spot to spot[" .. spot .. "]",source) playSoundFrontEnd(source,41) end end addCommandHandler("setcurrentspot",setCSPOT) function addZombieToSpot(source,command,spot,rot,skin,interior, dimension, level, maxhealth, boss) if command == "addzombie" then if not spot then return false end if not rot then rot = math.random (1,359) end if not skin then skin = 0 end if not interior then interior = 0 end if not dimension then dimension = 0 end if not level then level = 1 end if not maxhealth then maxhealth = 100 end if not boss then boss = false end currentSpot = tonumber(spot) local sx,sy,sz = getElementPosition(SPOT[currentSpot]) local sortZombies = RADIUS/1.2 local zom = exports.zombies:createZombie (sx+math.random(-sortZombies,sortZombies),sy+math.random(-sortZombies,sortZombies),sz+10,rot,skin,interior,dimension,level,maxhealth,boss) table.insert(ZOMBIESINSPOT,zom) setElementData(zom,"zombieSpot",SPOT[currentSpot]) outputChatBox("You have added '" .. getElementData(zom,"name") .. "' to spot[" .. spot .. "]",source) playSoundFrontEnd(source,41) end end addCommandHandler("addzombie",addZombieToSpot) -- ADD ZOMBIE GUI addEvent("addz",true) function addZgui(isboss,skin,interior,dimension,level,maxhp,name) if skin and interior and dimension and level and maxhp then rot = math.random (1,359) local sx,sy,sz = getElementPosition(SPOT[currentSpot]) local sortZombies = RADIUS/1.2 local zom = exports.zombies:createZombie (sx+math.random(-sortZombies,sortZombies),sy+math.random(-sortZombies,sortZombies),sz+10,rot,skin,interior,dimension,level,maxhp,isboss) table.insert(ZOMBIESINSPOT,zom) setElementData(zom,"zombieSpot",SPOT[currentSpot]) if name == "" then outputChatBox("You have added '" .. getElementData(zom,"name") .. "' to spot[" .. currentSpot .. "]",source) else outputChatBox("You have added '" .. name .. "' to spot[" .. currentSpot .. "]",source) setElementData(zom,"name",name) end end end addEventHandler( "addz", root, addZgui ) function destroySpot(source,command,spotToDestroy) if command == "destroyspot" then if currentSpot then if not spotToDestroy then spotToDestroy = currentSpot; currentSpotElem = SPOT[currentSpot] end local currentSpotElem = SPOT[tonumber(spotToDestroy)] if currentSpotElem and spotToDestroy then destroyElement(currentSpotElem) table.remove(SPOT,spotToDestroy) COUNT = COUNT - 1 outputChatBox("You have destroyed SPOT[" .. spotToDestroy .. "]",source) playSoundFrontEnd(source,41) else outputChatBox("SPOT[" .. spotToDestroy .. "] doesnt exist.",source) playSoundFrontEnd(source,41) end end end end addCommandHandler("destroyspot",destroySpot) function outputClick(mouseButton,buttonState,clickedElement,worldPosX,worldPosY,worldPosZ,screenPosX,screenPosY) if mouseButton == "right" and buttonState == "down" then local file = fileOpen("spots.lua",false) fileSetPos(file,fileGetSize(file)) COUNT = COUNT + 1 local written = fileWrite( file, '\n\r\nspot[' .. COUNT .. '] = createZombieSpot(' .. worldPosX .. ", " .. worldPosY .. ", " .. worldPosZ .. ", " .. RADIUS .. " )\r\n" ) if written then outputChatBox("You have created SPOT[" .. COUNT .. "]",source) playSoundFrontEnd(source,41) end --SPOT[COUNT] = createColSphere(worldPosX,worldPosY,worldPosZ,RADIUS) SPOT[COUNT],radius = exports.zombies:createZombieSpot(worldPosX,worldPosY,worldPosZ,RADIUS) setElementData(SPOT[COUNT],"radius",radius) --setElementData(SPOT[COUNT],"count",COUNT) currentSpot = COUNT fileFlush(file) end end addEventHandler("onPlayerClick",getRootElement(),outputClick) function markSpot() local spot = SPOT local currentspot = currentSpot local zombiesinspot = ZOMBIESINSPOT triggerClientEvent("markSpotC",root,spot,currentspot,zombiesinspot) end setTimer(markSpot,50,0) --DESTROYS CREATED ZOMBIES BY SPOT MANAGER function Zomb_delete (ped) if isElement(ped) then if (getElementData (ped, "zombie") == true) then for theKey,thePed in ipairs(ZOMBIESINSPOT) do if ped == thePed then table.remove( ZOMBIESINSPOT, theKey ) break end end destroyElement ( ped ) end end end addEventHandler ( "onResourceStop", getResourceRootElement(getThisResource()), function ( ) for k,zombie in ipairs(ZOMBIESINSPOT) do --table.remove( ZOMBIESINSPOT, k ) Zomb_delete(zombie) end end ) Link to comment
Plate Posted June 7, 2012 Author Share Posted June 7, 2012 Disculpame Soren me olvide de decirte Bad Argument setElementData [Expected element at argument 1, got boolean] Bad Argument getElementData [Expected element at argument 1, got boolean] Link to comment
Recommended Posts