SA-MP Forums Archive
It wont do something when pTimeOnline 300? Rep+ for help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: It wont do something when pTimeOnline 300? Rep+ for help (/showthread.php?tid=326512)



It wont do something when pTimeOnline 300? Rep+ for help - iStrow - 17.03.2012

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


Re: It wont do something when pTimeOnline 300? Rep+ for help - Kolten - 17.03.2012

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;




Re: It wont do something when pTimeOnline 300? Rep+ for help - iStrow - 17.03.2012

still not working


Re: It wont do something when pTimeOnline 300? Rep+ for help - park4bmx - 17.03.2012

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 ?


Re: It wont do something when pTimeOnline 300? Rep+ for help - WardenCS - 17.03.2012

Код:
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;
}



Re: It wont do something when pTimeOnline 300? Rep+ for help - iStrow - 18.03.2012

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


Re: It wont do something when pTimeOnline 300? Rep+ for help - iStrow - 18.03.2012

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


AW: It wont do something when pTimeOnline 300? Rep+ for help - Tigerkiller - 18.03.2012

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 ?


Re: It wont do something when pTimeOnline 300? Rep+ for help - park4bmx - 18.03.2012

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!



Re: It wont do something when pTimeOnline 300? Rep+ for help - iStrow - 18.03.2012

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)