RegistrationStep help!!
#1

Hello. I'm working on a RegistrationStep so you can choose not to follow the tutorial:

Код:
	}
	if(RegistrationStep[playerid] > 0)
	{
	  if(RegistrationStep[playerid] == 1)
	  {
	    new idx;
	  	tmp = strtok(text, idx);
		  if((strcmp("male", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("male")))
			{
			  PlayerInfo[playerid][pSex] = 1;
			  SendClientMessage(playerid, COLOR_YELLOW2, "You are a Male.");
			  SendClientMessage(playerid, COLOR_LIGHTRED, "When is your birthday? Type: dd/mm/yyyy.");
			  new maleskin;
			  maleskin = random(sizeof(CivMalePeds));
			  SetPlayerSkin(playerid, maleskin);
			  PlayerInfo[playerid][pChar] = maleskin;
			  RegistrationStep[playerid] = 2;
			  return 0;
			}
			else if((strcmp("female", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("female")))
			{
			  PlayerInfo[playerid][pSex] = 2;
			  SendClientMessage(playerid, COLOR_YELLOW2, "You are a Female.");
			  SendClientMessage(playerid, COLOR_LIGHTRED, "When is your birthday? Type: dd/mm/yyyy.");
			  new femaleskin;
			  femaleskin = random(sizeof(CivFemalePeds));
			  SetPlayerSkin(playerid, femaleskin);
			  SetPlayerSkin(playerid, femaleskin);
			  PlayerInfo[playerid][pChar] = femaleskin;
			  RegistrationStep[playerid] = 2;
			  return 0;
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTRED, "What are you? A Male or a Female? Type in what you are.");
			}
			return 0;
		}
		else if(RegistrationStep[playerid] == 2)
	  {
	    new year, month,day;
			getdate(year, month, day);
	    new DateInfo[3][20];
			split(text, DateInfo, '/');
			if(year - strvalEx(DateInfo[2]) > 100 || strvalEx(DateInfo[2]) < 1 || strvalEx(DateInfo[2]) >= year)
			{
			  SendClientMessage(playerid, COLOR_LIGHTRED, "When is your birthday? Type: dd/mm/yyyy.");
			  return 0;
			}
			new check = year - strvalEx(DateInfo[2]);
			if(check == year)
			{
			  SendClientMessage(playerid, COLOR_LIGHTRED, "When is your birthday? Type: dd/mm/yyyy.");
			  return 0;
			}
			if(strvalEx(DateInfo[1]) > month)
			{
			  check -= 1;
			}
			else if(strvalEx(DateInfo[1]) == month && strval(DateInfo[0]) > day)
			{
			  check -= 1;
			}
			PlayerInfo[playerid][pAge] = check;
			format(string, sizeof(string), "You are %d year old.",PlayerInfo[playerid][pAge]);
			SendClientMessage(playerid, COLOR_YELLOW2, string);
			RegistrationStep[playerid] = 3;
			SendClientMessage(playerid, COLOR_LIGHTRED, "What is your origin? Type: USA, Europe, Asia or Africa.");
			return 0;
	  }
	  else if(RegistrationStep[playerid] == 3)
	  {
	    new idx;
	  	tmp = strtok(text, idx);
		  if((strcmp("usa", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("usa")))
			{
			  PlayerInfo[playerid][pOrigin] = 1;
			  SendClientMessage(playerid, COLOR_YELLOW2, "OK, so you are from the United States of America.");
 			 	SendClientMessage(playerid, COLOR_LIGHTRED, "Thank you for filling in all the information, you will now proceed to the Tutorial.");
        RegistrationStep[playerid] = 4;
  			SendClientMessage(playerid, COLOR_LIGHTRED, "Do you want to see the tutorial? Type: Yes or No.");
				return 0;
			}
			else if((strcmp("europe", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("europe")))
			{
			  PlayerInfo[playerid][pOrigin] = 2;
			  SendClientMessage(playerid, COLOR_YELLOW2, "OK, so you are from Europe.");
        RegistrationStep[playerid] = 4;
  			SendClientMessage(playerid, COLOR_LIGHTRED, "Do you want to see the tutorial? Type: Yes or No.");
				return 0;
			}
			else if((strcmp("asia", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("asia")))
			{
			  PlayerInfo[playerid][pOrigin] = 3;
			  SendClientMessage(playerid, COLOR_YELLOW2, "OK, so you are from Asia.");
        RegistrationStep[playerid] = 4;
  			SendClientMessage(playerid, COLOR_LIGHTRED, "Do you want to see the tutorial? Type: Yes or No.");
				return 0;
			}
			else if((strcmp("africa", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("africa")))
			{
			  PlayerInfo[playerid][pOrigin] = 4;
			  SendClientMessage(playerid, COLOR_YELLOW2, "OK, so you are from Africa.");
  			SendClientMessage(playerid, COLOR_LIGHTRED, "Do you want to see the tutorial? Type: Yes or No.");
        RegistrationStep[playerid] = 4;
				return 0;
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTRED, "What is your origin? Type: USA, Europe, Asia or Africa.");
	  }
	  else if(RegistrationStep[playerid] == 4)
	  {
	  	new idx;
	  	tmp = strtok(text, idx);
	  	if ((strcmp("yes", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("yes")))
		  {
 				RegistrationStep[playerid] = 0;
			  TutTime[playerid] = 1;
			  return 0;
			}
			else if((strcmp("no", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("no")))
			{
				MedicBill[playerid] = 0;
				AfterTutorial[playerid] = 1;
				SetTimerEx("UnsetAfterTutorial", 2500, false, "playerid", playerid);
				SetTimerEx("UnsetFirstSpawn", 5000, false, "playerid", playerid);
				SetPlayerSpawn(playerid);
				TogglePlayerControllable(playerid, 1);
				return 0;
				}
			}
		}
	}
That is the full code. It still gives errors like:

Код:
C:\Users\Dol\Desktop\Artificial Server Files\gamemodes\frp.pwn(42076) : error 029: invalid expression, assumed zero
C:\Users\Dol\Desktop\Artificial Server Files\gamemodes\frp.pwn(42076) : warning 215: expression has no effect
C:\Users\Dol\Desktop\Artificial Server Files\gamemodes\frp.pwn(42076) : error 001: expected token: ";", but found "if"
C:\Users\Dol\Desktop\Artificial Server Files\gamemodes\frp.pwn(42078) : warning 219: local variable "idx" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Please help.
Reply
#2

Tell us where that line is?
Reply
#3

I've added alot of lines, just lookup:

SendClientMessage(playerid, COLOR_LIGHTRED, "What is your origin? Type: USA, Europe, Asia or Africa.");
Reply
#4

Quote:
Originally Posted by doL`
I've added alot of lines, just lookup:

SendClientMessage(playerid, COLOR_LIGHTRED, "What is your origin? Type: USA, Europe, Asia or Africa.");
That isn't line 42076. Send us the correct line 42076.
Reply
#5

Код:
 }
	  else if(RegistrationStep[playerid] == 4)
	  {
	  	new idx;
	  	tmp = strtok(text, idx);
	  	if ((strcmp("yes", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("yes")))
		  {
 				RegistrationStep[playerid] = 0;
			  TutTime[playerid] = 1;
			  return 0;
			}
			else if((strcmp("no", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("no")))
			{
				MedicBill[playerid] = 0;
				AfterTutorial[playerid] = 1;
				SetTimerEx("UnsetAfterTutorial", 2500, false, "playerid", playerid);
				SetTimerEx("UnsetFirstSpawn", 5000, false, "playerid", playerid);
				SetPlayerSpawn(playerid);
				TogglePlayerControllable(playerid, 1);
				return 0;
				}
			}
		}
	}
Reply
#6

well on line 42078, delete:
pawn Код:
new tmp[128];
and line 42076, you're missing a ; at the end or the line before.
Reply
#7

I don't see any new tmp[128];

When I deleted the new idx I still got these errors:

Код:
C:\Users\Dol\Desktop\Artificial Server Files\gamemodes\frp.pwn(42076) : error 029: invalid expression, assumed zero
C:\Users\Dol\Desktop\Artificial Server Files\gamemodes\frp.pwn(42076) : warning 215: expression has no effect
C:\Users\Dol\Desktop\Artificial Server Files\gamemodes\frp.pwn(42076) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#8

what are on lines:

42075-42077
Reply
#9

}
else if(RegistrationStep[playerid] == 4)
{
Reply
#10

Please help. These errors have been annoying me since the beginning, for some reason it just doesn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)