[HELP] return cmd_enter and cmd_exit with a key ?
#1

DELETED !
Reply
#2

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.
Reply
#3

Hello, are you creating your own game?
Reply
#4

Quote:
Originally Posted by viniciussvl
Посмотреть сообщение
Hello, are you creating your own game?
What has that got to do with this at all?
Reply
#5

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 ..
Reply
#6

Good stuff.
Reply
#7

Oh No .. is there a simple way to detect if player has entered, or is he at Door Interior or Door Exterior ??
Reply
#8

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.
Reply
#9

I Got The Idea !
I've Finally Made it !
I really appreciate your Help ^^ + REP

I think there is a Lot of people out there who need this, so I wanted to Paste it here !
I got something like this in the End :

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	{
	    if (newkeys & KEY_YES)
    	if(PlayerInfo[playerid][pInt] > 0 )
		{
			return cmd_exit(playerid,"");  
		} 
		else return cmd_enter(playerid, "");
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)