Jump to content

Got Boolean


iRack

Recommended Posts

Hi, can someone help me ? I don't understand what's wrong. Look at this errors :

[2019-03-17 07:49:57] Starting rpdemine
[2019-03-17 07:49:57] WARNING: rpdemine\admin\server.lua:410: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]
[2019-03-17 07:49:57] WARNING: rpdemine\admin\server.lua:410: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]
[2019-03-17 07:49:57] ERROR: rpdemine\admin\server.lua:411: attempt to concatenate local 'accName' (a boolean value)
[2019-03-17 07:49:57] WARNING: rpdemine\fraktion\ambulance\base.lua:107: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]
[2019-03-17 07:49:57] WARNING: rpdemine\fraktion\ambulance\base.lua:115: Bad argument @ 'getPlayerFromName' [Expected string at argument 1, got nil]

This is the script :

Quote

function teleprotect ( thePlayer)
  local vehicle = getPedOccupiedVehicle(playerSource)  
  if vehicle then 
    setElementVelocity(vehicle,0,0,0) 
    setElementPosition (vehicle, 4131.3872070313, -1759.1988525391, 3) 
  else 
    setElementPosition (playerSource, 4131.3872070313, -1759.1988525391, 3) 
  end 
  outputChatBox ("You Have Been Teleported To The Highway!!", playerSource, 0, 255, 0) 
end 
            local accName = getAccountName(getPlayerAccount(thePlayer))
             if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then
   outputChatBox ( "Server: You are not an owner!", thePlayer, 0, 255, 0 )    
         setElementPosition (thePlayer, 4131.3872070313, -1759.1988525391, 3) 
    else
        outputChatBox (getPlayerName(thePlayer) .. ' #BEBEBEASf ! ', source, 255,255,255,true)
   end
addCommandHandler ("highway", teleprotect) 

(Here I want to go to the highway with my car )

And this :

Quote

function healPlayer(player, cmd, name, price)
  if not name or not price then
    outputChatBox("/heal [Player_Name] [Price]", player, 255, 255, 255, true)
  else
      end
    end
      local gang = getPlayerAccount(thePlayer)
   if (gang) then
    if getAccountData(gang, "keks.fraktion") == 3 then
         outputChatBox("hp <name> <price>", thePlayer)
    else
     outputChatBox("You are not a member of Paramedic!", thePlayer, 255, 0, 0)
    end
       end
    local target = getPlayerFromName(name)
    if target then
      if getPlayerMoney(target)>=tonumber(price) then
        takePlayerMoney(target, tonumber(price))
        givePlayerMoney(player, tonumber(price))
        setElementHealth(target, 100)
        outputChatBox(getPlayerName(player) .. " healed you!", player, 255, 255, 255, true)
        outputChatBox("You healed " .. getPlayerName(target), player, 255, 255, 255, true)
      else
        outputChatBox("Can't pay the healing", player, 255, 255, 255, true)
      end
    else
      outputChatBox("I can't find the target!", player, 255, 255, 255, true)
    end
addCommandHandler("heal", healPlayer)

(This is a faction system, if you are in the faction named ''Paramedic Departament'' with ID 3, you will be able to use the command [/heal]. What's wrong with this scripts ? thanks a lot guys !!! :)

Link to comment

I have the same problem.

If I can solve it, I'll call you ...

 

Spoiler

 


[2019-03-24 11:52:29] ADMIN: #00ffff_Pat#fffffftif_ has changed #00ffff_Pat#fffffftif_'s skin to 0

[2019-03-24 11:52:35] ADMIN: #00ffff_Pat#fffffftif_ has given #00ffff_Pat#fffffftif_ a 'Banshee'" 

[2019-03-24 11:52:48] WARNING: batidareal/s_vehicle_crash.lua:2: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean

[2019-03-24 11:52:48] WARNING: batidareal/s_vehicle_crash.lua:3: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]

 


]

My code: 

function throwPlayerThroughWindow(thePlayer, x, y, z)  
    local accName = getPlayerAccount (thePlayer)
    local cintover = getAccountData ( accName, "cinto" )
    if cintover == "on" then
          outputChatBox ( "#00ffff[CIDADÃO] #c1c1c1Você bateu, mas como está utilizando o cinto de segurança, não se machucou.", thePlayer, 255, 255, 255, true ) else

    if thePlayer then
        local occupants = getVehicleOccupants ( thePlayer )
        local seats = getVehicleMaxPassengers( thePlayer )
    
        if occupants[0] == client then
            for seat = 0, seats do          
                local occupant = occupants[seat] -- Get the occupant
     
                if occupant and getElementType(occupant) == "player" then -- If the seat is occupied by a player...
                --exports['anticheat-system']:changeProtectedElementDataEx(occupant, "realinvehicle", 0, false)
                    removePedFromVehicle(occupant, vehicle)
                    setElementPosition(occupant, x, y, z)
                    setPedAnimation(occupant, "CRACK", "crckdeth2", 10000, true, false, false)
                    setTimer(setPedAnimation, 10005, 1, occupant)
                end
            end
        end
    end
end
end
addEvent("crashThrowPlayerFromVehicle", true)
addEventHandler("crashThrowPlayerFromVehicle", getRootElement(), throwPlayerThroughWindow)

*I tried to change the source through thePlayer


 
Link to comment
  • Moderators
On 17/03/2019 at 06:54, iRack said:

Hi, can someone help me ? I don't understand what's wrong. Look at this errors :

[2019-03-17 07:49:57] Starting rpdemine
[2019-03-17 07:49:57] WARNING: rpdemine\admin\server.lua:410: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]
[2019-03-17 07:49:57] WARNING: rpdemine\admin\server.lua:410: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]
[2019-03-17 07:49:57] ERROR: rpdemine\admin\server.lua:411: attempt to concatenate local 'accName' (a boolean value)
[2019-03-17 07:49:57] WARNING: rpdemine\fraktion\ambulance\base.lua:107: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]
[2019-03-17 07:49:57] WARNING: rpdemine\fraktion\ambulance\base.lua:115: Bad argument @ 'getPlayerFromName' [Expected string at argument 1, got nil]

This is the script :

(Here I want to go to the highway with my car )

And this :

(This is a faction system, if you are in the faction named ''Paramedic Departament'' with ID 3, you will be able to use the command [/heal]. What's wrong with this scripts ? thanks a lot guys !!! :)

 

function teleprotect (>>> thePlayer <<<)
  local vehicle = getPedOccupiedVehicle(playerSource)  
  if vehicle then 
    setElementVelocity(vehicle,0,0,0) 
    setElementPosition (vehicle, 4131.3872070313, -1759.1988525391, 3) 
  else 
    setElementPosition (playerSource, 4131.3872070313, -1759.1988525391, 3) 
  end 
  outputChatBox ("You Have Been Teleported To The Highway!!", playerSource, 0, 255, 0) 
end 
            local accName = getAccountName(getPlayerAccount(thePlayer))
             if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then
   outputChatBox ( "Server: You are not an owner!", thePlayer, 0, 255, 0 )    
         setElementPosition (thePlayer, 4131.3872070313, -1759.1988525391, 3) 
    else
        outputChatBox (getPlayerName(thePlayer) .. ' #BEBEBEASf ! ', source, 255,255,255,true)
   end
addCommandHandler ("highway", teleprotect) 

You can't just imagine variable names. Consistency matters.

 

 

function healPlayer(>>> player <<<, cmd, name, price)
  if not name or not price then
    outputChatBox("/heal [Player_Name] [Price]", player, 255, 255, 255, true)
  else
      end
    end
      local gang = getPlayerAccount(thePlayer)
   if (gang) then
    if getAccountData(gang, "keks.fraktion") == 3 then
         outputChatBox("hp <name> <price>", thePlayer)
    else
     outputChatBox("You are not a member of Paramedic!", thePlayer, 255, 0, 0)
    end
       end
    local target = getPlayerFromName(name)
    if target then
      if getPlayerMoney(target)>=tonumber(price) then
        takePlayerMoney(target, tonumber(price))
        givePlayerMoney(player, tonumber(price))
        setElementHealth(target, 100)
        outputChatBox(getPlayerName(player) .. " healed you!", player, 255, 255, 255, true)
        outputChatBox("You healed " .. getPlayerName(target), player, 255, 255, 255, true)
      else
        outputChatBox("Can't pay the healing", player, 255, 255, 255, true)
      end
    else
      outputChatBox("I can't find the target!", player, 255, 255, 255, true)
    end
addCommandHandler("heal", healPlayer)

 

 

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