Help on Setting and Checking for flags.

Sorry to bother once again; but in the months I’ve learned scripting, I’ve had to do it all alone and it’s nice to finally have help. I want to know if anybody could possibly show me a simple script that would teach me how to set flags. The reason is because I would like to create a hat system that only allows you to buy a hat once. So with learning how to set flags, I would also need to learn how to check for them. If I’m in the wrong section, sorry. This has just been killing me because I haven’t been able to find out how. :suicide:
I’m really not trying to ask for anything special, I just need an understanding of them.

[code]if(playerenters) {
set YouAreHere;

if (YouAreHere) {
setani sit;
} else {
setplayerprop #c,Where the fuck am I?;

OMFG lol wow it’s that simple? Thanks dude once again!

lol, no problem.
By the way I had a typo stuck up there. I had “setflag” stuck in my head. The command is just “set”, haha.

That explains my problem lol. Once again thanks.
P.S. : Can you explain to me why the else function is in that script and what it does?

if (condition) {
} else {

It is a basic element of an if statement. If the condition inside the if statement returns true, stuff will execute. If it returns false, stuff2 will execute.

He just used it as an example.

Ohhh. So that’s why (by using Beholders’ script), the player chats “Where the fuck am I?” while the flag is false! Thanks Nalin and Beholder once again.