How to make hours of playing system? Ideas?
#1

I'm working on my gamemode from 0, and i want to make really good level system based on hours of playing, is there a way to make hours of playing and save it to .ini file? help please
Reply
#2

make a timer and every minute check if player is connected or logged and give a point or score like this
pawn Код:
enum pInfo
{
pTime
};
new ShitInfo[MAX_PLAYERS][pInfo];
new timer;
OnGameModeInit()
{
timer = SetTimer("CheckTime",60000,1);
return 1;
}
OnGameModeExit()
{
KillTimer(timer);
return 1;
}
forward CheckTime()
Public CheckTime()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
ShitInfo[i][pTime]++;
}
}
return 1;
}
replace ShitInfo you can use put like score, exemple SetPlayerScore(GetPlayerScore(i)+1);
Reply
#3

hmm...i don't want that, i want it just to measure how much minutes player spent online and when he types /onlinetime that script show him how much time he spent online in hours.....and I want it to save to my .ini file
Reply
#4

use that what I gave and make a cmd for show how much time spent and save time on player disconnect
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/onlinetime", cmdtext, true) == 0)
    {
        new string[256];
format(string,256,"( ! ) You have been spent %d minutes on server",ShitInfo[playerid][pTime]);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
return 0;
}
Reply
#5

thanks, can i make it show in hours instead of minutes?
Reply
#6

divide pTime by 60 simple
Reply
#7

ok i made that and its working but can i make Score system based on that...for example when player reaches 300 minutes of playing he gets message Now you're level 2.
Reply
#8

try this:
PHP код:
new HourMinSec;
gettime(HourMinSec); 


if u want just hour do

PHP код:
new Hour;
gettime(Hour); 
Reply
#9

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/onlinetime", cmdtext, true) == 0)
    {
        new string[256];
                 new Hour;
                 gettime(Hour);
format(string,256,"( ! ) You have been spent %d Hours on server",ShitInfo[playerid][pTime]Hour);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
return 0;
}

this good?
Reply
#10

Lol, i solved that problem now command and everything is working perfectly! but how can i make score system based on that?

Example: I play 300 minutes and i get message, Congratz, Now you're level2. And that score changes to 2.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)