Jump to content

variable problem


Reezmi

Recommended Posts

Hello! I was wondering if there is a way to make these -

playerInDM = true  
inDMMod = true 

only for one player not for everyone beccause these enables for everyone and thats a problem for me :/

Here is source:

addCommandHandler("enterdm", 
function (player) 
    if isPedInVehicle ( player ) then 
    outputChatBox("#FFFFFFYou must be on foot to join DM!",player,255,0,0,true) 
    else 
    if playerInDM == false then 
    local r,g,b = getPlayerNametagColor ( player )  
    local playerName = getPlayerName ( player )  
    local x, y, z = unpack( pSpawns [ math.random( #pSpawns ) ] ) 
    outputChatBox ( playerName.." #FFFFFFhas joined DM. Type /enterdm to join him ", getRootElement(), r, g, b, true ) 
    setElementPosition ( player, x, y, z ) 
    setElementFrozen(player, true) 
    setElementInterior ( player, 0 ) 
    setElementDimension ( player, 0 )    
    setTimer(setElementFrozen, 3000, 1, player, false) 
    takeAllWeapons ( player ) 
    giveWeapon ( player, 8, 1000 ) 
    giveWeapon ( player, 24, 1000 ) 
    giveWeapon ( player, 26, 1000 ) 
    giveWeapon ( player, 30, 1000 ) 
    giveWeapon ( player, 34, 1000 ) 
    playerInDM = true  
    inDMMod = true 
    elseif inDMMod == true then 
    outputChatBox("#FFFFFFYou are already in DM!",player,255,0,0,true) 
    outputChatBox("#FFFFFFIf you want to leave type /exitevent!",player,255,0,0,true) 
    end 
    end 
end) 

Link to comment

I tried these but now then I type /enterdm nothing happens.

Here's code:

addCommandHandler("enterdm", 
function (player) 
    if isPedInVehicle ( player ) then 
    outputChatBox("#FFFFFFYou must be on foot to join DM!",player,255,0,0,true) 
    else 
    local playerInDM = getElementData( player, "playerInDMData" ) 
    if playerInDM == false then 
    local inDMMod = getElementData( player, "inDMModData" ) 
    local r,g,b = getPlayerNametagColor ( player )  
    local playerName = getPlayerName ( player )  
    local x, y, z = unpack( pSpawns [ math.random( #pSpawns ) ] ) 
    outputChatBox ( playerName.." #FFFFFFhas joined DM. Type /enterdm to join him ", getRootElement(), r, g, b, true ) 
    setElementPosition ( player, x, y, z ) 
    setElementFrozen(player, true) 
    setElementInterior ( player, 0 ) 
    setElementDimension ( player, 0 )    
    setTimer(setElementFrozen, 3000, 1, player, false) 
    takeAllWeapons ( player ) 
    giveWeapon ( player, 8, 1000 ) 
    giveWeapon ( player, 24, 1000 ) 
    giveWeapon ( player, 26, 1000 ) 
    giveWeapon ( player, 30, 1000 ) 
    giveWeapon ( player, 34, 1000 ) 
    setElementData ( player, "playerInDMData", true ) 
    setElementData ( player, "inDMModData", true ) 
    elseif inDMMod == true then 
    outputChatBox("#FFFFFFYou are already in DM!",player,255,0,0,true) 
    outputChatBox("#FFFFFFIf you want to leave type /exitevent!",player,255,0,0,true) 
    end 
    end 
end) 

Am i missing something?

Link to comment
  • Other Languages Moderators
addCommandHandler("enterdm", 
function(player) 
     if isPedInVehicle(player) then 
          outputChatBox("#FFFFFFYou must be on foot to join DM!",player,255,0,0,true) 
     return end 
     if not getElementData(player, "playerInDMData") then 
          local r,g,b = getPlayerNametagColor(player) 
          local playerName = getPlayerName(player) 
          local x, y, z = unpack(pSpawns[math.random(#pSpawns)]) 
          outputChatBox(playerName.." #FFFFFFhas joined DM. Type /enterdm to join him.", root, r, g, b, true) 
          setElementPosition(player, x, y, z) 
          setElementFrozen(player, true) 
          setElementInterior(player, 0) 
          setElementDimension(player, 0)   
          setTimer(setElementFrozen, 3000, 1, player, false) 
          takeAllWeapons(player) 
          giveWeapon(player, 8, 1000) 
          giveWeapon(player, 24, 1000) 
          giveWeapon(player, 26, 1000) 
          giveWeapon(player, 30, 1000) 
          giveWeapon(player, 34, 1000) 
          setElementData(player, "playerInDMData",true) 
     else 
          outputChatBox("#FFFFFFYou are already in DM!",player,255,0,0,true) 
          outputChatBox("#FFFFFFIf you want to leave type /exitevent!",player,255,0,0,true) 
     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...