Jump to content

[Help] Car Fly


Recommended Posts

  
  
function admt ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
  
        if isWorldSpecialPropertyEnabled( "hovercars" ) then 
            setWorldSpecialPropertyEnabled( "hovercars", true ) 
            outputChatBox("Water drive: on ", 255, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "hovercars", false ) 
            outputChatBox("Water drive: off", 255, 0, 0 ) 
        end 
    end 
    end 
end 
addCommandHandler ( "water", admt ) 
  
function adm ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
  
        if isWorldSpecialPropertyEnabled( "aircars" ) then 
            setWorldSpecialPropertyEnabled( "aircars", true ) 
            outputChatBox("Flying vehicle is on !", 255, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "aircars", false ) 
            outputChatBox("Flying vehicle is off !", 255, 0, 0 ) 
    end 
    end 
end 
addCommandHandler ( "fly", adm ) 

what is wrong here?

Edited by Guest
Link to comment
--Toppexxx 
  
function admt ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
        if isWorldSpecialPropertyEnabled( "hovercars" ) then 
            setWorldSpecialPropertyEnabled( "hovercars", true ) 
            outputChatBox("Water drive: on ", 255, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "hovercars", false ) 
            outputChatBox("Water drive: off", 255, 0, 0 ) 
        end 
    end 
end 
addCommandHandler ( "water", admt ) 
  
function adm ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
        if isWorldSpecialPropertyEnabled( "aircars" ) then 
            setWorldSpecialPropertyEnabled( "aircars", true ) 
            outputChatBox("Flying vehicle is on !", 255, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "aircars", false ) 
            outputChatBox("Flying vehicle is off !", 255, 0, 0 ) 
        end 
    end 
end 
addCommandHandler ( "fly", adm ) 

Link to comment
Guest Guest4401
hhhm errors are that i can't use /fly and /water

and karthik how to fix?

When player logs in, check if he's an admin and set element data to it. In clientside, get its element data, and if he's admin allow him to so.

Otherwise you can make the command serverside and trigger a clientside event to set the special property.

Link to comment

client

addEvent( "activeDriveOnWater", true ) 
addEventHandler("activeDriveOnWater", root, 
    function() 
        if isWorldSpecialPropertyEnabled( "hovercars" ) == false then 
            setWorldSpecialPropertyEnabled( "hovercars", true ) 
            outputChatBox("Water drive: on ", 255, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "hovercars", false ) 
            outputChatBox("Water drive: off", 255, 0, 0 ) 
        end 
    end 
) 
  
addEvent( "activeFlyinCar", true ) 
addEventHandler("activeFlyinCar", root, 
    function() 
        if isWorldSpecialPropertyEnabled( "aircars" ) == false then 
            setWorldSpecialPropertyEnabled( "aircars", true ) 
            outputChatBox("Flying vehicle is on !", 255, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "aircars", false ) 
            outputChatBox("Flying vehicle is off !", 255, 0, 0 ) 
        end 
    end 
) 

server

function admt ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
        triggerClientEvent ( "activeDriveOnWater", root ) 
    end 
end 
addCommandHandler ( "water", admt ) 
  
function adm ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
        triggerClientEvent ( "activeFlyinCar", root ) 
    end 
end 
addCommandHandler ( "fly", adm ) 

didnt notice it's clientside & serverside functions :oops:

Edited by Guest
Link to comment

I am sorry to say but that code is wrong. It will trigger the world cheat for all players if you use that code, use this, this is a little more simple anyways.

Server-side

addCommandHandler("water", 
    function(player, cmd) 
        if isGuestAccount(getPlayerAccount(player)) then return end 
        if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then 
            triggerClientEvent(player, "activateCheat", player, cmd) 
        end 
    end 
) 
  
addCommandHandler("fly", 
    function(player, cmd) 
        if isGuestAccount(getPlayerAccount(player)) then return end 
        if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then 
            triggerClientEvent(player, "activateCheat", player, cmd) 
        end 
    end 
) 

Client-side

addEvent("activateCheat", true) 
addEventHandler("activateCheat", root, 
    function(cmd) 
        if cmd == "fly" then 
            setWorldSpecialPropertyEnabled("hovercars", not isWorldSpecialPropertyEnabled("hovercars")) 
            outputChatBox("Flying vehicle cheat is " .. (isWorldSpecialPropertyEnabled("hovercars") and "on" or "off") .. ".", 255, 180, 10, false) 
        elseif cmd == "water" then 
            setWorldSpecialPropertyEnabled("aircars", not isWorldSpecialPropertyEnabled("aircars")) 
            outputChatBox("Flying vehicle cheat is " .. (isWorldSpecialPropertyEnabled("aircars") and "on" or "off") .. ".", 255, 180, 10, false) 
        end 
    end 
) 

Link to comment

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