Posts: 6,242
Threads: 8
Joined: Jun 2008
You cannot do multiple returns in a section of code... You need to use if or case statements to pick what it's doing...
Otherwise it will always hit the first one, and it will be it... Anything further on is discarded.
You need to read how to use if statements along with functions, rather than returning anything.
What you're trying to do will require an if statement at least, as you're needing "If player has entered, do this, else, do this..."
You're simply going into the code and saying "execute this, and return to normal routine" with 'routine' being everything else in the script. NOT what was in that segment of code that it was originally looking at.
Posts: 174
Threads: 40
Joined: Aug 2014
Reputation:
0
Hello, are you creating your own game?
Posts: 6,242
Threads: 8
Joined: Jun 2008
Quote:
Originally Posted by viniciussvl
Hello, are you creating your own game?
|
What has that got to do with this at all?
Posts: 75
Threads: 10
Joined: Jan 2017
Reputation:
0
Okay Thanks so much "Sew_Sumi" !
I've really Understood something now, So, I'm gonna stick with the "If player has entered, do this, else, do this..." And I'll try to make it work, then I'll copy/paste my code here and let you check it if it's good or not !!
Thanks again.
And "viniciussvl", Yeah I'm tryin' my best, it's a RP server ..
Posts: 6,242
Threads: 8
Joined: Jun 2008
Posts: 75
Threads: 10
Joined: Jan 2017
Reputation:
0
Oh No .. is there a simple way to detect if player has entered, or is he at Door Interior or Door Exterior ??
Posts: 6,242
Threads: 8
Joined: Jun 2008
You set a variable for all players, tracking the interior they've entered.
Upon entering you can set it to the interior they entered, and with this, you can also check whether they are outside.
This will go hand in hand with the initial check you should be doing instead of having the 2 returns.
Код:
new InteriorIDforPlayer[MAX_PLAYERS];
if(InteriorIDforPlayer[playerid]){return cmd_exit(playerid,"");} //If anything higher than 0, it will return true
else return cmd_enter(playerid, ""); // else it will /enter
This isn't tested at all and you will need to work with it, but that's the "idea" of it.
You will want to learn some if statement and return information though in this, as I am sure this code will be buggered, but it is simply to show the concept of using the variable to track the player interior status.