Advice + Help - Playing Minutes
#1

1. In need advice: Can "RemoveBuilding"'s make lagg on my server so much ?

2. Need HELP!
My "Playing Minutes don't working right!

enum
Код:
Minute,
onplayerspawn
Код:
        format(string, sizeof(string), "*Tvoji statsi: Minuta online: [%d]",PlayerInfo[playerid][Minute]);
loaduserdata
Код:
    INI_Int("Minute", PlayerInfo[playerid][Minute]);
Код:
funkcija Online(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		PlayerInfo[playerid][Minute] = PlayerInfo[playerid][Minute] + 1;
	}
	return 1;
}
onplayerregister
Код:
    INI_WriteInt(playerFile, "Minute", 0);
Код:
    PlayerInfo[playerid][Minute] = 0;
onplayerlogout
Код:
    INI_WriteInt(playerFile, "Minute", PlayerInfo[playerid][Minute]);
stats!
Код:
    new pla = PlayerInfo[targetid][Minute];
Reply
#2

1. Not that I know of, although the CreateObject you put in may make it lag a small bit.
Reply
#3

I forgot to put Timer!

Код:
SetTimer("Online",60000, true);
Reply
#4

1. No, this function doesn't lag as far as I know.

2. I can't see anything wrong with the code you gave us. Howeve, I'd like to explain us what it doesn't work and how you want it to work. By the way, can you post the code that you create the timer (SetTimer or SetTimerEx).

EDIT: I just saw your message.
Reply
#5

I put Timer !

Well, i want that every minute give me 1 Playing Minute in my account ...

it didnt working, it didnt showing in /stats

this is in my function stats:

Код:
    new pla = PlayerInfo[targetid][Minute];
Код:
    format(coordsstring, sizeof(coordsstring), "Novac: [$%d] Minuta online: [%d] Warn: [%d]", cash, pla, warnA);
Reply
#6

pawn Код:
// Global variable
new
    OnlineTimer[ MAX_PLAYERS ]
;

public OnPlayerConnect( playerid )
{
    OnlineTimer[ playerid ] = SetTimerEx( "Online", 60000, true, "i", playerid );
    return 1;
}

public OnPlayerDisconnect( playerid, reason )
{
    KillTimer( OnlineTimer[ playerid ] );
    return 1;
}

forward Online( playerid );
public Online( playerid )
{
    PlayerInfo[targetid][Minute] += 1;
    return 1;
}
@Mr_DjolE
- It's same.
pawn Код:
PlayerInfo[targetid][Minute] += 1;
// OR
PlayerInfo[targetid][Minute]++;
// OR
PlayerInfo[targetid][Minute] = PlayerInfo[targetid][Minute] + 1;
All these will add +1 on the variable.
Reply
#7

Never mind.
Reply
#8

i deleted:
Код:
funkcija Online(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		PlayerInfo[playerid][Minute] = PlayerInfo[playerid][Minute] + 1;
	}
	return 1;
}
and i have this error:
Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod2.pwn(4671) : error 017: undefined symbol "targetid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#9

Use what I gave you above, it is what you need. Also, about the error. Can you show us lines 4670 - 4672?
Reply
#10

Код:
forward Online( playerid );
public Online( playerid )
{
(4671)    PlayerInfo[targetid][Minute] += 1;
    return 1;
}
well ... i put everything you gave me ... i just delete - (see in post above)

did I make it right ?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)