[HELP] Random question exp problem ! -
[Aka]Dragonu - 01.12.2010
Ok , so here's the deal . Exemple if I join the server and i am level 0 and tipe that numbers to answer the question i win 1 exp and some money . The problem is that i don't advance in level . If i answer the R.Q. i will be level 0 and exp 1 , only on payday i will advance the next level .
Explication : If i am level 4 and i answer in 1 hour at 5 R.Q i will be : level 4 and exp 5 , so no level up until payday . I want to solve this problem . If you haven't understand post here i will explain more . Here is the code :
pawn Код:
if(QuestionStarted == 1 && strfind(text[0], Question, false) == 0)
{
new string[128];
format(string, sizeof(string), "%s has won %d$ and +1 exp by typing '%s' the fastest!!!", PlayerName[playerid], RandomQuestionMoney, Question);
SendClientMessageToAll(COLOR_GREEN, string);
GivePlayerMoney(playerid, RandomQuestionMoney);
PlayerInfo[playerid][pExp] ++;
QuestionStarted = 0;
return 0;
}
new string[128];
format(string, sizeof(string), "(%d) %s", playerid, text);
new string2[128];
format(string2, sizeof(string2), "%s(%d) %s", PlayerName[playerid], playerid, text);
SendPlayerMessageToAll(playerid, string);
return 0;
}
Re: [HELP] Random question exp problem ! -
Shadow™ - 01.12.2010
pawn Код:
// Under OnGameModeInit
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetTimerEx("PayDayTimer",3600000, 1, "i", i);
}
public PayDayTimer(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pExp] == AMOUNT)
{
PlayerInfo[playerid][pLevel]++;
}
}
return 1;
}
if(QuestionStarted == 1 && strfind(strlen(text), Question, false) == 0)
{
new string[128];
format(string, sizeof(string), "%s has won %d$ and +1 exp by typing '%s' the fastest!!!", PlayerName[playerid], RandomQuestionMoney, Question);
SendClientMessageToAll(COLOR_GREEN, string);
GivePlayerMoney(playerid, RandomQuestionMoney);
PlayerInfo[playerid][pExp] ++;
QuestionStarted = 0;
return 0;
}
new string[128];
format(string, sizeof(string), "(%d) %s", playerid, text);
new string2[128];
format(string2, sizeof(string2), "%s(%d) %s", PlayerName[playerid], playerid, text);
SendPlayerMessageToAll(playerid, string);
return 0;
}
I don't quite understand if this is what you were looking for but if it is and you require a little more help with it- Feel free to ask, I haven't tested it as I don't want to re-write your whole system to do it. But basically, when the script begins an hour after if they have X amount of EXP they'll advance a level, and if they answer the question correctly they'll get +1 EXP?
Re: [HELP] Random question exp problem ! -
[Aka]Dragonu - 01.12.2010
Yeah . But my R.Q sistem is not working properly . Listen to advance to level 4 for example you need 4 exp . You can answer at 10000 random question and have 10.000 exp you still won't advance to level 5 . Only on payday you advance . For example : The hour is 14:30 . And you have level 4 and answered 5 random question , so you have 5 exp points . You will advance to level 5 at 15:00 , but i want to advance when you have 4 exp points .
That script you posted , it gaves errors and it doesn't help . I think you understand i will post a picture
Here are the pictures :
Picture 1 :
Picture 2 :
Re: [HELP] Random question exp problem ! -
Shadow™ - 01.12.2010
Oh, then you can either:
Use OnPlayerUpdate to detect the amount of EXP he has, and then increase the level.
pawn Код:
public OnPlayerUpdate(playerid)
{
if(PlayerInfo[playerid][pEXP] >= PlayerInfo[playerid][pLevel]+1)
{
PlayerInfo[playerid][pLevel]++;
}
return 1;
}
or
You can create a timer which runs a loop to check all the players, and then do the same in that.
pawn Код:
SetTimer("CheckLevels",5000,1);
public CheckLevels()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(PlayerInfo[playerid][pEXP] >= PlayerInfo[playerid][pLevel]+1)
{
PlayerInfo[playerid][pLevel]++;
}
}
return 1;
}
Re: [HELP] Random question exp problem ! -
[Aka]Dragonu - 01.12.2010
Ok it works , but i have a problem it gives me exp as the amount of level I am . Exemple if i am level 3 and tipe the answer it gives me 3 exp points and i want only 1 . And i want the level to be upgraded automaticly !
Re: [HELP] Random question exp problem ! -
[Aka]Dragonu - 01.12.2010
I did this
pawn Код:
public OnPlayerUpdate(playerid)
{
if(PlayerInfo[playerid][pExp] > PlayerInfo[playerid][pLevel]+1)
{
PlayerInfo[playerid][pExp]++;
}
return 1;
}
, but still the level doesn't goes on automaticly . Any more help ?
Re: [HELP] Random question exp problem ! -
[Aka]Dragonu - 01.12.2010
Bump !!!!
Re: [HELP] Random question exp problem ! -
dice7 - 01.12.2010
You aren't actually leveling the players level, just raising his Exp to infinite values
Re: [HELP] Random question exp problem ! -
[Aka]Dragonu - 01.12.2010
Yeah i saw that but how can i level players ? I mean how can I edit this so the players level up automaticly ?
Re: [HELP] Random question exp problem ! -
Shadow™ - 01.12.2010
pawn Код:
public OnPlayerUpdate(playerid)
{
if(PlayerInfo[playerid][pEXP] >= PlayerInfo[playerid][pLevel]+1)
{
PlayerInfo[playerid][pLevel]++;
PlayerInfo[playerid][pEXP] = 0;
}
return 1;
}