Jump to content

Funcion para todos lo jugadores


Recommended Posts

hola, me harian el favor de ayudarme con una funcion que actue para todos los jugadores, es decir lo que estoy tratando de hacer es que al presionar un boton en un panel le quite las armas a todos lo jugadores

 

gracias

 

 

Edited by Juan_Camilo
Link to comment

Las funciones

OnClientGUIClick

TriggerServerEvent

TakeAllWeapons

es tan fácil, así que te di este ejemplo :

Cliente :

window = guiCreateWindow(504, 217, 399, 296, "", false)
guiWindowSetSizable(window, false)

take = guiCreateButton(63, 76, 258, 53, "", false, window)

addEventHandler('onClientGUIClick',root,
function()
if source == take then
triggerServerEvent('getPlayersWeapons',localPlayer)
end
end)

servidor

addEvent('getPlayersWeapons',true)
addEventHandler('getPlayersWeapons',root,
function()
takeAllWeapons(root)
outputChatBox('El administrador ha tomado todas las armas de los jugadores.',root,255,255,0)
end)

 

Edited by MrKAREEM
  • Thanks 1
Link to comment

Buenas!

Te recomendaría que intentaras hacer una función y que utilizaras guiSetVisible y guiGetVisible para poder mostrar / ocultar la ventana. En este caso, el código sigue siendo cliente debido a que actúas sobre una GUI (podría hacerse de otras formas, pero creo que es la más sencilla). Añade este código a la parte cliente que tengas, y usa /ventana para mostrar u ocultar la ventana.

function toggleWindow()
  if guiGetVisible(window) == true then
    guiSetVisible(window, false)
  else
    guiSetVisible(window, true)
  end
end
addCommandHandler("ventana", toggleWindow)

Como recomendación personal, para todo lo que quieras hacer necesitarás funciones. Aquí tienes el listado de todas las funciones, tanto de servidor como de cliente. La wiki es tu amigo ?

Funciones servidor: https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions

Funciones cliente: https://wiki.multitheftauto.com/wiki/Client_Scripting_Functions

Saludos!

  • Like 1
  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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