Jump to content

Tema pasado


Plate

Recommended Posts

Posted

Hola recuerdan mi intento de systema de resets bueno la cosa es haci puse esto

exports [ "scoreboard" ]:scoreboardAddColumn ( "reset" ) 
function reset (thePlayer, command) 
 exports [ "exp_system" ]:setPlayerEXP (thePlayer, 0) 
   exports [ "exp_system" ]:setPlayerLevel (thePlayer, 1) 
   setElementData(thePlayer,"reset",0) 
end 
  
addCommandHandler ("Reset", reset ) 

y hasta hay me funciono osea el player resetea y le aparece el 0 pero cuando vuelve a resetear no funciona

Algo qe me puedan decir hacerca de esto?

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Facil:

exports [ "scoreboard" ]:scoreboardAddColumn ( "reset" ) 
function reset (thePlayer, command) 
 exports [ "exp_system" ]:setPlayerEXP (thePlayer, 0) 
   exports [ "exp_system" ]:setPlayerLevel (thePlayer, 1) 
local res = getElementData(thePlayer, reset) 
    if res >= 0 then 
   setElementData(thePlayer,"reset", res + 1) 
elseif not res then 
setElementData(thePlayer,"reset", 1) 
    end 
end 
addCommandHandler ("Reset", reset ) 

Developer @ MYVAL

Posted

SOS UN KPO Gracias alex muchas muchas gracias muchas gracias gracias gracias por terminarlo pero no da +1 de reset u.u

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted (edited)

Note algo, intenta asi:

exports [ "scoreboard" ]:scoreboardAddColumn ( "reset" ) 
function reset (thePlayer, command) 
 exports [ "exp_system" ]:setPlayerEXP (thePlayer, 0) 
   exports [ "exp_system" ]:setPlayerLevel (thePlayer, 1) 
local res = getElementData(thePlayer, "reset") 
   setElementData(thePlayer,"reset", res + 1) 
    end 
addCommandHandler ("Reset", reset ) 
  
function respawn ( ) 
setElementData(source,"reset", "0") 
addEventHandler ( "onPlayerJoin", getRootElement(), respawn ) 

pero mejor usa los Account Data

Edited by Guest

Developer @ MYVAL

Posted

alex pongo /Reset y me dice

reset/reset.lua:14: attempt to comparate number whit boolean 
reset/reset.lua:13: Bad argument @ "getElemetnData" [Expected string at argument 2 ,got function 

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
exports [ "scoreboard" ]:scoreboardAddColumn ( "reset" ) 
  
function reset ( thePlayer ) 
    exports [ "exp_system" ]:setPlayerEXP ( thePlayer, 0 ) 
    exports [ "exp_system" ]:setPlayerLevel ( thePlayer, 1 ) 
    local res = tonumber ( getElementData ( thePlayer, "reset" ) ) or 0 
    setElementData ( thePlayer, "reset", res + 1 ) 
end 
addCommandHandler ( "Reset", reset ) 
  
function respawn ( ) 
    setElementData ( source, "reset", 0 ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), respawn ) 

Acordate de que es server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

si solid esta en serverside pero me aparece devuelta lo mismo

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Ami me funciono a la perfeccion.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

listo nose por que pero empeso a andar :D gracias solid y alex

para poner que el player pueda resetear a un cierto level tendria que ser haci no miren

exports [ "scoreboard" ]:scoreboardAddColumn ( "reset" ) 
  
function reset ( thePlayer ) 
    exports [ "exp_system" ]:setPlayerEXP ( thePlayer, 0 ) 
    exports [ "exp_system" ]:setPlayerLevel ( thePlayer, 1 ) 
    exports [ "exp_system" ]:getPlayerLevel ( thePlayer, 32 ) 
    local res = tonumber ( getElementData ( thePlayer, "reset" ) ) or 0 
    setElementData ( thePlayer, "reset", res + 1 ) 
end 
addCommandHandler ( "Reset", reset ) 
  
function respawn ( ) 
    setElementData ( source, "reset", 0 ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), respawn ) 

haci o esta mal hay

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

pero para eso esta el setPlayerEXP y el setPlayerLevel no?

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

No, el getPlayerLvl no posee ese argumento, es asi:

exports [ "scoreboard" ]:scoreboardAddColumn ( "reset" ) 
  
function reset ( thePlayer ) 
    exports [ "exp_system" ]:setPlayerEXP ( thePlayer, 0 ) 
    exports [ "exp_system" ]:setPlayerLevel ( thePlayer, 32 ) 
    exports [ "exp_system" ]:getPlayerLevel ( thePlayer ) 
    local res = tonumber ( getElementData ( thePlayer, "reset" ) ) or 0 
    setElementData ( thePlayer, "reset", res + 1 ) 
end 
addCommandHandler ( "Reset", reset ) 
  
function respawn ( ) 
    setElementData ( source, "reset", 0 ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), respawn ) 

Developer @ MYVAL

Posted

pero hay seteraias para que el player con el comando /Reset suba automaticamente a el level 32

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Pense que es lo que buscabas, como pusiste un 32 en el get o quiza quieres quieres que solo pueda seteat al estar en lvl 32, para eso usa:

exports [ "scoreboard" ]:scoreboardAddColumn ( "reset" ) 
  
function reset ( thePlayer ) 
local actlvl = exports [ "exp_system" ]:getPlayerLevel ( thePlayer ) 
                if actlvl >= 32 then --Asi solo podran setear en lvl 32 o mayor 
    exports [ "exp_system" ]:setPlayerEXP ( thePlayer, 0 ) 
    exports [ "exp_system" ]:setPlayerLevel ( thePlayer, 1 ) 
    local res = tonumber ( getElementData ( thePlayer, "reset" ) ) or 0 
    setElementData ( thePlayer, "reset", res + 1 ) 
    end 
end 
addCommandHandler ( "Reset", reset ) 
  
function respawn ( ) 
    setElementData ( source, "reset", 0 ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), respawn ) 

Developer @ MYVAL

Posted

GRACIAS

saben encontre un recurso que esta muy bueno pero en el spotmanager tiene bug de

setElementData, getElementData 

--[[ 
/************************************************************** 
* 
* 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  
) 
  
  

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

  • Recently Browsing   0 members

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