level through score? -
xfelipex - 08.08.2010
I'd like to use a new string (level), not scores. So, it'd be :
Код:
if(IsPlayerInArea(playerid,x,y,z)) {
if(level[playerid] <= 9) {
return SetPlayerHealth(playerid, 0.0);
}
else
{
}
return 1;
}
Anyone know how? it'd be according scores that I'd define
Re: level through score? -
Dudits - 08.08.2010
First I suggest using an enum, so add this to the begin of your script.
pawn Код:
enum pInfo
{
pLvl
}
new PlayerInfo[playerid][pInfo];
The pLvl is where you're going to store your score.
You're going to use this format to check the level "PlayerInfo[playerid][pLvl]"
Now you will need to make the pLvl up-to-date, so put this to your OnPlayerUpdate
pawn Код:
if(GetPlayerScore(playerid) != PlayerInfo[playerid][pLvl])
{
PlayerInfo[playerid][pLvl] = GetPlayerScore(playerid);
}
This will basically check on every "OnPlayerUpdate" if your PlayerInfo[playerid][pLvl]" is your current score, if it is then nothing will happen, else it will set your "PlayerInfo[playerid][pLvl]" to your current score.
Now the code you posted should be like this.
pawn Код:
if(IsPlayerInArea(playerid,x,y,z)) {
if(PlayerInfo[playerid][pLvl] <= 9) {
return SetPlayerHealth(playerid, 0.0);
}
else
{
}
return 1;
}
Re: level through score? -
xfelipex - 08.08.2010
If I add it on th top, will give an erro: Undefined symbol : playerid. :
Код:
new PlayerInfo[playerid][pInfo];
Re: level through score? -
[XST]O_x - 08.08.2010
pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
Re: level through score? -
xfelipex - 08.08.2010
Thank you, thought it couldn't be used :P
Re: level through score? -
Dudits - 10.08.2010
Yeah my bad, MAX_PLAYERS
Re: level through score? -
DiddyBop - 10.08.2010
level for score..
pawn Код:
stock SetLevel(playerid)
{
switch(GetPlayerScore(playerid)
{
case 0 .. 50: SetPVarInt(playerid, "pLvl", 1); // 0 to 50 score
case 51 .. 100: SetPVarInt(playerid, "pLvl", 2); //51 to 100 score
case 101 .. 150: SetPVarInt(playerid, "pLvl", 3); //101 to 150 score
case 151 .. 200: SetPVarInt(playerid, "pLvl", 4); //151 to 200 score
case 201 .. 250: SetPVarInt(playerid, "pLvl", 5); //201 to 250 score.
default: SetPVarInt(playerid, "pLvl", 5);
}
}
Didnt compile, Not sure if will work but it looks like it to mez.
Re: level through score? -
Retardedwolf - 10.08.2010
Er the threadstarter is already banned why still try help him?
Re: level through score? -
DiddyBop - 10.08.2010
ahh sorry, didnt notice the little "banned" letters