Jump to content

Script Error, help.


Recommended Posts

Here, In this script i have something wrong, i don't understand. This script is for reviving players, after their death, when i try to /revive [player name or even id] It returns to that "else"

                else 
                    outputChatBox ("There's no online player with this name.", source) 

However, the player's available..... What's wrong here?

server:

  Reveal hidden contents
Link to comment
  TAPL said:
Remove local from line 6 and 8. And change source to user.

Still nothing..

I believe, it won't do change, as 'source' is the handler of the command, and local will work, as the script's still in the same function, yup? Anyways, help please :/ !

addCommandHandler ("revive", function(user, cmd, user2) 
        if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( user ) ), aclGetGroup ( "Admin" ) ) then 
            if cmd and user2 then 
                local ID = tonumber(user2) 
                  if ID then 
                    local target = exports.ID_System:getPlayerFromID(ID) 
                  else 
                    local target = exports.ID_System:getPlayerFromPartialName(user2) 
                end 
            if target then 
                if isPedDead(target) then 
                local x, y, z = getElementPosition (target) 
                    spawnPlayer(target, x, y, z) 
                else 
                    outputChatBox("This player is still alive", user) 
            end 
                else 
                    outputChatBox ("There's no online player with this name.", user) 
            end 
                else 
                    outputChatBox ("[syntax] /revive [iD/Partial Name]", user) 
        end 
    end 
end) 

Link to comment
  EngMohamedLish said:
  TAPL said:
Nope, it restricted inside the if statement.

You are totally Right :) ! Thanks for your help, man.

But, here's something:

target = exports.ID_System:getPlayerFromPartialName(user2) 

This part, doesn't work, as when i write a player name, it returns to the same 'else' which i showed, before. But, when i write a player ID, it works fine.

Link to comment
  TAPL said:
I guess there might be something wrong with the function getPlayerFromPartialName.
  Reveal hidden contents

Here's the function.

Link to comment
  EngMohamedLish said:
  TAPL said:
I guess there might be something wrong with the function getPlayerFromPartialName.
  Reveal hidden contents

Here's the function.

It is in the same script, which is ID_system, I think it may help?

  Reveal hidden contents
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...