SA-MP Forums Archive
Advice + Help - Playing Minutes - 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: Advice + Help - Playing Minutes (/showthread.php?tid=402370)



Advice + Help - Playing Minutes - FL3GM4 - 26.12.2012

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];



Re: Advice + Help - Playing Minutes - rbush12 - 26.12.2012

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


Re: Advice + Help - Playing Minutes - FL3GM4 - 26.12.2012

I forgot to put Timer!

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



Re: Advice + Help - Playing Minutes - Konstantinos - 26.12.2012

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.


Re: Advice + Help - Playing Minutes - FL3GM4 - 26.12.2012

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);



Re: Advice + Help - Playing Minutes - Konstantinos - 26.12.2012

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.


Re: Advice + Help - Playing Minutes - Djole1337 - 26.12.2012

Never mind.


Re: Advice + Help - Playing Minutes - FL3GM4 - 26.12.2012

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.



Re: Advice + Help - Playing Minutes - Konstantinos - 26.12.2012

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


Re: Advice + Help - Playing Minutes - FL3GM4 - 26.12.2012

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