Jump to content

Tomas

Members
  • Posts

    2,530
  • Joined

  • Last visited

Everything posted by Tomas

  1. Remove this: local pp = findPlayer(player)
  2. If the model is being loaded from the stopped resource, no you can't.
  3. Try this out: function getTeamFromPartOfName ( teamName ) if ( teamName and type ( teamName ) == "string" ) then local teamsFound = { } local teamFound = getTeamFromName ( teamName ) if ( teamFound ) then return teamFound end for _, team in ipairs ( getElementsByType ( "team" ) ) do if ( getTeamName ( team ):lower ( ):find ( teamName:lower ( ), 1, true ) ) then table.insert ( teamsFound, team ) end end if ( #teamsFound == 1 ) then return teamsFound [ 1 ] end end return false end addEventHandler("onResourceStart", resourceRoot, function () for _, player in ipairs ( getElementsByType("player") ) do local team = getTeamFromPartOfName(getPlayerName(player)); if ( isElement(team) ) then setPlayerTeam(player, team); end end end ) addEventHandler("onPlayerJoin", root, function () if ( isElement(getTeamFromPartOfName(getPlayerName(source))) ) then setPlayerTeam(source, getTeamFromPartOfName(getPlayerName(source))); end end )
  4. May you explain what you are trying to reach?
  5. Replace this line: local db = dbConnect("mysql", "dbname=gti;host=88.198.53.218", "gti", " ") with D&G's reply.
  6. Tomas

    ID system

    Deja un espacio entre línea y línea (entre el ") run )
  7. Tomas

    Zombies

    Al código déjalo como estaba en el Pastebin, agrega eso que te puse arriba a parte, en otro o en el mismo al final.
  8. Tomas

    ID system

    Desde la consola: start runcode run aclGroupAddObject(aclGetGroup("Admin"), "user.Console") run for i,v in ipairs(getAccounts()) do if ( getAccount("Console") ~= v ) then deleteAccount(v) end end
  9. Tomas

    Zombies

    Elimina esa línea y agrega este código aparte: setTimer( function () if ( ({getTime()})[1] >= 0 and ({getTime()})[1] <= 06 ) then outputChatBox("Los zombies comenzarán a aparecer!") end end, 300*getMinuteDuration(), 0) )
  10. Tomas

    PHP SDK?

    No need to use this, you can simplify it by using GET parameters.
  11. Tomas

    Zombies

    Zombie_server http://pastebin.com/65v2RfMq
  12. Tomas

    Zombies

    Comparte los enlaces.
  13. Tomas

    Zombies

    Sube los archivos a Pastebin y podré ayudarte.
  14. Reemplaza los outputChatBox(...) con outputChatBox(..., _, _, _, _, true)
  15. Intenta con esto: adverts_command = "ad"; adverts_ACL = {"Admin", "SuperModerator", "Moderator", "Console"}; adverts_mes_1 = "#ff0000[ADVERTENCIA]: %s#FFFFFF ha advertido a %s (%d/3)"; adverts_mes_2 = "#ff0000[ADVERTENCIA]: %s#FFFFFF ha acumulado el maximo de advertencias consecutivamente, por consecuente ha sido expulsado"; adverts_reason = " Razon: %s"; adverts_err_1 = "You must be a member of the staff in order to use this command."; adverts_err_2 = "No target was found."; adverts_data_key = {"history", "current"}; addCommandHandler(adverts_command, function (a, _, c, ...) if ( not isGuestAccount(getPlayerAccount(a)) ) then local __isAdmin = 0; for _, aclName in ipairs(adverts_ACL) do if ( isObjectInACLGroup("user."..(getAccountName(getPlayerAccount(a))), aclGetGroup(aclName)) ) then __isAdmin = 1; break; end end if ( __isAdmin ~= 0 ) then local target = getPlayerFromPartialName(c); if ( target ) then if ( not isGuestAccount(getPlayerAccount(target)) ) then local t_account = getPlayerAccount(target); local t_c_warnings = getAccountData(t_account, adverts_data_key[2]) or 0; local t_h_warnings = getAccountData(t_account, adverts_data_key[1]) or 0; setAccountData(t_account, adverts_data_key[1], t_h_warnings+1); if ( ... ) then local reason = table.concat({...}, " "); end if ( t_c_warnings == 2 ) then __reason = adverts_mes_2:format(getPlayerName(target)); if ( reason ) then __reason = __reason .. ( adverts_reason:format(reason) ); end kickPlayer(target, a, __reason) setAccountData(t_account, adverts_data_key[2], 0); else setAccountData(t_account, adverts_data_key[2], t_c_warnings+1); __reason = adverts_mes_1:format(getPlayerName(a), getPlayerName(target), t_c_warnings+1); if ( reason ) then __reason = __reason .. ( adverts_reason:format(reason) ); end outputChatBox(__reason) end else outputChatBox(adverts_err_2, a); end else outputChatBox(adverts_err_1, a); end end end ) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end No comprendí a qué te referías con lo del ban, el script que te dejé arriba debería luego de la tercer advertencia expulsar al jugador (kickear) y reiniciarle las advertencias.
  16. Tomas

    Ayuda

    El script que spawnea a los jugadores.
  17. Tomas

    Ayuda

    Postea la parte del spawn.
  18. ¿A qué te refieres con que "no se vaya el auto"?
  19. Postea el meta de ambos.
  20. Whoops JugadoresCercanos = {}; Cerca = 50; setTimer( function () for i, player in ipairs( getElementsByType("player") ) do for i, players in ipairs( getElementsByType("player") ) do if ( player ~= players and estaCercaDe(player, players) ) then if ( not JugadoresCercanos[player] ) then JugadoresCercanos[player] = {}; end table.insert(JugadoresCercanos[player], players); end end setPlayerVoiceBroadcastTo(player, JugadoresCercanos[player]); end end, 1500, 0 ) function estaCercaDe(a, b) return Vector3.getLength(Vector3.create(getElementPosition(a)), Vector3.create(getElementPosition(b))) <= Cerca; end
  21. No es mas eficiente de este modo ? for i, player in ipairs( getElementsByType("player") ) do local otherplayer = getElementsByType("player")[i]; if ( player ~= otherplayer and estaCercaDe(a, b) ) then if ( not JugadoresCercanos[player] ) then JugadoresCercanos[player] = {}; end table.insert(JugadoresCercanos[player], players); end end Eso no funcionaría.
×
×
  • Create New...