What is the best way for saving guns?
#1

Hello!
I'm using this method for saving gun but I'm worried about this. I want the know what's your method about saving guns?

Here is mine:

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	new
		tmp_accguns[13][2],
		tmp_string[64],
		query[516];

	for(new i = 0; i <= 12; i++)
	{
		GetPlayerWeaponData(playerid, i, tmp_accguns[i][0], tmp_accguns[i][1]);
	}

	for(new i = 0; i <= 12; i++)
	{
		format(tmp_string, sizeof(tmp_string), "weapon%d", i);
		mysql_format(mysql, query, sizeof(query), "UPDATE `hesaplar` SET `%s`=%d WHERE `sqlid`=%d", tmp_string, tmp_accguns[i][0], hesap[playerid][sqlid]);
		mysql_tquery(mysql, query, "", "");

		format(tmp_string, sizeof(tmp_string), "ammo%d", i);
		mysql_format(mysql, query, sizeof(query), "UPDATE `hesaplar` SET `%s`=%d WHERE `sqlid`=%d", tmp_string, tmp_accguns[i][1], hesap[playerid][sqlid]);
		mysql_tquery(mysql, query, "", "");
	}

	new
		tmp_satir[64];

    for(new i = 0; i <= 12; i++)
	{
	    format(tmp_satir, sizeof(tmp_satir), "weapon%d", i);
	    hesap_weaponlar[playerid][i][0] = cache_get_field_content_int(0 , tmp_satir);

    	format(tmp_satir, sizeof(tmp_satir), "ammo%d", i);
    	hesap_weaponlar[playerid][i][1] = cache_get_field_content_int(0 , tmp_satir);
	}
    return true;
}
Reply
#2

bump
Reply
#3

Your server will probably get a heart attack if 50 players use a minigun.
Reply
#4

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Your server will probably get a heart attack if 50 players use a minigun.
Yes, I know this but what else i do?

Timer per second. (trash)
OnPlayerUpdate. (so trash)
OnPlayerWeaponShoot. (trash but acceptable)

Please help me!
Reply
#5

Fixed.
Reply
#6

Array, man. Save weapons on disconnect.
Reply
#7

I suggest you read this tutorial of mine.
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
I suggest you read this tutorial of mine.
Thanks sir, +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)