Jump to content

[Help] Confirm command


Wumbaloo

Recommended Posts

Hey, I tried to confirm a command like 2 functions, but it don't work, can you help me?

I want to confirm the animation, and if it's confirmed, then do the Kissing animation.

I don't do the function to get the nearbiest of the target player.

function confirmKiss(sourcePlayer, targetPlayerName, command, confirm) 
        targetPlayer = getPlayerName(targetPlayerName) 
        if confirm == "/confirm" then 
                setPedAnimation(sourcePlayer, "KISSING", "Grlfrd_Kiss_02") 
                setPedAnimation(targetPlayer, "KISSING", "Playa_Kiss_02") 
        else 
                outputChatBox("Un de vous deux n'a pas confirmé!", targetPlayer, 255, 0, 0) 
                outputChatBox("Un de vous deux n'a pas confirmé!", sourcePlayer, 255, 0, 0) 
        end 
end 
addCommandHandler("confirmK", confirmKiss) 
  
function kissPlayer(sourcePlayer, command, targetPlayerName) 
        targetPlayer = getPlayerName(targetPlayerName) 
        outputChatBox(getPlayerName(targetPlayer) .. " veut vous embrasser, tapez /confirmK pour accepter.", sourcePlayer) 
        confirmKiss() 
end 
addCommandHandler("kiss", kissPlayer) 

Link to comment

What is this line

if confirm == "/confirm" then 

Supposed to do? As far as I can tell confirm would return nil(always check your debug! It should be the first thing you start before you start scripting).

For that statement to pass, you would need to write the command like this;

/confirmK PlayerNameHere /confirm

And that doesn't make a whole lot of sense, does it?

Link to comment

It's supposed to work like that:

Player 1 want to kiss or to handshake Player 2, he write: "/kiss Player2"

Player 2 get a message: "You received a proposition to kiss him: " .. Player1 .. "Write: /confirm to do it"

Player 2 write /confirm and then, if the Players are near, do the animation, if not, cancel like he don't want to /confirm

The line is to confirm

Link to comment
  
function asking (source, cmd, target) 
    local target = getPlayerFromName (target) 
    outputChatBox ("* "..getPlayerName (source).." has asked you for a kiss, /confirm or /ignore it.", target, 255, 255, 255) 
    addCommandHandler ("confirm", 
        function (player) 
            if (player == target) then 
                outputChatBox ("* "..getPlayerName (target).." has accepted your kissing offer.", source, 255, 255, 255) 
                --do animations here 
            end 
        end 
    ) 
end 
addCommandHandler ("kiss", asking) 
  

just replace animations and fix any possible bug

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