It wont do something when pTimeOnline 300? Rep+ for help
#1

Ok, i have quite bit of problem here, I was making my LevelUp system but I got stuck. I made timeonline system that is working perfectly and i want to make level system based on that now

here is what I did

System that that adds 1 to pTimeOnline for every minute spent on server, and that is working perfectly, it loads my time when i log in and it saves it when i go out but i wanted to make this now....

pawn Код:
forward AddLevel2(playerid);
public AddLevel2(playerid)
{
if(playerid, PlayerInfo[playerid][pTimeOnline] == 300) {
    PlayerInfo[playerid][pLevel]+1;
    return SendClientMessage(playerid,0xFF0000FF,"Info: Congratz! Now you are level 2.");
}
return 1;
}
So that it adds 1 to pLevel when pTimeOnline300 and send client a message that he is level 2.

But it is now working it is not adding anything to pLevel and it won't send message to player when he reaches 300 minutes online.

Help please! Here is whole script.

http://pastebin.com/ESUZ0BdV
Reply
#2

Try this:
PHP код:
public AddLevel2(playerid)
{
     if(
PlayerInfo[playerid][pTimeOnline] == 300)
     {
          
PlayerInfo[playerid][pLevel] += 1;
          
SendClientMessage(playerid,0xFF0000FF,"Info: Congratz! Now you are level 2.");
     }
     return 
1;

Reply
#3

still not working
Reply
#4

Quote:
Originally Posted by AlExAlExAlEx
Посмотреть сообщение
pawn Код:
public AddLevel2(playerid)
{
     if(PlayerInfo[playerid][pTimeOnline] < 300)
     {
          PlayerInfo[playerid][pLevel] += 1;
          SendClientMessage(playerid,0xFF0000FF,"Info: Congratz! Now you are level 2.");
     }
     return 1;
}
he is looking for 300 exactly pTimeOnline variable to be!
so i would say change the < to >= just incase it goes over 300 !

Check if pTimeOnline is currectly sotored as a global variable !
Also run a tea with a smaller timer e.g 1,2 mins ?
Reply
#5

Код:
forward AddLevel2(playerid);
public AddLevel2(playerid)
{
if(PlayerInfo[playerid][pTimeOnline] == 300) 
{
	PlayerInfo[playerid][pLevel] += 1;
	SendClientMessage(playerid,0xFF0000FF,"Info: Congratz! Now you are level 2.");
}
return 1;
}
Reply
#6

it is cleary that problem is not in

PlayerInfo[playerid][pLevel] += 1;

since it doesn't give me message too....problem is in if part, more correctly, how the script will know that player have 300? it should check that every minute but i don't know how to make it

i'll try to solve command and see what happens if I type it
Reply
#7

hell i was right, i made command for test and when i type it and if pTimeOnline is 300 it gives me message and add level, so i need to make something that will check every minute is pTimeOnline 300? rite? now how can i make that
Reply
#8

if(pTimeOnlinr[playerid] >= 299 && pTimeOnline[playerid] <= 301)

if this doesent work put in OnPlayerConnect

pTimeOnline[playerid] = 298;

and wait 2 or 3 mins
did it works ?
Reply
#9

No no no
U means the public "AddLevel2" is not called ?
A d when the "pOnlineTimer" reaches 300 the "AddLevel2" callback cannot be called becouse there is nothing updating it!
What I would say is every minute u add =+ 1 to the "POnlineTimer" in the same call back add this AddLevel2(playerid) So in that case the callback gets called so then everything else will work two!
Reply
#10

mother of god! i already had checktime function only i needed to ad this to that same callback! it is all working now! thank you man! rep+ for you (i would give you thousand if i could)
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)