Jump to content

please ayudenme con esto :D


iFoReX

Recommended Posts

Posted

buee quiero crear un script para crear bases :D recien ago la base y pos quiero que me ayuden, quiero que se obtenga la pos del jugador y asi crear la base pero no entiendo mucho el setElementPosition ayudenme please :D

local posicion = setElementPosition ( source, posX, posY, posZ ) 
  
function RadarArea() 
  
local BaseRadar = createRadarArea ( posX, 705.67950439453, 40, -40, 0, 255, 0, 175 ) 
  
    end 
end 
  
addCommandHandler("startbase", radarArea) 

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

Eso esta todo mal.

function radarArea ( thePlayer, cmd, width, height ) 
    local width, height = tonumber ( width ), tonumber ( height ) 
    local posX, posY, posZ = getElementPosition ( thePlayer ) 
    local BaseRadar = createRadarArea ( posX, posY, width, height, 0, 255, 0, 175 ) 
end 
addCommandHandler ( "startbase", radarArea ) 

Comando: /startbase

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
getPlayerMoney -- Para verificar si el jugador tiene ese dinero. 
takePlayerMoney -- Para sacarle el dinero al jugador. 

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

me ayudarias a darle sentido a esto porfa ._.

local Dinero = { 12000, 23000, 18000 } 
  
function radarArea ( thePlayer, cmd ) 
local money = getPlayerMoney(thePlayer) 
    if ( table[ math.random ( #Dinero ) ] then                                 
  
    local posX, posY, posZ = getElementPosition ( thePlayer ) 
    local BaseRadar = createRadarArea ( posX, posY, -40, 40, 0, 255, 0, 0 ) 
end 
addCommandHandler ( "startbase", radarArea ) 

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted
local Dinero = { 12000, 23000, 18000 } 
  
function radarArea ( thePlayer, cmd ) 
    local money = getPlayerMoney ( thePlayer ) 
    local randomMoney = Dinero[ math.random ( #Dinero ) ] 
    if ( money >= randomMoney ) then 
        local posX, posY, posZ = getElementPosition ( thePlayer ) 
        local BaseRadar = createRadarArea ( posX, posY, -40, 40, 0, 255, 0, 0 ) 
        takePlayerMoney ( thePlayer, randomMoney ) 
    end 
end 
addCommandHandler ( "startbase", radarArea ) 

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
me ayudarias a darle sentido a esto porfa ._.
local Dinero = { 12000, 23000, 18000 } 
  
function radarArea ( thePlayer, cmd ) 
local money = getPlayerMoney(thePlayer) 
    if ( table[ math.random ( #Dinero ) ] then                                 
  
    local posX, posY, posZ = getElementPosition ( thePlayer ) 
    local BaseRadar = createRadarArea ( posX, posY, -40, 40, 0, 255, 0, 0 ) 
end 
addCommandHandler ( "startbase", radarArea ) 

A bueno....Que es esto? No entendi nada sinceramente jaja

WRS( World Racing Server) [server] = 8%

Posted

Buee... gracias por el cumplido ._. , quiero que las bases se creen con estos distintos costos, pero no se como aser para unirlos :c

EDIT : Solid en un rato veo si el tuyo funciono :D

EDIT 2: No funciona Solid :c

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted
local Dinero = { 12000, 23000, 18000 } 
  
function radarArea ( thePlayer, cmd ) 
    local money = getPlayerMoney ( thePlayer ) 
    local randomMoney = Dinero[ math.random ( #Dinero ) ] 
    if ( money >= randomMoney ) then 
        local posX, posY, posZ = getElementPosition ( thePlayer ) 
        local BaseRadar = createRadarArea ( posX, posY, -40, -40, 0, 255, 0, 0 ) 
        takePlayerMoney ( thePlayer, randomMoney ) 
        outputChatBox ( "Base creada!", thePlayer, 0, 255, 0 ) 
    else 
        outputChatBox ( "Usted no tiene $".. randomMoney .."!", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "startbase", radarArea ) 

Le agregue dos mensajes, si no tenes dinero, te lo dice, si tenes, te dice que se creo, el tamaño debe estar mal.

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
el tamaño debe estar mal.

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

me ayudarias a unirlos porfavor :D te lo agradeceria mucho que me re complico con los triggers porfa :D

Client-Side:

  
  
  
    function elText() 
        dxDrawText("La base terminara en getTimerDetails",562.0,320.0,727.0,340.0,tocolor(255,255,255,255),1.4,"default","left","top",false,false,false) 
        dxDrawText("BaseDefender",624.0,284.0,789.0,304.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("BaseDefender",624.0,269.0,789.0,289.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("BaseDefender",624.0,254.0,789.0,274.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("BaseDefender",624.0,237.0,789.0,257.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("BaseDefender",624.0,220.0,789.0,240.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("BaseDefender",623.0,202.0,788.0,222.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("Defensores de la Base",624.0,168.0,794.0,200.0,tocolor(255,255,255,255),1.4,"default","left","top",false,false,false) 
    end 
) 
  
addEventHandler("onClientRender", ElText) 

EL CLIENTSIDE ME DICE QUE TIENE UN ) malo pero no se donde anda algo mal :c

ServerSide :

local Dinero = { 12000, 23000, 18000 } 
  
function radarArea ( thePlayer, cmd ) 
    local money = getPlayerMoney ( thePlayer ) 
    local randomMoney = Dinero[ math.random ( #Dinero ) ] 
    if ( money >= randomMoney ) then 
        local posX, posY, posZ = getElementPosition ( thePlayer ) 
        local BaseRadar = createRadarArea ( posX, posY, 80, -80, 0, 255, 0, 175 ) 
        takePlayerMoney ( thePlayer, randomMoney ) 
        outputChatBox ( "Base creada!", thePlayer, 0, 255, 0 ) 
    else 
        outputChatBox ( "Usted no tiene $".. randomMoney .."!", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "startbase", radarArea ) 

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

Mira, vos haces cosas aleatorias y queres que los de mas te hagan el verdadero script, empeza a estudiar como funciona Lua.

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

mm... listo ya ise todo ._. pero me ayudarian a corregirlo ? es que me sigue sin salir el texto :

server-Side

local Dinero = { 12000, 23000, 18000 } 
  
function radarArea ( thePlayer, cmd ) 
  
    local money = getPlayerMoney ( thePlayer ) 
    local randomMoney = Dinero[ math.random ( #Dinero ) ] 
    if ( money >= randomMoney ) then 
        local posX, posY, posZ = getElementPosition ( thePlayer ) 
        local BaseRadar = createRadarArea ( posX - 10, posY - 10, 80, -80, 0, 255, 0, 175 ) 
   local myBlip = createBlipAttachedTo ( BaseRadar, 25 ) 
        takePlayerMoney ( thePlayer, randomMoney ) 
        outputChatBox ( "Base creada!", thePlayer, 0, 255, 0 ) 
   for k,v in ipairs(getElementsByType("player")) do 
      addPlayerBaseText(v) 
   end 
    else 
        outputChatBox ( "Usted no tiene $".. randomMoney .."!", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "empezarbase", radarArea ) 
  
function addPlayerBaseText(player) 
  
   setElementData(player,"baseText","La base terminara en getTimerDetails\n\nBaseDefender #1\n\nBaseDefender #2\n\nBaseDefender #3\n\nBaseDefender #4\n\nBaseDefender #5\n\nBaseDefender #6\n\nDefensores de la Base",true) 
end 
  
function stopScript () 
  
   for k,v in ipairs(getElementsByType("player")) do 
      setElementData(v,"baseText",nil)  
   end 
end 
addEventHandler( "onResourceStop", getResourceRootElement(getThisResource()), stopScript) 

Client-Side :

function(drawMyStuff) 
  
   local baseText = getElementData(player,"baseText") 
   if baseText then 
           dxDrawText(baseText,562.0,320.0,727.0,340.0,tocolor(255,255,255,255),1.4,"default","left","top",false,false,false)    
   end 
end 
addEventHandler("onClientRender",root,drawMyStuff) 

Porfas ayudenme e intentado de todo ._.

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted
uso element data para unir el server con el cient ._.

Si me di cuenta, que no te digo que este mal...Pero vos queres que ese mensaje que pones en el Element Data, se los envie a todos o solamente al que creo lo base?

WRS( World Racing Server) [server] = 8%

Posted
q cosa ?

Jaja el ElementData....

Mira te lo defino

Vos queres que aparezca un mensaje DX cuando creas la base, entonces usaste el Element Data para poder poner el mensaje en el lado del cliente. Hasta ahi bien.

Yo te pregunto, vos pusiste

for i,v in ipairs(getElementsByType("player") do 
addPlayerBaseText(v) 
end 
  

Eso lo que hace es que el setElementData se los guarde A TODOS LOS JUGADORES, POR LO TANTO, el mensaje les llega a todos. Eso es lo que buscas?

WRS( World Racing Server) [server] = 8%

Posted
Seep

Entonces, mira el error :

  
function(drawMyStuff) 
  
   local baseText = getElementData(localPlayer,"baseText") -- No definistes el "player", que es obviamente el jugador local 
   if baseText then 
           dxDrawText(baseText,562.0,320.0,727.0,340.0,tocolor(255,255,255,255),1.4,"default","left","top",false,false,false)   
   end 
end 
addEventHandler("onClientRender",root,drawMyStuff) 
  

Sin embargo, esto no esta del todo bien.. Porque?

En clientRender, va a seguir funcionando hasta que se termine el resource, entonces si vos queres que ese mensaje sea temporal y desaparezca tenes que usar dos funciones

setTimer() 
removeEventHandler() -- Este dentro del timer 

Lee bien los argumentos de ambos.

WRS( World Racing Server) [server] = 8%

Posted

La primero razon porque esta mal, es porque el nombre de la funcion esta mal puesto.

function drawMyStuff ( -- Aca van los argumentos ) 
  
   local baseText = getElementData(localPlayer,"baseText") -- No definistes el "player", que es obviamente el jugador local 
   if baseText then 
           dxDrawText(baseText,562.0,320.0,727.0,340.0,tocolor(255,255,255,255),1.4,"default","left","top",false,false,false)   
   end 
end 
addEventHandler("onClientRender",root,drawMyStuff) 

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.

  • Recently Browsing   0 members

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