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

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

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) 

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 ) 

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

?

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