Levle system !
#1

Hi all im making level system that vould look like this..
level 1 - can use flip
level 2 - antifall
etc...


i have problem.. with this
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
	new idx;
	new Money;
	cmd = strtok(cmdtext, idx);
	Money = GetPlayerMoney(playerid);
	
	if(strcmp("/buylevel", cmdtext, true, 10) == 0)	{
 	if(PlayerInfo[playerid][pLevel] == 0)
	{
		if(Money >= 10000)
  		{
  		SendClientMessage(playerid,COLOR_1,"You Have bought level 1!");
  		PlayerData[playerid][pLevel] == 1)
  		return 1;
  	}
 	}
	else
	if(PlayerInfo[playerid][pLevel] == 1)
	{
		if(Money >= 15000)
  		{
  		SendClientMessage(playerid,COLOR_1,"You Have bought level 2!");
  		PlayerInfo[playerid][pLevel] == 2)
  		flip = 1;
  		return 1;
  		}
 	}
	else
	else if(PlayerInfo[playerid][pLevel] == 2)
	{
 		if(Money >= 20000)
  		{
			SendClientMessage(playerid,COLOR_1,"You Have bought level 3!");
			PlayerInfo[playerid][pLevel] == 3)
			flip = 1;
  	 		return 1;
  	}
 	}
	else
	else if(PlayerInfo[playerid][pLevel] == 3)
	{
 		if(Money >= 40000)
 		{
  		SendClientMessage(playerid,COLOR_1,"You Have bought level 4!");
  		PlayerInfo[playerid][pLevel] == 4)
  		flip = 1;
  		return 1;
  	}
 	}
there is errors..
Код:
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(145) : error 017: undefined symbol "PlayerInfo"
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(145) : warning 215: expression has no effect
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(145) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(145) : error 029: invalid expression, assumed zero
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(145) : fatal error 107: too many error messages on one line
Where i need to write playerinfo etc

other codes
Код:
new PlayerInfo[MAX_PLAYERS][PlayerData];
new pLevel;

enum PlayerData
{
pLevel
}
Reply
#2

Change this:
pawn Код:
new PlayerInfo[MAX_PLAYERS][PlayerData];
new pLevel;

enum PlayerData
{
pLevel
}
to this:
pawn Код:
enum PlayerData
{
  pLevel
}

new PlayerInfo[MAX_PLAYERS][PlayerData];
You also have those weird lines:
pawn Код:
PlayerInfo[playerid][pLevel] == 4)
that should be:
pawn Код:
PlayerInfo[playerid][pLevel] = 4;
Reply
#3

Quote:
Originally Posted by 0rb
You also have those weird lines:
pawn Код:
PlayerInfo[playerid][pLevel] == 4)
that should be:
pawn Код:
PlayerInfo[playerid][pLevel] = 4;
But its about that - if you have 4lvl -1lvl etc..
Reply
#4

No. When you're checking if they are a certain level, you use
pawn Код:
if(PlayerInfo[playerid][pLevel]==4)
But to set their level, you use
pawn Код:
PlayerInfo[playerid][pLevel]=4;
Reply
#5

Quote:
Originally Posted by -The_Badger-
[pawn]if(PlayerInfo[playerid][pLevel]==4)
So this is my error it says that
Код:
[playerid][pLevel]
cant be togather.. (see error upper)
Reply
#6

Код:
enum PlayerData
{
	pLevel
}
new PlayerInfo[MAX_PLAYERS][PlayerData];

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new idx;
	new Money;
	cmd = strtok(cmdtext, idx);
	Money = GetPlayerMoney(playerid);

	if(strcmp("/buylevel", cmdtext, true, 10) == 0)
	{
	 	if(PlayerInfo[playerid][pLevel] == 0)
		{
			if(Money >= 10000)
	  		{
	  			SendClientMessage(playerid,COLOR_1,"You Have bought level 1!");
	  			PlayerData[playerid][pLevel] = 1;
	  			return 1;
	  		}
	 	}
		else if(PlayerInfo[playerid][pLevel] == 1)
		{
			if(Money >= 15000)
	  		{
	  			SendClientMessage(playerid,COLOR_1,"You Have bought level 2!");
	  			PlayerInfo[playerid][pLevel] = 2;
				flip = 1;
	  			return 1;
	  		}
 		}
		else if(PlayerInfo[playerid][pLevel] == 2)
		{
	 		if(Money >= 20000)
	  		{
				SendClientMessage(playerid,COLOR_1,"You Have bought level 3!");
				PlayerInfo[playerid][pLevel] = 3;
				flip = 1;
	  	 		return 1;
	  		}
	 	}
		else if(PlayerInfo[playerid][pLevel] == 3)
		{
	 		if(Money >= 40000)
	 		{
	  			SendClientMessage(playerid,COLOR_1,"You Have bought level 4!");
	  			PlayerInfo[playerid][pLevel] = 4;
	  			flip = 1;
	  			return 1;
	  		}
	 	}
	 	return 1;
	}
	
	/* Other Commands Here */
	return 0;
}
EDIT: Added Badger's comment.
Reply
#7

OnPlayerCommandText should return 0; or it will make any OnPlayerCommandText on other scripts not work.
Also the command needs to return 1; since if level 4s type it, nothing will happen, and it should stop at the end of the command rather than returning 0.
Reply
#8

Quote:
Originally Posted by Anwix
Код:
enum PlayerData
{
	pLevel
}
new PlayerInfo[MAX_PLAYERS][PlayerData];

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new idx;
	new Money;
	cmd = strtok(cmdtext, idx);
	Money = GetPlayerMoney(playerid);

	if(strcmp("/buylevel", cmdtext, true, 10) == 0)
	{
	 	if(PlayerInfo[playerid][pLevel] == 0)
		{
			if(Money >= 10000)
	  		{
	  			SendClientMessage(playerid,COLOR_1,"You Have bought level 1!");
	  			PlayerData[playerid][pLevel] = 1;
	  			return 1;
	  		}
	 	}
		else if(PlayerInfo[playerid][pLevel] == 1)
		{
			if(Money >= 15000)
	  		{
	  			SendClientMessage(playerid,COLOR_1,"You Have bought level 2!");
	  			PlayerInfo[playerid][pLevel] = 2;
				flip = 1;
	  			return 1;
	  		}
 		}
		else if(PlayerInfo[playerid][pLevel] == 2)
		{
	 		if(Money >= 20000)
	  		{
				SendClientMessage(playerid,COLOR_1,"You Have bought level 3!");
				PlayerInfo[playerid][pLevel] = 3;
				flip = 1;
	  	 		return 1;
	  		}
	 	}
		else if(PlayerInfo[playerid][pLevel] == 3)
		{
	 		if(Money >= 40000)
	 		{
	  			SendClientMessage(playerid,COLOR_1,"You Have bought level 4!");
	  			PlayerInfo[playerid][pLevel] = 4;
	  			flip = 1;
	  			return 1;
	  		}
	 	}
	 	return 1;
	}
	
	/* Other Commands Here */
	return 0;
}
EDIT: Added Badger's comment.
The same error's
Reply
#9

Which line has this error on it? Also what are the 2 lines above it.
Reply
#10

HerE is the pastebin -
http://pastebin.com/f56bedcf7

errors
Код:
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(144) : error 017: undefined symbol "PlayerInfo"
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(144) : warning 215: expression has no effect
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(144) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(144) : error 029: invalid expression, assumed zero
C:\DOCUME~1\User\Desktop\LEVELS~1.PWN(144) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)