Jump to content

[HELP] VIP


TheBull

Recommended Posts

Posted

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?

Posted

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

Posted (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 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

Posted

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]

Posted
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

Posted

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)

Posted
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

Posted

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.

Posted

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 ?

Posted
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

Posted

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) 

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...