TheBull Posted August 24, 2015 Posted August 24, 2015 Helloo. I've tried to make a script for playing musing for vip players only ,it's not working since i added getPlayerAccount,I really need you're help, Here is my code : Server : function nyanCommand ( playerSource, commandName ) local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then triggerClientEvent (source, "onNyanCat", root ) local theTriggerer = getPlayerName ( playerSource ) triggerClientEvent ( "onNyanCat", getRootElement() ) outputChatBox ( theTriggerer .. "#E45800 Is a Nyan Cat !", getRootElement(), 255, 255, 255, true ) end function foolsCommand ( playerSource, commandName ) local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then triggerClientEvent (source, "onFools", root ) local theTriggerer = getPlayerName ( playerSource ) triggerClientEvent ( "onFools", getRootElement() ) outputChatBox ( theTriggerer .. "#E45800 Is Killing Fools!", getRootElement(), 255, 255, 255, true ) end addCommandHandler ( "nyan", nyanCommand ) addCommandHandler ( "fools", foolsCommand ) Client : function nyan () stopSound ( sound ) sound = playSound("Nyan.mp3") setSoundVolume(sound, 1) end function fools () stopSound ( sound ) sound = playSound("Killingfools.mp3") setSoundVolume(sound, 1) end addEvent( "onNyanCat", true ) addEventHandler( "onNyanCat", getRootElement(), nyan ) addEvent( "onFools", true ) addEventHandler( "onFools", getRootElement(), fools ) And i disabled the Rhino's and hydra's and hunter's in my freeroam , and i want vip players be able to spawn these vehicles,could you give me what functions and events should i use?
Walid Posted August 24, 2015 Posted August 24, 2015 acc it's not defined in your code. add this line local acc = getPlayerAccount(playerSource) and replace source with playerSource. also you need to check if the player isLogged in or not if acc and not isGuestAccount(acc) then -- Your code end Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
TheBull Posted August 24, 2015 Author Posted August 24, 2015 Still not working , ERROR : 'end' expected (to close 'function' at line 13) near .
Walid Posted August 24, 2015 Posted August 24, 2015 (edited) Still not working , ERROR : 'end' expected (to close 'function' at line 13) near . add end at the end of your code. Example: -- Server side function nyanCommand ( playerSource, commandName ) local acc = getPlayerAccount (playerSource) if acc and not isGuestAccount(acc) then local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local theTriggerer = getPlayerName ( playerSource ) if commandName == "nyan" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"nyan" ) outputChatBox ( theTriggerer .. "#E45800 Is a Nyan Cat !", getRootElement(), 255, 255, 255, true ) elseif commandName == "fools" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"fools" ) outputChatBox ( theTriggerer .. "#E45800 Is Killing Fools!", getRootElement(), 255, 255, 255, true ) end end end end addCommandHandler ( "nyan", nyanCommand ) addCommandHandler ( "fools", nyanCommand) -- Client side function playMusic (songName) if sound and isElement(sound) then stopSound(sound) end if songName == "nyan" then sound = playSound("Nyan.mp3") elseif soungName == "fools" then sound = playSound("Killingfools.mp3") end setSoundVolume(sound, 1) end addEvent("playMusicEvent", true ) addEventHandler("playMusicEvent", getRootElement(), playMusic ) sorry i'm using my phone. Edited August 24, 2015 by Guest Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
TheBull Posted August 24, 2015 Author Posted August 24, 2015 Command (nyan) worked now i fixed the missing thing , but the command (fools) is still not working,and the error when i start the resource is : ERROR : Bad argument @ 'addCommandHandler' [Expected function at argument 2,got nil]
Walid Posted August 24, 2015 Posted August 24, 2015 Command (nyan) worked now i fixed the missing thing , but the command (fools) is still not working,and the error when i start the resource is : ERROR : Bad argument @ 'addCommandHandler' [Expected function at argument 2,got nil] ah sorry i forgot to change the function name to nyanCommand. -- from addCommandHandler ( "fools", foolsCommand ) --To addCommandHandler ( "fools", nyanCommand ) that's all -- Server side function nyanCommand ( playerSource, commandName ) local acc = getPlayerAccount (playerSource) if acc and not isGuestAccount(acc) then local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local theTriggerer = getPlayerName ( playerSource ) if commandName == "nyan" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"nyan" ) outputChatBox ( theTriggerer .. "#E45800 Is a Nyan Cat !", getRootElement(), 255, 255, 255, true ) elseif commandName == "fools" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"fools" ) outputChatBox ( theTriggerer .. "#E45800 Is Killing Fools!", getRootElement(), 255, 255, 255, true ) end end end end addCommandHandler ( "nyan", nyanCommand ) addCommandHandler ( "fools", nyanCommand) -- Client side function playMusic (songName) if sound and isElement(sound) then stopSound(sound) end if songName == "nyan" then sound = playSound("Nyan.mp3") elseif soungName == "fools" then sound = playSound("Killingfools.mp3") end setSoundVolume(sound, 1) end addEvent("playMusicEvent", true ) addEventHandler("playMusicEvent", getRootElement(), playMusic ) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
TheBull Posted August 24, 2015 Author Posted August 24, 2015 fools command is not working again , When i type the command (fools) it shows an error here it is : Bad 'sound/player' pointer @ 'setSoundVolume'(1)
JR10 Posted August 24, 2015 Posted August 24, 2015 function playMusic (songName) if sound and isElement(sound) then stopSound(sound) end if songName == "nyan" then sound = playSound("Nyan.mp3") elseif songName == "fools" then sound = playSound("Killingfools.mp3") end setSoundVolume(sound, 1) end addEvent("playMusicEvent", true ) addEventHandler("playMusicEvent", getRootElement(), playMusic ) It was soungName instead of songName. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
TheBull Posted August 24, 2015 Author Posted August 24, 2015 Thank you guys for your help , I really appreciate that,one more question i disabled the Rhino's and hydra's and hunter's and jetpacks in my freeroam , and i want vip players be able to spawn these vehicles and get jetpacks,could you give me what functions and events should i use? I'm really sorry for asking alot , Once again thanks.
TheBull Posted August 25, 2015 Author Posted August 25, 2015 And i got another problem , when a vip player plays these sounds only vip player can hear it,and normal players can't here it,is there a way to make non-vip players can hear them ?
Walid Posted August 25, 2015 Posted August 25, 2015 And i got another problem , when a vip player plays these sounds only vip player can hear it,and normal players can't here it,is there a way to make non-vip players can hear them ? replace playerSource with root (triggerClientEvent). Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
TheBull Posted August 25, 2015 Author Posted August 25, 2015 Didn't work,could you tell me where should i replace it with? , Because i replaced it with all "playerSource"
ozulus Posted August 25, 2015 Posted August 25, 2015 Like that. I only wrote root instead of playerSource function nyanCommand ( playerSource, commandName ) local acc = getPlayerAccount (playerSource) if acc and not isGuestAccount(acc) then local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local theTriggerer = getPlayerName ( playerSource ) if commandName == "nyan" then triggerClientEvent (root, "playMusicEvent", root,"nyan" ) -- changed outputChatBox ( theTriggerer .. "#E45800 Is a Nyan Cat !", getRootElement(), 255, 255, 255, true ) elseif commandName == "fools" then triggerClientEvent (root, "playMusicEvent", root,"fools" ) -- changed outputChatBox ( theTriggerer .. "#E45800 Is Killing Fools!", getRootElement(), 255, 255, 255, true ) end end end end addCommandHandler ( "nyan", nyanCommand ) addCommandHandler ( "fools", nyanCommand)
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