Jump to content

[Ayuda] Crear Team por Gang


Narutimmy

Recommended Posts

Posted (edited)

hola a todos bueno ando haciendo un script, para que si tu gang tiene mas de 5 miembros se cree un team y te una a el, y que si ahi menos de 5 miembros en el se elimine, aun no lo pruebo pero quiero saber si esta bien.

Ademas Este Script solo va a unir al Integrante numero 6.. como puedo hacer que tambien una a los que ya estaban en el gang :S?

Gracias.

---TEAM GANG 
local nameTeam = getElementData(source,"gang") 
local Leader = getGangLeader (nameTeam) 
local GangMembers = getElementData(Leader,"gangslots") 
local random = math.random ( 0,255 ) 
local r,g,b = random,random,random 
  
---local teamAdmmin = {} 
function Gang (gangName) 
if teamAdmmin[thePlayer]  then 
setPlayerTeam ( source, getTeamFromName ( teamAdmmin ) ) 
elseif GangMembers > 5 then ---Numero de miembros minimo 
local teamAdmmin[thePlayer] = createTeam ( nameTeam, r, g, b ) 
setPlayerTeam ( source, getTeamFromName ( teamAdmmin ) ) 
end 
end 
addEvent ( "onPlayerJoinGang", true ) 
addEventHandler ( "onPlayerJoinGang", root, Gang ) 
  
---DestruirTEAM 
function eliminargang (gangName) 
if GangMembers < 5 then 
destroyElement ( teamAdmmin[thePlayer]  ) 
  
end 
end 
addEvent ( "onPlayerLeaveGang", true ) 
addEventHandler ( "onPlayerLeaveGang", root, eliminargang ) 

Edited by Guest

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
if teamAdmmin[thePlayer] then 

Que es esa linea?

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
if teamAdmmin[thePlayer] then 

Que es esa linea?

Se supone es para verificar si el team ya esta creado, sino cada que se una un nuevo miembro se crearia el team de nuevo no?.. corrigeme si me estoy equivocando

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

No tiene sentido eso.

1º "teamAdmmin" tendria que ser una tabla, y no la veo en ninguna parte, ademas la estas usando luego como un string.

2º "thePlayer" no esta definido en ninguna parte.

3º Tenes varias variables definidas incorrectamente.

Yo que vos revisaria todo el script o simplemente lo crearia de nuevo desde 0, ya que es un desastre.

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
No tiene sentido eso.

1º "teamAdmmin" tendria que ser una tabla, y no la veo en ninguna parte, ademas la estas usando luego como un string.

2º "thePlayer" no esta definido en ninguna parte.

3º Tenes varias variables definidas incorrectamente.

Yo que vos revisaria todo el script o simplemente lo crearia de nuevo desde 0, ya que es un desastre.

ok, Gracias, y como puedo hacer para agregar al team a todos los miembros del gang?

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Usa esos eventos que estabas usando en ese script.

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
Usa esos eventos que estabas usando en ese script.

Gracias, si no es molestia podrias ayudarme a corregirlo :S? no entiendo lo de que tendria que ser una tabla, y lo de definir thePlayer puedo cambiarlo por source?

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
---TEAM GANG 
local nameTeam = getElementData(source,"gang") 
local Leader = getGangLeader (nameTeam) 
local GangMembers = getElementData(Leader,"gangslots") 
local random = math.random ( 0,255 ) 
local r,g,b = random,random,random 
  
---local teamAdmmin = {} 
function Gang (thePlayer) 
if teamAdmmin[thePlayer]  then 
setPlayerTeam ( thePlayer, getTeamFromName ( teamAdmmin ) ) 
elseif GangMembers > 5 then ---Numero de miembros minimo 
local teamAdmmin[thePlayer] = createTeam ( nameTeam, r, g, b ) 
setPlayerTeam ( thePlayer, getTeamFromName ( teamAdmmin ) ) 
end 
end 
addEvent ( "onPlayerJoinGang", true ) 
addEventHandler ( "onPlayerJoinGang", root, Gang ) 
  
---DestruirTEAM 
function eliminargang () 
if GangMembers < 5 then 
destroyElement ( teamAdmmin  ) 
  
end 
end 
addEvent ( "onPlayerLeaveGang", true ) 
addEventHandler ( "onPlayerLeaveGang", root, eliminargang ) 

Ahí creo que te arreglé los thePlayer.

Te recomiendo crear tablas usando:

getPlayersByGang

Y para setearlo al team:

isGangMember

Espero haberte ayudado, suerte! Y concuerdo con Castillo ( El Script está un poco "raro" xD )

Currently developing for International Gaming Community - Join us!

  • Recently Browsing   0 members

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