SA-MP Forums Archive
Help me:D - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me:D (/showthread.php?tid=194539)



Help me:D - Emanuelll - 29.11.2010

Hello! I installed MySQL Plugin R5 de G-sTyLeZzZ and i modified script (from Moderntopia Roleplay: Los Santos ( http://forum.sa-mp.com/showthread.ph...ght=mtrp-final ), but when i'm login on server (on Windows and on Linux) something is repeated many times... the error maybe at OnPlayerUpdate... cand someone help me... sorry for my English

part from mysql_log Recurring...

mysql_log:
Код:
[08:21:45] CMySQLHandler::Query(UPDATE players SET pSHealth='0.000000',pHealth='100.000000',pArmour='0.000000',Inte=0,Local=255,Team=3,Model=264,PhoneNr=8608,House=255,Car1=0,Car2=0,Car3=0,Car4=0,Bizz=255,Pos_x='2246.000000',Pos_y='-1161.000000' WHERE id=1) - An error has occured. (Error ID: 1054, Unknown column 'Car1' in 'field list')

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(1029.000000); - Escaped 11 characters to 1029.000000.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Pos_z='1029.000000',CarLic=0,FlyLic=0,BoatLic=0,FishLic=0,GunLic=0,MatsLic=0,Gun1=0,Gun2=0,Gun3=0,Gun4=0,Ammo1=0,Ammo2=0,Ammo3=0,Ammo4=0,CarTime=0,PayDay=0,PayDayHad=0,CDPlayer=0,Watch=0,Frec=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Walkie=0,Cigars=0,Matches=0,FTools=0,Wins=0,Loses=0,AlcoholPerk=0,DrugPerk=0,MiserPerk=0,PainPerk=0,TraderPerk=0,Tutorial=1,Sprunk=0,Beer=0,Wine=0,Mission=0,Warnings=0,Adjustable=0,FWarns=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(No-one); - Escaped 6 characters to No-one.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Fpunish=0,Fuel=0,Married=0,MarriedTo='No-one',Updates01=0,Updates02=0,Updates03=0,Updates04=0,Updates05=0,Updates06=0,Updates07=0,Updates08=0,Updates09=0,Updates10=0,Updates11=0,Updates12=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Updates13=0,Updates14=0,Updates15=0,Locked=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_ping( Connection handle: 1 )

[08:21:45] CMySQLHandler::Ping() - Connection is still alive.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(12); - Escaped 2 characters to 12.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Password='12',PlayerLevel=3,AdminLevel=0,GM=0,Helper=0,Wipe=0,DonateRank=0,UpgradePoints=0,ConnectedTime=1,Registered=1,Sex=1,Age=20,Origin=3,CK=0,Muted=0,MuteTime=0,Respect=0,Money=11900 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Bank=50000,Crimes=0,Kills=0,Deaths=0,Arrested=0,WantedLevel=0,WantedPoints=0,WantedDeaths=0,Phonebook=0,LottoNr=0,Fishes=0,BiggestFish=0,Job=0,Paycheck=60,HeadValue=0,Jailed=0,JailTime=0,Materials=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Drugs=0,Leader=0,Member=0,FMember=255,Rank=0,Chara=48,ContractTime=0,DetSkill=0,SexSkill=0,BoxSkill=0,LawSkill=0,MechSkill=0,JackSkill=0,CarSkill=0,NewsSkill=0,DrugsSkill=0,CookSkill=0,FishSkill=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(0.000000); - Escaped 8 characters to 0.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(100.000000); - Escaped 10 characters to 100.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(0.000000); - Escaped 8 characters to 0.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(2246.000000); - Escaped 11 characters to 2246.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(-1161.000000); - Escaped 12 characters to -1161.000000.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET pSHealth='0.000000',pHealth='100.000000',pArmour='0.000000',Inte=0,Local=255,Team=3,Model=264,PhoneNr=8608,House=255,Car1=0,Car2=0,Car3=0,Car4=0,Bizz=255,Pos_x='2246.000000',Pos_y='-1161.000000' WHERE id=1) - An error has occured. (Error ID: 1054, Unknown column 'Car1' in 'field list')

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(1029.000000); - Escaped 11 characters to 1029.000000.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Pos_z='1029.000000',CarLic=0,FlyLic=0,BoatLic=0,FishLic=0,GunLic=0,MatsLic=0,Gun1=0,Gun2=0,Gun3=0,Gun4=0,Ammo1=0,Ammo2=0,Ammo3=0,Ammo4=0,CarTime=0,PayDay=0,PayDayHad=0,CDPlayer=0,Watch=0,Frec=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Walkie=0,Cigars=0,Matches=0,FTools=0,Wins=0,Loses=0,AlcoholPerk=0,DrugPerk=0,MiserPerk=0,PainPerk=0,TraderPerk=0,Tutorial=1,Sprunk=0,Beer=0,Wine=0,Mission=0,Warnings=0,Adjustable=0,FWarns=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(No-one); - Escaped 6 characters to No-one.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Fpunish=0,Fuel=0,Married=0,MarriedTo='No-one',Updates01=0,Updates02=0,Updates03=0,Updates04=0,Updates05=0,Updates06=0,Updates07=0,Updates08=0,Updates09=0,Updates10=0,Updates11=0,Updates12=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Updates13=0,Updates14=0,Updates15=0,Locked=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_ping( Connection handle: 1 )

[08:21:45] CMySQLHandler::Ping() - Connection is still alive.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(12); - Escaped 2 characters to 12.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Password='12',PlayerLevel=3,AdminLevel=0,GM=0,Helper=0,Wipe=0,DonateRank=0,UpgradePoints=0,ConnectedTime=1,Registered=1,Sex=1,Age=20,Origin=3,CK=0,Muted=0,MuteTime=0,Respect=0,Money=11900 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Bank=50000,Crimes=0,Kills=0,Deaths=0,Arrested=0,WantedLevel=0,WantedPoints=0,WantedDeaths=0,Phonebook=0,LottoNr=0,Fishes=0,BiggestFish=0,Job=0,Paycheck=60,HeadValue=0,Jailed=0,JailTime=0,Materials=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET Drugs=0,Leader=0,Member=0,FMember=255,Rank=0,Chara=48,ContractTime=0,DetSkill=0,SexSkill=0,BoxSkill=0,LawSkill=0,MechSkill=0,JackSkill=0,CarSkill=0,NewsSkill=0,DrugsSkill=0,CookSkill=0,FishSkill=0 WHERE id=1) - Successfully executed.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(0.000000); - Escaped 8 characters to 0.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(100.000000); - Escaped 10 characters to 100.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(0.000000); - Escaped 8 characters to 0.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(2246.000000); - Escaped 11 characters to 2246.000000.

[08:21:45] >> mysql_real_escape_string( Connection handle: 1 )

[08:21:45] CMySQLHandler::EscapeString(-1161.000000); - Escaped 12 characters to -1161.000000.

[08:21:45] >> mysql_query( Connection handle: 1 )

[08:21:45] CMySQLHandler::Query(UPDATE players SET pSHealth='0.000000',pHealth='100.000000',pArmour='0.000000',Inte=0,Local=255,Team=3,Model=264,PhoneNr=8608,House=255,Car1=0,Car2=0,Car3=0,Car4=0,Bizz=255,Pos_x='2246.000000',Pos_y='-1161.000000' WHERE id=1) - An error has occured. (Error ID: 1054, Unknown column 'Car1' in 'field list')

[08:21
si OnPlayerUpdate
Код:
 
public OnPlayerUpdate(playerid) // by Luk0r v1.2
{
	if(IsPlayerConnected(playerid))
	{
		if(gPlayerLogged[playerid])
		{
			MySQLCheckConnection();
			new query[MAX_STRING];
			format(query, MAX_STRING, "UPDATE players SET ");
			MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
	                //order code
		}
	}
	return 1;
}
Код:
public MySQLUpdatePlayerInt(query[], sqlplayerid, sqlvalname[], sqlupdateint) // by Luk0r
{
	MySQLUpdateBuild(query, sqlplayerid);
	new updval[64];
	format(updval, sizeof(updval), "%s=%d", sqlvalname, sqlupdateint);
	strcat(query, updval, MAX_STRING);
	return 1;
}

public MySQLUpdatePlayerFlo(query[], sqlplayerid, sqlvalname[], Float:sqlupdateflo) // by Luk0r
{
/*	new query[128];
	format(query, sizeof(query), "UPDATE players SET %s=%f WHERE id=%d", sqlvalname, sqlupdateflo, sqlplayerid);
	mysql_query(query);*/
	new flotostr[32];
	format(flotostr, sizeof(flotostr), "%f", sqlupdateflo);
	MySQLUpdatePlayerStr(query, sqlplayerid, sqlvalname, flotostr);
	return 1;
}

public MySQLUpdatePlayerStr(query[], sqlplayerid, sqlvalname[], sqlupdatestr[]) // by Luk0r
{
	MySQLUpdateBuild(query, sqlplayerid);
	new escstr[128];
	new updval[128];
	//samp_mysql_real_escape_string(sqlupdatestr, escstr);
	mysql_real_escape_string(sqlupdatestr, escstr);
	format(updval, sizeof(updval), "%s='%s'", sqlvalname, escstr);
	strcat(query, updval, MAX_STRING);
	return 1;
}
another suggest to script OnPlayerUpdate ? can someone help me to fix the problem (to not recur Query(UPDATE players SET ...) )

must substitute return 1 with something else? or MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]); .. because there's a bug which is repeated over 20 times OnPlayerUpdate ..


Re: Help me:D - Johnny_Xayc - 30.11.2010

Delete All This code's,and write new code's,this all shit because every function have 1-2 query to MySQL DB,1 player =~100 Enum positions => 200 Query's to MySQL o.k. 20 players *~200 query's = 400 query's

in my code's one player = one query and don't use OnPlayerUpdate
create
pawn Код:
static stock SavePlayer(playerid)
{
// your code
return true;
}
}


Re: Help me:D - Emanuelll - 30.11.2010

it's ok if I do something like?
Код:
 forward OnPlayerUpdateEx(playerid)
public OnPlayerUpdateEx(playerid)
{
//some codes
format(query, sizeof(query), "UPDATE players SET Password='%s' WHERE id=%d", PlayerInfo[playerid][pKey], PlayerInfo[playerid][pSQLID]);
			mysql_query(query);
			format(query, sizeof(query), "UPDATE players SET PlayerLevel='%d' WHERE id=%d", PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pSQLID]);
			mysql_query(query);

// other codes
return 1;
}
or something same with:
Код:
 forward OnPlayerUpdateEx(playerid)
public OnPlayerUpdateEx(playerid)
{
//some codes
format(query, sizeof(query), "UPDATE players SET Password='%s', PlayerLevel='%d' WHERE id=%d", PlayerInfo[playerid][pKey], PlayerInfo[playerid][pLevel],,PlayerInfo[playerid][pSQLID]);
			mysql_query(query);
// other codes
return 1;
}



Re: Help me:D - Johnny_Xayc - 01.12.2010

Код:
stock OnPlayerUpdateEx(playerid)
{
//some codes
format(query, sizeof(query), "UPDATE `players` SET Password='%s', PlayerLevel=%d WHERE id=%d", 
PlayerInfo[playerid][pKey], 
PlayerInfo[playerid][pLevel],
PlayerInfo[playerid][pSQLID]);
mysql_query(query);
mysql_free_result();
// other codes
return 1;
}
Use


Re: Help me:D - Emanuelll - 11.12.2010

Thank You, the problem was at OnPlayerLogin ... i solved it!

Thank You!