having some questions...
#1

Whatґs the difference of return 0 or return 1?

and

i am making a parking sistem so when you type /join, your name is put in "parking.txt" and if you want to open the gate your name must be inside the file

sorry my bad english
Reply
#2

The difrence between return 1 and return 0:
Return 1; (so u can add more script on to it for e.g.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/commands", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,0xAA3333A,"find your command stuff here");
		return 1;
	}
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,0xAA3333A,"Text");
		SendClientMessage(playerid,0xAA3333A,"Text");
		SendClientMessage(playerid,0xAA3333A,"Text");
		return 1;
       }
     return 0;
Return 0; ends that Public (cmd)
thats what it dose i think

im not to sure about the other on lol


hope it helps not much though i guess
Reply
#3

Lol that's wrong. Return means the end of a callback or function. the number beside it determines what value the function or callback will give when it's used.

For example:
pawn Код:
ExampleFunction(playerid)
{
  if(playerid==stupid)return 1;
  if(playerid==bacon)return 5;
  return 0;
}

//someplace else
if(ExampleFunction(24)) // This can equal 1, 5, or 0 depending on what it returns
{
SendClientMessage(playerid,0xFF0000FF,"You suck!");
}else{
SendClientMessage(playerid,0xFF0000FF,"I'm indifferent towards you!");
}
Hope that helps
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)