Jump to content

questions - help


Recommended Posts

Posted

Thanks!

You can analyze my complete code, to see if there is some mistake?

  
function  givekit2( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        if not tempokit2 then 
            giveWeapon ( source, 31, 300 ) --Give M4 
            giveWeapon ( source, 34, 80 ) -- Give Sniper Rifle 
            tempokit2 = true 
            setTimer(set1hora,3600000,1,player) 
        end 
    end 
end 
addCommandHandler("kitvippremiun",givekit2) 
  
function set1hora() 
    tempokit2 = false 
end 
  
function givekit1( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        if not tempokit1 then 
            giveWeapon ( source, 29, 300 ) --Give MP5 
            giveWeapon ( source, 34, 10 ) -- Give Sniper Rifle 
            tempokit1 = true 
            setTimer(set30mim,1800000,1,player) 
        end 
    end 
end 
addCommandHandler("kitvip",givekit1) 
  
function set30mim() 
    tempokit1 = false 
end 
  
function givebike( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        local x,y,z= getElementPosition(player) 
        veh = createVehicle(509, x+1, y, z) 
        warpPedIntoVehicle(player, veh) 
    end 
end 
addCommandHandler("bikevip",givebike) 
  

Posted

You should start it at your server and see if it works ..

If it wasn't, Then debug your script with debugscript 3 ( Wright it at the console ..! )

And then if you couldn't fix it yourself, We'll help you ^^

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

Just want to know if something is wrong or missing, because I never did a script for mta. I thought alquem who knows more could help me with the system I'm doing, I'm just asking for a little help to see if there's something wrong.

Posted

if use source it won't work try this :

  
function  givekit2( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        if not tempokit2 then 
            giveWeapon ( player, 31, 300 ) --Give M4 
            giveWeapon ( player, 34, 80 ) -- Give Sniper Rifle 
            tempokit2 = true 
            setTimer(set1hora,3600000,1,player) 
        end 
    end 
end 
addCommandHandler("kitvippremiun",givekit2) 
  
function set1hora() 
    tempokit2 = false 
end 
  
function givekit1( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        if not tempokit1 then 
            giveWeapon ( player, 29, 300 ) --Give MP5 
            giveWeapon ( player, 34, 10 ) -- Give Sniper Rifle 
            tempokit1 = true 
            setTimer(set30mim,1800000,1,player) 
        end 
    end 
end 
addCommandHandler("kitvip",givekit1) 
  
function set30mim() 
    tempokit1 = false 
end 
  
function givebike( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        local x,y,z= getElementPosition(player) 
        veh = createVehicle(509, x+1, y, z) 
        warpPedIntoVehicle(player, veh) 
    end 
end 
addCommandHandler("bikevip",givebike) 
  

((=

  

Posted

Also can tell me if there is a function for destroir the vehicle?

You can use destroyElement

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

Thanks!

And how do I activate a setTimer, after pressing enter, to leave the "veh" (in case the bike/ID:509 that was created) of the function below?

  
function givebike( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        local x,y,z= getElementPosition(player) 
        veh = createVehicle(509, x+1, y, z) 
        warpPedIntoVehicle(player, veh) 
    end 
end 
addCommandHandler("bikevip",givebike) 
  

Posted

ok, try this:

  
function givebike( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then 
        local x,y,z= getElementPosition(player) 
        veh = createVehicle(509, x+1, y, z) 
        warpPedIntoVehicle(player, veh) 
          addEventHandler('onVehicleExit',veh,function() setTimer(destroyElement,5000,1,veh) end) 
    end 
end 
addCommandHandler("bikevip",givebike) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

Yes, use:

aclGetGroup 
aclGroupAddObject 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Thanks!

So will it work?

  
function givevip (playerSource, commandName, accountName) 
    if accountName then 
        aclGroupAddObject (aclGetGroup("Vip"), "user."..accountName))  
        outputChatBox ("Account '"..accountName.."' succesfully added to the Vip group", playerSource) 
    else  
        outputChatBox ("No account name specified.", playerSource) 
        outputChatBox ("Correct syntax: /givevipfor [accountName]", playerSource) 
    end 
end 
  
addCommandHandler ("givevipfor", givevip) 
  

Posted

One problem at this line:

aclGroupAddObject (aclGetGroup("Vip"), "user."..accountName)) 

You have an extra ")" at the end, should be:

aclGroupAddObject ( aclGetGroup ( "Vip" ), "user.".. accountName ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

put the command to remove, and placed so that only admins can use, you can check please?

  
  
function delvip (playerSource, commandName, accountName) 
    local accName = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        if accountName then 
            aclGroupRemoveObject (aclGetGroup("Vip"), "user."..accountName) 
            outputChatBox ("ACL: Account '"..accountName.."' succesfully removed as vip.", playerSource) 
            outputChatBox ("ACL: Someone have removed you as admin.", accountName) 
        else 
            outputChatBox ("ACL: No account name specified.", playerSource) 
            outputChatBox ("ACL: Syntax: /delvip [accountName]", playerSource) 
        end 
    end 
end 
addCommandHandler ("delvip", delvip) 
  
  
function givevip (playerSource, commandName, accountName) 
    local accName = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        if accountName then 
            aclGroupAddObject (aclGetGroup("Vip"), "user."..accountName)) 
                outputChatBox ("Account '"..accountName.."' succesfully added to the Vip group", playerSource) 
        else 
                outputChatBox ("No account name specified.", playerSource) 
                outputChatBox ("Correct syntax: /givevipfor [accountName]", playerSource) 
            end 
    end 
end 
  
addCommandHandler ("givevipfor", givevip) 
  

Posted
local accName = getAccountName ( getPlayerAccount ( player ) ) 

That's wrong, your player argument is: "playerSource".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function delvip (playerSource, commandName, accountName) 
    local accName = getAccountName ( getPlayerAccount ( playerSource ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        if accountName then 
            aclGroupRemoveObject (aclGetGroup("Vip"), "user."..accountName) 
            outputChatBox ("ACL: Account '"..accountName.."' succesfully removed as vip.", playerSource) 
            outputChatBox ("ACL: Someone have removed you as admin.", accountName) 
        else 
            outputChatBox ("ACL: No account name specified.", playerSource) 
            outputChatBox ("ACL: Syntax: /delvip [accountName]", playerSource) 
        end 
    end 
end 
addCommandHandler ("delvip", delvip) 
  
  
function givevip (playerSource, commandName, accountName) 
    local accName = getAccountName ( getPlayerAccount ( playerSource ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        if accountName then 
            aclGroupAddObject (aclGetGroup("Vip"), "user."..accountName) 
                outputChatBox ("Account '"..accountName.."' succesfully added to the Vip group", playerSource) 
        else 
                outputChatBox ("No account name specified.", playerSource) 
                outputChatBox ("Correct syntax: /givevipfor [accountName]", playerSource) 
            end 
    end 
end 
  
addCommandHandler ("givevipfor", givevip) 

?

Posted

Does it work?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

It should work.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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