Jump to content

Restrict cars ( on skin )


tim260

Recommended Posts

militaryVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[490]=true, [470]=true } 
militaryTeams = {["Military"]=true,["Naval"]=true} 
  
function militaryenterVehicle ( player, seat, jacked ) 
    if ( militaryVehicles[getElementModel ( source )] ) and ( getPlayerTeam( player ) ) and ( not militaryTeams[getTeamName(getPlayerTeam( player ))] ) and ( seat == 0 ) then 
        outputChatBox ( "You aren't a Military , you mayn't drive this.", player ) --and tell the player why 
        cancelEvent() 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), militaryenterVehicle ) 

This is my vehicle testrictment script, how can i restrict it to a skin and not a team ....

EDIT :

also how do i add the thing that if spawn set team Geusts

-- Settings for when a player joins 
    -- XYZ coördinates 
    local joinX = 0.0 
    local joinY = 0.0 
    local joinZ = 0.0 
    -- Weapon and ammo 
    local joinWeapon = 22 
    local joinAmmo = 200 
    -- Message when player joins 
    local joinMessage = "Welcome to this server." 
    -- Skin that player gets 
    local joinSkin = 0 
  
-- Settings for when a player dies 
    -- XYZ coördinates 
    local spawnX = 0.0 
    local spawnY = 0.0 
    local spawnZ = 0.0 
    -- Weapon and ammo 
    local spawnWeapon = 22 
    local spawnAmmo = 200 
    -- Skin that player gets 
    local spawnSkin = 0 
  
-- Settings for the amounts of money 
    -- Money the killer gets 
    local killerMoney = 500 
    -- Money removed from player when they die 
    local deadPlayerMoney = 500 
    -- Money you get when you join 
    local joinMoney = 1000 
  
-- Functions 
-- This function spawns players when they join 
function spawnOnJoin() 
    spawnPlayer(source, joinX, joinY, joinZ, 0 , joinSkin) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox(joinMessage, source) 
    giveWeapon(source, joinWeapon, joinAmmo) 
    givePlayerMoney(source, joinMoney) 
end 
  
-- This function spawns players after they died 
function spawnOnDead(ammo, killer, weapon, bodypart) 
    outputChatBox(getPlayerName(source).." died.") 
    takePlayerMoney(source, deadPlayerMoney) 
    if (killer) and (killer ~= source) then 
        givePlayerMoney(killer, killerMoney) 
    end 
    setTimer(spawnPlayer, 3000, 1, source, spawnX, spawnY, spawnZ, 0, spawnSkin) 
    setCameraTarget(source, source) 
    setTimer(giveWeapon, 3000, 1, source, spawnWeapon, spawnAmmo) 
end 
  
-- Event handlers 
addEventHandler("onPlayerJoin", getRootElement(), spawnOnJoin) 
addEventHandler("onPlayerWasted", getRootElement(), spawnOnDead) 

Link to comment
militaryVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[490]=true, [470]=true } 
militarySkin = {["skinID"]=true,["skinID"]=true} 
  
function militaryenterVehicle ( player, seat, jacked ) 
    if ( militaryVehicles[getElementModel ( source )] ) and   ( not militarySkin[(getPedSkin (player ))] ) and ( seat == 0 ) then 
        outputChatBox ( "You aren't a Military , you mayn't drive this.", player ) --and tell the player why 
        cancelEvent() 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), militaryenterVehicle ) 

Link to comment

is working with skin ids 217 and 218

    militaryVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[490]=true, [470]=true } 
    militaryTeams = {[217]=true,[218]=true} 
      
    function militaryenterVehicle ( player, seat, jacked ) 
        if ( militaryVehicles[getElementModel ( source )] ) and ( not militaryTeams[getElementModel(player)] ) and ( seat == 0 ) then 
            outputChatBox ( "You aren't a Military , you mayn't drive this.", player ) --and tell the player why 
            cancelEvent() 
        end 
    end 
    addEventHandler ( "onVehicleStartEnter", getRootElement(), militaryenterVehicle ) 

second

addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), 
function() 
    teamG = createTeam ( "Geusts", 255, 255, 255 ) 
end) 
     
     
        -- Settings for when a player joins 
        -- XYZ coördinates 
        local joinX = 0.0 
        local joinY = 0.0 
        local joinZ = 0.0 
        -- Weapon and ammo 
        local joinWeapon = 22 
        local joinAmmo = 200 
        -- Message when player joins 
        local joinMessage = "Welcome to this server." 
        -- Skin that player gets 
        local joinSkin = 0 
      
    -- Settings for when a player dies 
        -- XYZ coördinates 
        local spawnX = 0.0 
        local spawnY = 0.0 
        local spawnZ = 0.0 
        -- Weapon and ammo 
        local spawnWeapon = 22 
        local spawnAmmo = 200 
        -- Skin that player gets 
        local spawnSkin = 0 
      
    -- Settings for the amounts of money 
        -- Money the killer gets 
        local killerMoney = 500 
        -- Money removed from player when they die 
        local deadPlayerMoney = 500 
        -- Money you get when you join 
        local joinMoney = 1000 
      
    -- Functions 
    -- This function spawns players when they join 
    function spawnOnJoin() 
        spawnPlayer(source, joinX, joinY, joinZ, 0 , joinSkin) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
        outputChatBox(joinMessage, source) 
        giveWeapon(source, joinWeapon, joinAmmo) 
        givePlayerMoney(source, joinMoney) 
        setPlayerTeam(source,teamG) 
    end 
      
    -- This function spawns players after they died 
    function spawnOnDead(ammo, killer, weapon, bodypart) 
        outputChatBox(getPlayerName(source).." died.") 
        takePlayerMoney(source, deadPlayerMoney) 
        if (killer) and (killer ~= source) then 
            givePlayerMoney(killer, killerMoney) 
        end 
        setTimer(spawnPlayer, 3000, 1, source, spawnX, spawnY, spawnZ, 0, spawnSkin) 
        setCameraTarget(source, source) 
        setTimer(giveWeapon, 3000, 1, source, spawnWeapon, spawnAmmo) 
    end 
      
    -- Event handlers 
    addEventHandler("onPlayerJoin", getRootElement(), spawnOnJoin) 
    addEventHandler("onPlayerWasted", getRootElement(), spawnOnDead) 

Link to comment

Thanks mate it worked, does there excist to lock a car to ONE person and then ONE car and not like if i buy one in shop it says this car is only blablabla... but like ony cheetah (3) ( placed in map editor ) is for him. you know what im saying ?

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