Jump to content
  • 0

Problema contorizare ore .


Sprite_RoPlayers

Question

Buna ziua am si urmatoarea problema.

La fiecare pay day in loc sa`i dea nush o ora jucata ii ia din ore.

Si nu se salveaza in baza de date chiar nu inteleg de la ce este chestia asta.

Folosesc gamemode-ul burned.

SCM(i, COLOR_WHITE, "Salariul tau a sosit! Viziteaza banca pentru a retrage banii.");			
				format(string, sizeof(string), "Ai primit %0.2f ore jucate. (%.0f minute)", PlayerInfo[i][pSeconds]/3600, PlayerInfo[i][pSeconds]/60);
				SCM(i, COLOR_WHITE, string);
				PlayerInfo[i][pConnectTime] += PlayerInfo[i][pSeconds]/3600;
				if(PlayerInfo[i][pSeconds] >= 1800) {
					new query[180];
					format(query, sizeof(query), "UPDATE `users` SET `DayHours`=`DayHours`+1 WHERE `ID`='%d'", PlayerInfo[i][pSQLID]);
					mysql_query(SQL, query);
					format(query, sizeof(query), "UPDATE `users` SET `HoursMonth`=`HoursMonth`+1 WHERE `ID`='%d'", PlayerInfo[i][pSQLID]);
					mysql_query(SQL, query);

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0
Acum 7 ore, iSkull a spus:

Arata tot ce tine de "pConnectTime" si "pSeconds" inclusiv din enum.

enum pInfo {
	Float: pConnectTime, Float: pSeconds;

cmds
	else if(strcmp(item, "hours", true) == 0) {
		if(userid != INVALID_PLAYER_ID) PlayerInfo[userid][pConnectTime] = valoare;
		format(query, sizeof(query), "UPDATE `users` SET `ConnectedTime`='%0.3f' WHERE `name`='%s'", valoare, id);
		mysql_query(SQL, query);
		Update(playerid, pConnectTimex);	
	}

function UpdateSecondary(playerid) {
    if(IsPlayerLogged[playerid] != 0) {
		Update(playerid, pConnectTimex);
		Update(playerid, pBank);
		Update(playerid, pCashx);
		Update(playerid, pRP);
		Update(playerid, pPayDayx);
		Update(playerid, pJailTimex);
		OnPlayerDateUpdateX2(playerid);
	}
	return 1;
}

if(PlayerInfo[i][pSleeping] == 0 && Spectate[i] == 255 && AFKSeconds[i] < 15) PlayerInfo[i][pSeconds] ++;
                                                                             
                PlayerInfo[i][pSeconds] = 0;
				
				if(PlayerInfo[i][pDailyLogin] == 0) {
					PlayerInfo[i][pDailyLogin] = 1;
					UpdateVar(i, "DailyLogin", 1);
					SCM(i, COLOR_LIGHTBLUE, "Ai primit de doua ori mai multe respect points si bani pentru primul tau payday de astazi.");
				}
PlayerInfo[playerid][pSeconds] = cache_get_field_content_float(0, "Seconds");
                                                                             
                                                                             
                                                                             

cam asta am gasit .

Link to comment
Share on other sites

  • 0
	SCM(i, COLOR_WHITE, "Salariul tau a sosit! Viziteaza banca pentru a retrage banii.");            
format(string, sizeof(string), "Ai primit %0.2f ore jucate. (%.0f minute)", PlayerInfo[i][pSeconds]/3600, PlayerInfo[i][pSeconds]/60);
SCM(i, COLOR_WHITE, string);
PlayerInfo[i][pConnectTime] += PlayerInfo[i][pSeconds]/3600;
new query[110];
mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `ConnectTime` = '%.3f' WHERE `ID` = '%d'", PlayerInfo[i][pSQLID]);
mysql_tquery(SQL, query, "", "");
if(PlayerInfo[i][pSeconds] >= 1800)
{
    mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `DayHours`=`DayHours`+1, `HoursMonth`=`HoursMonth`+1 WHERE `ID`='%d'", PlayerInfo[i][pSQLID]);
    mysql_tquery(SQL, query, "", "");
}
	

Faci poza la PayDay cand iti spune cate ore, etc. daca mai ai probleme

Unde vezi ca nu ti se salveaza in DB verifica peste tot ce trimite update-uri catre DB de tip "mysql_query" si le modifici in "mysql_tquery", cum ti'am pus eu mai sus.

Edited by iSkull
Link to comment
Share on other sites

  • 0
Acum 5 ore, CTMBeast a spus:

Niste sfaturi:

  • Nu face 2 query-uri pentru a schimba 2 valori

Si vezi ca nu ai facut sa se salveze timpul in baza de date.

 

Acum 7 ore, iSkull a spus:
	SCM(i, COLOR_WHITE, "Salariul tau a sosit! Viziteaza banca pentru a retrage banii.");            
format(string, sizeof(string), "Ai primit %0.2f ore jucate. (%.0f minute)", PlayerInfo[i][pSeconds]/3600, PlayerInfo[i][pSeconds]/60);
SCM(i, COLOR_WHITE, string);
PlayerInfo[i][pConnectTime] += PlayerInfo[i][pSeconds]/3600;
new query[110];
mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `ConnectTime` = '%.3f' WHERE `ID` = '%d'", PlayerInfo[i][pSQLID]);
mysql_tquery(SQL, query, "", "");
if(PlayerInfo[i][pSeconds] >= 1800)
{
    mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `DayHours`=`DayHours`+1, `HoursMonth`=`HoursMonth`+1 WHERE `ID`='%d'", PlayerInfo[i][pSQLID]);
    mysql_tquery(SQL, query, "", "");
}
	

Faci poza la PayDay cand iti spune cate ore, etc. daca mai ai probleme

Unde vezi ca nu ti se salveaza in DB verifica peste tot ce trimite update-uri catre DB de tip "mysql_query" si le modifici in "mysql_tquery", cum ti'am pus eu mai sus.

In baza de date am pConnectTimex si pSecundex 

Skull o sa pun aceste modificari date de tine acu si o sa revin pe zi cu problema de ore ce acu nu prea mai este nimeni pe sv.

@iSkull

Am adaugat ce mi-ai spus si primesc in mysql_log asta acu

[08:00:02] [ERROR] mysql_format - no value for specifier "%d" available
[08:00:02] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'ConnectTime' in 'field list'

 

Edited by Sprite_RoPlayers
Link to comment
Share on other sites

  • 0
Acum 8 ore, Sprite_RoPlayers a spus:

 

In baza de date am pConnectTimex si pSecundex 

Skull o sa pun aceste modificari date de tine acu si o sa revin pe zi cu problema de ore ce acu nu prea mai este nimeni pe sv.

@iSkull

Am adaugat ce mi-ai spus si primesc in mysql_log asta acu

[08:00:02] [ERROR] mysql_format - no value for specifier "%d" available
[08:00:02] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'ConnectTime' in 'field list'

 

Pai inlocuieste cu "pConnectTimex" si "pSecundex" cum ai tu acolo, eu nu am de unde sa stiu ce ai tu in DB.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.