Jump to content
  • 0

Function return always returning 0


Question

Posted (edited)

Hi, pardon my English, I speak Portuguese.
I'm facing a possible bug in the "return" function, even setting a value in the variable it always returns the value 0. In case the variable .@erro always returns 0, even though I set 1.
Here is the script:

 

callfunc("Transfer",atoi(.transfer$[3]),atoi(.transfer$[4]),atoi(.transfer$[5])); // Calling the function
	if(.@erro) close;
    
	// Function:
	function    script    Transfer    {
	    if(getarg(0) == 1){
        if(zeny < getarg(1)){
            .@erro = 1;
            return .@erro;
            }
        set zeny,zeny-getarg(1);
        return;
        }
        
        if(getarg(0) == 2){
            if(#CASHPOINTS < getarg(1)){
                .@erro = 1;
                return .@erro;
                }
            set #CASHPOINTS,#CASHPOINTS-getarg(1);
            return;
            }
            
            if(getarg(0) == 3){
                if(countitem(getarg(1)) < getarg(2)){
                    .@erro = 1;
                    return .@erro;
                    }
                delitem getarg(1),getarg(2);
                return;
                }
}

 

Edited by Wenden

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

@Edit

Now I have a problem here, when it returns from the function this appears in the mapserver.

If the function is not called nothing appears.

 

Erro 2.JPG

Edited by Wenden

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...