MontiVante Posted October 6, 2017 Share Posted October 6, 2017 Español Hola necesito Ayuda de como hacer un script para poner comandos a los team yo tengo un server de Zombies el problema que no se como hacer el sccript Ejemplo: yo quiero poner el comandos /chaleco a el Team Militar cuando un jugador nponga el comandos aparecera con el 50 de vida otra cosa que seria es /dsawn es poner la arma uzi recortada o tec-9 en doble que uno pueda tener algunas de esas armas en la mano del jugador si con otra cosa podrian ayudarme es como poner jetpack a el team por favor expliquenme me pueden dejar la funcion en sus comentarios por favor para mi seria de un agrado English Hi, I need help with how to make a script to put commands to the team. I have a Zombies server. The problem is that I do not know how to do the sccript. Example: I want to put the commands /armor to the Military Team when a player sends the commands. The 50th of another serious thing is /dsawn is to put the uzi clipped weapon or tec-9 in double that one can have some of those weapons in the player's hand if with another thing they could help me it is like putting jetpack to the team by Please explain to me I can leave the function in your comments please for my serious pleasure Link to comment
Rose Posted October 6, 2017 Share Posted October 6, 2017 (edited) Spanish section: https://forum.multitheftauto.com/forum/166-spanish-español/ Prueba algo así. function militarCommands( player, cmd ) local playerTeam = getPlayerTeam( player ) if ( getTeamName( playerTeam ) == "Militar" ) then if ( cmd == "uzi" ) then giveWeapon( player, ID ) elseif ( cmd == "jetpack" ) then -- bla bla elseif ( cmd == "armor" ) then -- bla bla end end end addCommandHandler("uzi", militarCommands) addCommandHandler("armor", militarCommands) addCommandHandler("jetpack", militarCommands) -- Las otras funciones que debes usar son 'setPedArmor' y 'doesPedHaveJetPack' (o algo así) Edited October 6, 2017 by Rose 2 Link to comment
MontiVante Posted October 6, 2017 Author Share Posted October 6, 2017 thanks bro----gracias bro Link to comment
MontiVante Posted October 6, 2017 Author Share Posted October 6, 2017 Oye por no molestarte o algo asi, podrias hacerme la funcion completa :'c porque hay me dice que bisque "-- Las otras funciones que debes usar son 'setPedArmor' y 'doesPedHaveJetPack' (o algo así)---"que busque setPedArmor busque la funcion la puse con la funcion de me enviaste y la puse en mi servidor y no me funciono cunado puse /armor que hago dime. Link to comment
Rose Posted October 7, 2017 Share Posted October 7, 2017 function militarCommands( player, cmd ) local playerTeam = getPlayerTeam( player ) if ( getTeamName( playerTeam ) == "Militar" ) then if ( cmd == "uzi" ) then giveWeapon( player, 28, 9999 ) elseif ( cmd == "jetpack" ) then if ( not doesPedHaveJetPack( player ) ) then givePedJetPack( player ) else removePedJetPack( player ) end elseif ( cmd == "armor" ) then setPedArmor( player, 100 ) end end end addCommandHandler("uzi", militarCommands) addCommandHandler("armor", militarCommands) addCommandHandler("jetpack", militarCommands) Obviamente debes tener el team "Militar" ya creado. Espero lo entiendas. 1 Link to comment
MontiVante Posted October 7, 2017 Author Share Posted October 7, 2017 gracias hermano ahora si ya gracais por hacerme la funcion a si por cierto yo se que toca hacer la funcion del team Militar Link to comment
MontiVante Posted October 7, 2017 Author Share Posted October 7, 2017 (edited) function jetpack( Player, commandName ) local playerTeam = getPlayerTeam( Player ) if ( getTeamName( playerTeam ) == "Militar" ) then if ( doesPedHaveJetPack ( Player ) ) then removePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) else givePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) end end bindKey('j', 'down', jetpack) addCommandHandler('jetpack', jetpack) addCommandHandler('jp', jetpack) hola mira es que yo hice esto en jetpack para que sirviera el bindKey porque la funcion que me pasaste el jetpack solo sirve para comando no para bindkey y he echo muchas funciones para que sirva y ninguna me ha servido y quisiera saber si me podrias ayudar Edited October 7, 2017 by santinet12 Link to comment
MontiVante Posted October 7, 2017 Author Share Posted October 7, 2017 7 hours ago, santinet12 said: function jetpack( Player, commandName ) local playerTeam = getPlayerTeam( Player ) if ( getTeamName( playerTeam ) == "Militar" ) then if ( doesPedHaveJetPack ( Player ) ) then removePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) else givePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) end end bindKey('j', 'down', jetpack) addCommandHandler('jetpack', jetpack) addCommandHandler('jp', jetpack) hola mira es que yo hice esto en jetpack para que sirviera el bindKey porque la funcion que me pasaste el jetpack solo sirve para comando no para bindkey y he echo muchas funciones para que sirva y ninguna me ha servido y quisiera saber si me podrias ayudar Link to comment
Rose Posted October 7, 2017 Share Posted October 7, 2017 bindKey en server-side tiene como primer argumento el jugador al que le bindearas la tecla: bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] ) Lo que debes hacer es usar onPlayerJoin y bindearle la tecla al jugador que entró, algo así: addEventHandler("onPlayerJoin", root, function() bindKey( source, "J", "down", tufuncion ) end ) Y con eso en teoría debería funcionar bien. Si no entiendes algo avisa y con gusto te explico. Link to comment
MontiVante Posted October 7, 2017 Author Share Posted October 7, 2017 una pregunta sin ofender no te enojas por que yo te moleste :v lo siento por molestarte function militarCommands( player, cmd ) local playerTeam = getPlayerTeam( player ) if ( getTeamName( playerTeam ) == "Militar" ) then if ( cmd == "uzi" ) then giveWeapon( player, 28, 200 ) elseif ( cmd == "jetpack" ) then if ( not doesPedHaveJetPack( player ) ) then givePedJetPack( player ) else removePedJetPack( player ) end elseif ( cmd == "armor" ) then setPedArmor( player, 70 ) end end end addCommandHandler("uzi", militarCommands) addCommandHandler("armor", militarCommands) addCommandHandler('jetpack', militarCommands) addEventHandler("onPlayerJoin", root, function() bindKey( source, "J", "down", militarCommands ) end ) mira yo hice eso eso esta bien Link to comment
Rose Posted October 8, 2017 Share Posted October 8, 2017 Pues usando la función del jetpack que antes hiciste, debe quedarte así: addEventHandler("onPlayerJoin", root, function() bindKey( source, "J", "down", jetpack ) end ) function jetpack( Player, commandName ) local playerTeam = getPlayerTeam( Player ) if ( getTeamName( playerTeam ) == "Militar" ) then if ( doesPedHaveJetPack ( Player ) ) then removePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) else givePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) end end addCommandHandler('jetpack', jetpack) addCommandHandler('jp', jetpack) Y si quieres que te de uzi, chaleco, debes hacer el mismo procedimiento. Link to comment
MontiVante Posted October 8, 2017 Author Share Posted October 8, 2017 lo siento pero hice lo que tu me pasaste pero no funciona que hago dime, mi propia función ni me sirve Link to comment
Rose Posted October 10, 2017 Share Posted October 10, 2017 On 8/10/2017 at 08:15, santinet12 said: lo siento pero hice lo que tu me pasaste pero no funciona que hago dime, mi propia función ni me sirve ¿Pudiste solucionarlo? el error que veo en tu función es que falta agregarle un end a un if. Link to comment
MaurO^ Posted October 10, 2017 Share Posted October 10, 2017 addEventHandler("onPlayerJoin", root, function() bindKey( source, "J", "down", jetpack ) end ) function jetpack( Player, commandName ) local playerTeam = getPlayerTeam( Player ) if ( getTeamName( playerTeam ) == "Militar" ) then if ( doesPedHaveJetPack ( Player ) ) then removePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) else givePedJetPack ( Player ) outputChatBox("", Player,0, 200, 255) end end end addCommandHandler('jetpack', jetpack) addCommandHandler('jp', jetpack) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now