level through score?
#1

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
Reply
#2

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;
}
Reply
#3

If I add it on th top, will give an erro: Undefined symbol : playerid. :
Код:
new PlayerInfo[playerid][pInfo];
Reply
#4

pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#5

Thank you, thought it couldn't be used :P
Reply
#6

Yeah my bad, MAX_PLAYERS
Reply
#7

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.
Reply
#8

Er the threadstarter is already banned why still try help him?
Reply
#9

ahh sorry, didnt notice the little "banned" letters
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)