Soren Posted January 10, 2012 Share Posted January 10, 2012 (edited) Hola a todos vengo haciendo un scipr que te de un arma random en un DD pero quiero hacer que cuando le toques se comienze a reproducir una cancion pero no quiero que cuando lo toque varias veces se oiga muchas veces alguna forma de hacer que cheque si el sonidos ya se esta reproduciendo para que no se reprodusca denuevo? aqui es lo que llevo del script function blabla () outputChatBox("#ffffffGDC//iSo#00eebbRen.exe: #0055FFGood Luck #FFFFFFAnd#0055FF Have Fun",255,255,255,true) end addEventHandler ( "onResourceStart", getRootElement(), blabla ) function Markerhit (hitPlayer, matchingDimension) setSoundVolume ( playSound ( "sing.mp3", false ), 0.5 ) outputChatBox ( getPlayerName(hitPlayer) .. "Get a Combat Shotgun!! RUN!!" ) giveWeapon ( hitPlayer, 27, 21 ) setPedDoingGangDriveby ( getLocalPlayer (), true ) end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) gracias Edited January 10, 2012 by Guest Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 El evento "onResourceStart" es server-side, y playSound es client-side. P.D: Usa isElement para verificar si el sonido ya esta creado. Link to comment
Soren Posted January 10, 2012 Author Share Posted January 10, 2012 El evento "onResourceStart" es server-side, y playSound es client-side.P.D: Usa isElement para verificar si el sonido ya esta creado. Algun ejemplo de como usarlo? perdon no quiero que me completes el script Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 -- client side: function blabla () outputChatBox("#ffffffGDC//iSo#00eebbRen.exe: #0055FFGood Luck #FFFFFFAnd#0055FF Have Fun",255,255,255,true) end addEventHandler ( "onClientResourceStart", resourceRoot, blabla ) function Markerhit (hitPlayer, matchingDimension) if (hitPlayer ~= localPlayer) then return end if (not isElement(sound)) then local sound = playSound ( "sing.mp3", false ) setSoundVolume ( sound, 0.5 ) outputChatBox ( getPlayerName(hitPlayer) .. "Get a Combat Shotgun!! RUN!!" ) triggerServerEvent("giveWeapon",localPlayer) setPedDoingGangDriveby ( getLocalPlayer (), true ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) -- server side: addEvent("giveWeapon",true) addEventHandler("giveWeapon",root, function () giveWeapon ( source, 27, 21 ) end) Link to comment
Soren Posted January 10, 2012 Author Share Posted January 10, 2012 -- client side: function blabla () outputChatBox("#ffffffGDC//iSo#00eebbRen.exe: #0055FFGood Luck #FFFFFFAnd#0055FF Have Fun",255,255,255,true) end addEventHandler ( "onClientResourceStart", resourceRoot, blabla ) function Markerhit (hitPlayer, matchingDimension) if (hitPlayer ~= localPlayer) then return end if (not isElement(sound)) then local sound = playSound ( "sing.mp3", false ) setSoundVolume ( sound, 0.5 ) outputChatBox ( getPlayerName(hitPlayer) .. "Get a Combat Shotgun!! RUN!!" ) triggerServerEvent("giveWeapon",localPlayer) setPedDoingGangDriveby ( getLocalPlayer (), true ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) -- server side: addEvent("giveWeapon",true) addEventHandler("giveWeapon",root, function () giveWeapon ( source, 27, 21 ) end) no entiendo a que carajos se refieren con el pinche serverside!!!! expliquenme queque en la wiki y noi entendi o denme un ejemplo de como se usa!!! no entiendo ni madreeeessss. Link to comment
RekZ Posted January 10, 2012 Share Posted January 10, 2012 client y server son dos .lua diferentes osea que el scrip que quieres tiene 2 archivos .lua y tampoco es para ponerse asi -.- y respecto a la wiki no es dificil de entender solo tienes que saver ingles Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 Los script client side se ejecutan en el cliente, y los server side en el servidor. Necesitas dos archivos: 1: client.lua 2: server.lua Luego el meta.xml: Seria algo asi: <meta> <info author="Castillo" name="My Script" version="1.0" type="script"/> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> </meta> Link to comment
Soren Posted January 10, 2012 Author Share Posted January 10, 2012 Los script client side se ejecutan en el cliente, y los server side en el servidor.Necesitas dos archivos: 1: client.lua 2: server.lua Luego el meta.xml: Seria algo asi: <meta> <info author="Castillo" name="My Script" version="1.0" type="script"/> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> </meta> Pero es para un mapa DD y me disculpo por mi comportamiento anterior pero es para un mapa DD asi que creo que deberia quedar asi <meta> <script src="server.lua" type="client" /> <script src="client.lua" type="server" /> <file src="sing.mp3" /> <info gamemodes="race" type="map" name="[FUN]iSoRen- Demonic Weapons- V1 -Combat Shotgun-" author="iSoRen" version="1.0.0" description="shoot"></info> <map src="[FUN]DemonicV1.map" dimension="0"></map> <settings> <setting name="#skins" value='[ "cj" ]'></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#ghostmode" value='[ "false" ]'></setting> <setting name="#time" value="0:0"></setting> <setting name="#vehicleweapons" value='[ "false" ]'></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#weather" value="[ 0 ]"></setting> <setting name="#gravity" value="[ 0.008000 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#respawntime" value="[ 5 ]"></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#duration" value="[ 1800 ]"></setting> <setting name="#respawn" value='[ "timelimit" ]'></setting> </settings> </meta> dime si lo tengo que poner asi Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 <meta> <info gamemodes="race" type="map" name="[FUN]iSoRen- Demonic Weapons- V1 -Combat Shotgun-" author="iSoRen" version="1.0.0" description="shoot"></info> <script src="server.lua" type="client" /> <script src="client.lua" type="client" /> <file src="sing.mp3" /> <map src="[FUN]DemonicV1.map" dimension="0"></map> <settings> <setting name="#skins" value='[ "cj" ]'></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#ghostmode" value='[ "false" ]'></setting> <setting name="#time" value="0:0"></setting> <setting name="#vehicleweapons" value='[ "false" ]'></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#weather" value="[ 0 ]"></setting> <setting name="#gravity" value="[ 0.008000 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#respawntime" value="[ 5 ]"></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#duration" value="[ 1800 ]"></setting> <setting name="#respawn" value='[ "timelimit" ]'></setting> </settings> </meta> Link to comment
Soren Posted January 10, 2012 Author Share Posted January 10, 2012 <meta> <info gamemodes="race" type="map" name="[FUN]iSoRen- Demonic Weapons- V1 -Combat Shotgun-" author="iSoRen" version="1.0.0" description="shoot"></info> <script src="server.lua" type="client" /> <script src="client.lua" type="client" /> <file src="sing.mp3" /> <map src="[FUN]DemonicV1.map" dimension="0"></map> <settings> <setting name="#skins" value='[ "cj" ]'></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#ghostmode" value='[ "false" ]'></setting> <setting name="#time" value="0:0"></setting> <setting name="#vehicleweapons" value='[ "false" ]'></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#weather" value="[ 0 ]"></setting> <setting name="#gravity" value="[ 0.008000 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#respawntime" value="[ 5 ]"></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#duration" value="[ 1800 ]"></setting> <setting name="#respawn" value='[ "timelimit" ]'></setting> </settings> </meta> Bueno use el script que tu me diste mas no sirvio ya hise lo que me dijsute ahora que paso por encima de uno de los markers que ubique en el mapa no sirve no reproduce el sonido/cancion y no te da el arama.... Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 Algun error en el debugscript? para activarlo escribe: /debugscript 3. Link to comment
Soren Posted January 10, 2012 Author Share Posted January 10, 2012 <meta> <info gamemodes="race" type="map" name="[FUN]iSoRen- Demonic Weapons- V1 -Combat Shotgun-" author="iSoRen" version="1.0.0" description="shoot"></info> <script src="server.lua" type="client" /> <script src="client.lua" type="client" /> <file src="sing.mp3" /> <map src="[FUN]DemonicV1.map" dimension="0"></map> <settings> <setting name="#skins" value='[ "cj" ]'></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#ghostmode" value='[ "false" ]'></setting> <setting name="#time" value="0:0"></setting> <setting name="#vehicleweapons" value='[ "false" ]'></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#weather" value="[ 0 ]"></setting> <setting name="#gravity" value="[ 0.008000 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#respawntime" value="[ 5 ]"></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#duration" value="[ 1800 ]"></setting> <setting name="#respawn" value='[ "timelimit" ]'></setting> </settings> </meta> Bueno use el script que tu me diste mas no sirvio ya hise lo que me dijsute ahora que paso por encima de uno de los markers que ubique en el mapa no sirve no reproduce el sonido/cancion y no te da el arama.... Crees que si ponga los IDs de esta manera funcionen? function blabla () outputChatBox("#ffffffGDC//iSo#00eebbRen.exe: #0055FFGood Luck #FFFFFFAnd#0055FF Have Fun",255,255,255,true) end addEventHandler ( "onClientResourceStart", resourceRoot, blabla ) iDs { "marker(corona)(1)", "marker(corona)(2)"} function Markerhit (hitPlayer, matchingDimension) if (hitPlayer ~= localPlayer) then return end if (not isElement(sound)) then local sound = playSound ( "sing.mp3", false ) setSoundVolume ( sound, 0.5 ) outputChatBox ( getPlayerName(hitPlayer) .. "Get a Combat Shotgun!! RUN!!" ) triggerServerEvent("giveWeapon",localPlayer) setPedDoingGangDriveby ( getLocalPlayer (), true ) end end pero el error es que no hace el driveby y no da el arma y no reproduce el sonido pero si dice el texto del principio asi que no creo que sea por el debugscript pero lo intentare Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 El script que poste deberia hacer ese sonido con CUALQUIER marker. Edit: Estas seguro que se puede usar la combat shotgun desde los vehiculos? Link to comment
Soren Posted January 10, 2012 Author Share Posted January 10, 2012 no srivio lo intente que podra ser ? Link to comment
Castillo Posted January 10, 2012 Share Posted January 10, 2012 Estas usando el recurso "realdriveby"? si es asi, podes restringir las armas en el meta.xml del mismo. Link to comment
Soren Posted January 10, 2012 Author Share Posted January 10, 2012 Estas usando el recurso "realdriveby"? si es asi, podes restringir las armas en el meta.xml del mismo. eso es estupidamente cierto..... porque noe me fije antes lo intentare Edit: no sirvio acativar las armas del mapa y ya cambie para ver si no se puede usar la combatshotgun a minigun pero no sirvio nada y si en el script uso el comando createmarker antes de la funcion markerHit? Link to comment
Soren Posted January 11, 2012 Author Share Posted January 11, 2012 Estas usando el recurso "realdriveby"? si es asi, podes restringir las armas en el meta.xml del mismo. no lo estoy usando y si fuera asi ya lo testie asi que no tengo la menor idea de lo que pueda ser .... que es lo que hace que el script no funcione? Link to comment
Soren Posted January 21, 2012 Author Share Posted January 21, 2012 -- client side: function blabla () outputChatBox("#ffffffGDC//iSo#00eebbRen.exe: #0055FFGood Luck #FFFFFFAnd#0055FF Have Fun",255,255,255,true) end addEventHandler ( "onClientResourceStart", resourceRoot, blabla ) function Markerhit (hitPlayer, matchingDimension) if (hitPlayer ~= localPlayer) then return end if (not isElement(sound)) then local sound = playSound ( "sing.mp3", false ) setSoundVolume ( sound, 0.5 ) outputChatBox ( getPlayerName(hitPlayer) .. "Get a Combat Shotgun!! RUN!!" ) triggerServerEvent("giveWeapon",localPlayer) setPedDoingGangDriveby ( getLocalPlayer (), true ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) -- server side: addEvent("giveWeapon",true) addEventHandler("giveWeapon",root, function () giveWeapon ( source, 27, 21 ) end) Creo que no sirve por que falta el EventHandler Link to comment
Recommended Posts