SA-MP Forums Archive
Stock not working. - 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: Stock not working. (/showthread.php?tid=611711)



Stock not working. - danielpalade - 10.07.2016

I've tried to create a stock to load the vehicles per player.
But it won't work.
This is the "callback" which calls the stock:

Код:
LoadUserVeh(extraid);
And this is the stock:

Код:
stock LoadUserVeh(extraid)
{
	new quer[128];
	format(quer, sizeof(quer), "SELECT * FROM `uservehicles` WHERE `vehicleOwner` = '%d'", playerVariables[extraid][pInternalID]);
	new Cache: result4 = mysql_query(handle, quer);
	new x, count, countveh, c;
	for(new z = 0; z < MAX_VEHICLES; z++)
	{
		c = GetVehicleModel(z);
		if(c >= 400)
		{
			countveh++;
		}
	}
 	for ( new i, j = cache_get_row_count ( ); i != j; ++i )
	{
		cache_get_field_content(i, "vehicleID", result); x = strval(result);
		vehStat[x][vID] = x;
		cache_get_field_content(i, "vehicleModelID", result); vehStat[x][vModelID] = strval(result);
		cache_get_field_content(i, "vehiclePosX", result); vehStat[x][vPosX] = floatstr(result);
		cache_get_field_content(i, "vehiclePosY", result); vehStat[x][vPosY] = floatstr(result);
		cache_get_field_content(i, "vehiclePosZ", result); vehStat[x][vPosZ] = floatstr(result);
		cache_get_field_content(i, "vehiclePosRot", result); vehStat[x][vPosR] = floatstr(result);
		cache_get_field_content(i, "vehicleOwner", result); vehStat[x][vOwnerID] = strval(result);
		cache_get_field_content(i, "vehicleOwnerName", result); format(vehStat[x][vOwnerName], MAX_PLAYER_NAME, "%s", result);
		cache_get_field_content(i, "vehicleMod1", result); vehStat[x][vMod1] = strval(result);
		cache_get_field_content(i, "vehicleMod2", result); vehStat[x][vMod2] = strval(result);
		cache_get_field_content(i, "vehicleMod3", result); vehStat[x][vMod3] = strval(result);
		cache_get_field_content(i, "vehicleMod4", result); vehStat[x][vMod4] = strval(result);
		cache_get_field_content(i, "vehicleMod5", result); vehStat[x][vMod5] = strval(result);
		cache_get_field_content(i, "vehicleMod6", result); vehStat[x][vMod6] = strval(result);
		cache_get_field_content(i, "vehicleMod7", result); vehStat[x][vMod7] = strval(result);
		cache_get_field_content(i, "vehicleMod8", result); vehStat[x][vMod8] = strval(result);
		cache_get_field_content(i, "vehicleMod9", result); vehStat[x][vMod9] = strval(result);
		cache_get_field_content(i, "vehicleMod10", result); vehStat[x][vMod10] = strval(result);
		cache_get_field_content(i, "vehicleMod11", result); vehStat[x][vMod11] = strval(result);
		cache_get_field_content(i, "vehicleMod12", result); vehStat[x][vMod12] = strval(result);
		cache_get_field_content(i, "vehicleMod13", result); vehStat[x][vMod13] = strval(result);
		cache_get_field_content(i, "vehicleMod14", result); vehStat[x][vMod14] = strval(result);
		cache_get_field_content(i, "vehicleMod15", result); vehStat[x][vMod15] = strval(result);
		cache_get_field_content(i, "vehicleColor1", result); vehStat[x][vColor1] = strval(result);
		cache_get_field_content(i, "vehicleColor2", result); vehStat[x][vColor2] = strval(result);
		cache_get_field_content(i, "vehicleCarPlate", result); format(vehStat[x][vCarPlate], 32, "%s", result);
		cache_get_field_content(i, "vehiclePurchaseDate", result); format(vehStat[x][vPurch], 32, "%s", result);
		cache_get_field_content(i, "vehicleHealth", result); vehStat[x][carHealth] = floatstr(result);
		cache_get_field_content(i, "vehiclePrice", result); vehStat[x][vPrice] = strval(result);
		vehStat[x][vIGID] = CreateVehicle(vehStat[x][vModelID], vehStat[x][vPosX], vehStat[x][vPosY], vehStat[x][vPosZ], vehStat[x][vPosR], vehStat[x][vColor1], vehStat[x][vColor2], -1);
		SetVehicleNumberPlate(vehStat[x][vIGID], vehStat[x][vCarPlate]);
		vehStat[x][vStatus] = 1;
		count++;
	}
	printf("[DEBUG] Loaded %d user vehicles for user: %d.", count, playerVariables[extraid][pInternalID]);
	cache_delete(result4);
	return 1;
}
This is where the stock is being called (All the way down).
Код:
public PassCheck(extraid)
{
	cache_get_data(rows, fields, handle);
	if(rows == 0)
	{ // INCORRECT PASSWORD!1
		SetPVarInt(extraid, "LA", GetPVarInt(extraid, "LA") + 1);
		new playerIP[32];

		if(GetPVarInt(extraid, "LA") > MAX_LOGIN_ATTEMPTS)
		{
			SendClientMessage(extraid, COLOR_RED, "You have used all available login attempts.");
			GetPlayerIp(extraid, playerIP, sizeof(playerIP));

			GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);
			format(szMessage, sizeof(szMessage), "AdmWarn: {FFFFFF}IP %s has been kicked (%d failed 3 attempts on account %s).", playerIP, MAX_LOGIN_ATTEMPTS, szPlayerName);
			submitToHelpersAndAdmins(szMessage, COLOR_ADMWARN);

			Kick(extraid);
			return 1;

		}
		else
		{
			ShowPlayerDialog(extraid, 55, DIALOG_STYLE_PASSWORD, "SERVER: Login", "Welcome to the "SERVER_NAME" Server.\n\nPlease enter your password below!", "Login", "Cancel");
			format(szMessage, sizeof(szMessage), "Incorrect password. You have %d remaining login attempts left.", MAX_LOGIN_ATTEMPTS - GetPVarInt(extraid, "LA"));
			SendClientMessage(extraid, COLOR_RED, szMessage);
			return 1;
		}
	}
	else
	{
		clearScreen(extraid);
		DeletePVar(extraid, "LA");

		new resi;
		cache_get_field_content(0, "playerBanned", result); resi = strval(result);

		if(resi >= 1)
		{
			SendClientMessage(extraid, COLOR_RED, "You are banned from this server.");
			SetTimerEx("kick2", 1, 0, "d", extraid);
		}

		playerVariables[extraid][pBanned] = resi;
		cache_get_field_content(0, "playerPassword", result); format(playerVariables[extraid][pPassword], 129, result);
		cache_get_field_content(0, "playerEmail", result); format(playerVariables[extraid][pEmail], 255, result);
		cache_get_field_content(0, "playerSkin", result); playerVariables[extraid][pSkin] = strval(result);
		cache_get_field_content(0, "playerMoney", result); playerVariables[extraid][pMoney] = strval(result);
        cache_get_field_content(0, "playerClanTagType", result); playerVariables[extraid][pClanTagType] = strval(result);
        cache_get_field_content(0, "playerBankMoney", result); playerVariables[extraid][pBankMoney] = strval(result);
        cache_get_field_content(0, "playerHealth", result); playerVariables[extraid][pHealth] = floatstr(result);
        cache_get_field_content(0, "playerArmour", result); playerVariables[extraid][pArmour] = floatstr(result);
        cache_get_field_content(0, "playerVIP", result); playerVariables[extraid][pWarns] = strval(result);
        cache_get_field_content(0, "playerHouse", result); playerVariables[extraid][pHouse] = strval(result);
        cache_get_field_content(0, "playerBusiness", result); playerVariables[extraid][pBusiness] = strval(result);
        cache_get_field_content(0, "playerAdminLevel", result); playerVariables[extraid][pAdminLevel] = strval(result);
       	cache_get_field_content(0, "playerInterior", result); playerVariables[extraid][pInterior] = strval(result);
       	cache_get_field_content(0, "playerVirtualWorld", result); playerVariables[extraid][pVirtualWorld] = strval(result);
       	cache_get_field_content(0, "playerPhone", result); playerVariables[extraid][pPhone] = strval(result);
       	cache_get_field_content(0, "playerID", result); playerVariables[extraid][pInternalID] = strval(result);
       	cache_get_field_content(0, "playerJob", result); playerVariables[extraid][pJob] = strval(result);
       	cache_get_field_content(0, "playerJobSkill2", result); playerVariables[extraid][pDonate] = strval(result);
       	cache_get_field_content(0, "playerMaterials", result); playerVariables[extraid][pMaterials] = strval(result);
       	cache_get_field_content(0, "playerGroup", result); playerVariables[extraid][pGroup] = strval(result);
       	cache_get_field_content(0, "playerGroupRank", result); playerVariables[extraid][pGroupRank] = strval(result);
		cache_get_field_content(0, "playerClanDays", result); playerVariables[extraid][pClanDays] = strval(result);
       	cache_get_field_content(0, "playerClan", result); playerVariables[extraid][pClan] = strval(result);
       	cache_get_field_content(0, "playerClanRank", result); playerVariables[extraid][pClanRank] = strval(result);
       	cache_get_field_content(0, "playerHours", result); playerVariables[extraid][pPlayingHours] = strval(result);
		cache_get_field_content(0, "playerAdminName", result); format(playerVariables[extraid][pCrimeReason], 200, result);
		cache_get_field_content(0, "playerFirstLogin", result); playerVariables[extraid][pFirstLogin] = strval(result);
		cache_get_field_content(0, "playerGender", result); playerVariables[extraid][pGender] = strval(result);
		cache_get_field_content(0, "playerPrisonID", result); playerVariables[extraid][pPrisonID] = strval(result);
		cache_get_field_content(0, "playerPrisonTime", result); playerVariables[extraid][pPrisonTime] = strval(result);
		cache_get_field_content(0, "playerPhoneNumber", result); playerVariables[extraid][pPhoneNumber] = strval(result);
		cache_get_field_content(0, "playerPhoneBook", result); playerVariables[extraid][pPhoneBook] = strval(result);
		cache_get_field_content(0, "playerHelperLevel", result); playerVariables[extraid][pHelper] = strval(result);
		cache_get_field_content(0, "playerDropCarTimeout", result); playerVariables[extraid][pDropCarTimeout] = strval(result);
		cache_get_field_content(0, "playerRope", result); playerVariables[extraid][pDriveLicense] = strval(result);
		cache_get_field_content(0, "playerGunLic", result); playerVariables[extraid][pGunLicense] = strval(result);
		cache_get_field_content(0, "playerFlyLic", result); playerVariables[extraid][pFlyLicense] = strval(result);
		cache_get_field_content(0, "playerBoatLic", result); playerVariables[extraid][pBoatLicense] = strval(result);
		cache_get_field_content(0, "playerAdminDuty", result); playerVariables[extraid][pRobPoints] = strval(result);
		cache_get_field_content(0, "playerCrimes", result); playerVariables[extraid][pCrimes] = strval(result);
		cache_get_field_content(0, "playerArrests", result); playerVariables[extraid][pArrests] = strval(result);
		cache_get_field_content(0, "playerWarrants", result); playerVariables[extraid][pWarrants] = strval(result);
		cache_get_field_content(0, "playerLevel", result); playerVariables[extraid][pLevel] = strval(result);
		cache_get_field_content(0, "playerGlasses", result); playerVariables[extraid][pGlasses] = strval(result);
		cache_get_field_content(0, "playerHelpedPlayers", result); playerVariables[extraid][pHelpedPlayers] = strval(result);
		cache_get_field_content(0, "playerHelperTokens", result); playerVariables[extraid][pHelperTokens] = strval(result);
		cache_get_field_content(0, "playerColor", result); playerVariables[extraid][pColor] = strval(result);
		cache_get_field_content(0, "playerSeconds", result); playerVariables[extraid][pSeconds] = strval(result);
		cache_get_field_content(0, "playerAge", result); playerVariables[extraid][pRPoints] = strval(result);
		cache_get_field_content(0, "playerAge1", result); playerVariables[extraid][pAge] = strval(result);
		cache_get_field_content(0, "playerCarModel", result); playerVariables[extraid][pCarModel1] = strval(result);
		cache_get_field_content(0, "playerCarMod0", result); playerVariables[extraid][pCarMods1][0] = strval(result);
		cache_get_field_content(0, "playerCarMod1", result); playerVariables[extraid][pCarMods1][1] = strval(result);
		cache_get_field_content(0, "playerCarMod2", result); playerVariables[extraid][pCarMods1][2] = strval(result);
		cache_get_field_content(0, "playerCarMod3", result); playerVariables[extraid][pCarMods1][3] = strval(result);
		cache_get_field_content(0, "playerCarMod4", result); playerVariables[extraid][pCarMods1][4] = strval(result);
		cache_get_field_content(0, "playerCarMod5", result); playerVariables[extraid][pCarMods1][5] = strval(result);
		cache_get_field_content(0, "playerCarMod6", result); playerVariables[extraid][pCarMods1][6] = strval(result);
		cache_get_field_content(0, "playerCarMod7", result); playerVariables[extraid][pCarMods1][7] = strval(result);
        cache_get_field_content(0, "playerCarMod8", result); playerVariables[extraid][pCarMods1][8] = strval(result);
        cache_get_field_content(0, "playerCarMod9", result); playerVariables[extraid][pCarMods1][9] = strval(result);
        cache_get_field_content(0, "playerCarMod10", result); playerVariables[extraid][pCarMods1][10] = strval(result);
        cache_get_field_content(0, "playerCarMod11", result); playerVariables[extraid][pCarMods1][11] = strval(result);
        cache_get_field_content(0, "playerCarMod12", result); playerVariables[extraid][pCarMods1][12] = strval(result);
        cache_get_field_content(0, "playerCarMod20", result); playerVariables[extraid][pCarMods2][0] = strval(result);
        cache_get_field_content(0, "playerCarMod21", result); playerVariables[extraid][pCarMods2][1] = strval(result);
        cache_get_field_content(0, "playerCarMod22", result); playerVariables[extraid][pCarMods2][2] = strval(result);
        cache_get_field_content(0, "playerCarMod23", result); playerVariables[extraid][pCarMods2][3] = strval(result);
        cache_get_field_content(0, "playerCarMod24", result); playerVariables[extraid][pCarMods2][4] = strval(result);
        cache_get_field_content(0, "playerCarMod25", result); playerVariables[extraid][pCarMods2][5] = strval(result);
        cache_get_field_content(0, "playerCarMod26", result); playerVariables[extraid][pCarMods2][6] = strval(result);
        cache_get_field_content(0, "playerCarMod27", result); playerVariables[extraid][pCarMods2][7] = strval(result);
        cache_get_field_content(0, "playerCarMod28", result); playerVariables[extraid][pCarMods2][8] = strval(result);
        cache_get_field_content(0, "playerCarMod29", result); playerVariables[extraid][pCarMods2][9] = strval(result);
        cache_get_field_content(0, "playerCarMod30", result); playerVariables[extraid][pCarMods2][10] = strval(result);
        cache_get_field_content(0, "playerCarMod31", result); playerVariables[extraid][pCarMods2][11] = strval(result);
        cache_get_field_content(0, "playerCarMod32", result); playerVariables[extraid][pCarMods2][12] = strval(result);
        cache_get_field_content(0, "playerCarMod60", result); playerVariables[extraid][pCarMods3][0] = strval(result);
        cache_get_field_content(0, "playerCarMod61", result); playerVariables[extraid][pCarMods3][1] = strval(result);
        cache_get_field_content(0, "playerCarMod62", result); playerVariables[extraid][pCarMods3][2] = strval(result);
        cache_get_field_content(0, "playerCarMod63", result); playerVariables[extraid][pCarMods3][3] = strval(result);
        cache_get_field_content(0, "playerCarMod64", result); playerVariables[extraid][pCarMods3][4] = strval(result);
        cache_get_field_content(0, "playerCarMod65", result); playerVariables[extraid][pCarMods3][5] = strval(result);
        cache_get_field_content(0, "playerCarMod66", result); playerVariables[extraid][pCarMods3][6] = strval(result);
        cache_get_field_content(0, "playerCarMod67", result); playerVariables[extraid][pCarMods3][7] = strval(result);
        cache_get_field_content(0, "playerCarMod68", result); playerVariables[extraid][pCarMods3][8] = strval(result);
        cache_get_field_content(0, "playerCarMod69", result); playerVariables[extraid][pCarMods3][9] = strval(result);
        cache_get_field_content(0, "playerCarMod70", result); playerVariables[extraid][pCarMods3][10] = strval(result);
        cache_get_field_content(0, "playerCarMod71", result); playerVariables[extraid][pCarMods3][11] = strval(result);
        cache_get_field_content(0, "playerCarMod72", result); playerVariables[extraid][pCarMods3][12] = strval(result);
        cache_get_field_content(0, "playerCarMod80", result); playerVariables[extraid][pCarMods4][0] = strval(result);
        cache_get_field_content(0, "playerCarMod81", result); playerVariables[extraid][pCarMods4][1] = strval(result);
        cache_get_field_content(0, "playerCarMod82", result); playerVariables[extraid][pCarMods4][2] = strval(result);
        cache_get_field_content(0, "playerCarMod83", result); playerVariables[extraid][pCarMods4][3] = strval(result);
        cache_get_field_content(0, "playerCarMod84", result); playerVariables[extraid][pCarMods4][4] = strval(result);
        cache_get_field_content(0, "playerCarMod85", result); playerVariables[extraid][pCarMods4][5] = strval(result);
        cache_get_field_content(0, "playerCarMod86", result); playerVariables[extraid][pCarMods4][6] = strval(result);
        cache_get_field_content(0, "playerCarMod87", result); playerVariables[extraid][pCarMods4][7] = strval(result);
        cache_get_field_content(0, "playerCarMod88", result); playerVariables[extraid][pCarMods4][8] = strval(result);
        cache_get_field_content(0, "playerCarMod89", result); playerVariables[extraid][pCarMods4][9] = strval(result);
        cache_get_field_content(0, "playerCarMod90", result); playerVariables[extraid][pCarMods4][10] = strval(result);
        cache_get_field_content(0, "playerCarMod91", result); playerVariables[extraid][pCarMods4][11] = strval(result);
        cache_get_field_content(0, "playerCarMod92", result); playerVariables[extraid][pCarMods4][12] = strval(result);
        cache_get_field_content(0, "playerCarPosX", result); playerVariables[extraid][pCarPos1][0] = floatstr(result);
        cache_get_field_content(0, "playerCarPosY", result); playerVariables[extraid][pCarPos1][1] = floatstr(result);
        cache_get_field_content(0, "playerCarPosZ", result); playerVariables[extraid][pCarPos1][2] = floatstr(result);
        cache_get_field_content(0, "playerCarPosZAngle", result); playerVariables[extraid][pCarPos1][3] = floatstr(result);
        cache_get_field_content(0, "playerCarPosX3", result); playerVariables[extraid][pCarPos3][0] = floatstr(result);
        cache_get_field_content(0, "playerCarPosY3", result); playerVariables[extraid][pCarPos3][1] = floatstr(result);
        cache_get_field_content(0, "playerCarPosZ3", result); playerVariables[extraid][pCarPos3][2] = floatstr(result);
    	cache_get_field_content(0, "playerCarPosZAngle3", result); playerVariables[extraid][pCarPos3][3] = floatstr(result);
        cache_get_field_content(0, "playerCarPosX4", result); playerVariables[extraid][pCarPos4][0] = floatstr(result);
        cache_get_field_content(0, "playerCarPosY4", result); playerVariables[extraid][pCarPos4][1] = floatstr(result);
        cache_get_field_content(0, "playerCarPosZ4", result); playerVariables[extraid][pCarPos4][2] = floatstr(result);
    	cache_get_field_content(0, "playerCarPosZAngle4", result); playerVariables[extraid][pCarPos4][3] = floatstr(result);
    	cache_get_field_content(0, "playerCarPosX2", result); playerVariables[extraid][pCarPos2][0] = floatstr(result);
        cache_get_field_content(0, "playerCarPosY2", result); playerVariables[extraid][pCarPos2][1] = floatstr(result);
        cache_get_field_content(0, "playerCarPosZ2", result); playerVariables[extraid][pCarPos2][2] = floatstr(result);
    	cache_get_field_content(0, "playerCarPosZAngle2", result); playerVariables[extraid][pCarPos2][3] = floatstr(result);
    	cache_get_field_content(0, "playerCarColour1", result); playerVariables[extraid][pCarColour1][0] = strval(result);
       	cache_get_field_content(0, "playerCarColour2", result); playerVariables[extraid][pCarColour1][1] = strval(result);
       	cache_get_field_content(0, "playerCarPaintJob", result); playerVariables[extraid][pCarPaintjob] = strval(result);
       	cache_get_field_content(0, "playerCarLock", result); playerVariables[extraid][pCarLock] = strval(result);
       	cache_get_field_content(0, "playerCarColour21", result); playerVariables[extraid][pCarColour2][0] = strval(result);
       	cache_get_field_content(0, "playerCarColour22", result); playerVariables[extraid][pCarColour2][1] = strval(result);
       	cache_get_field_content(0, "playerCarPaintJob2", result); playerVariables[extraid][pCarPaintjob2] = strval(result);
       	cache_get_field_content(0, "playerCarLock2", result); playerVariables[extraid][pCarLock2] = strval(result);
       	cache_get_field_content(0, "playerCarColor31", result); playerVariables[extraid][pCarColour3][0] = strval(result);
       	cache_get_field_content(0, "playerCarColor32", result); playerVariables[extraid][pCarColour3][1] = strval(result);
       	cache_get_field_content(0, "playerCarPaintJob3", result); playerVariables[extraid][pCarPaintjob3] = strval(result);
       	cache_get_field_content(0, "playerCarLock3", result); playerVariables[extraid][pCarLock3] = strval(result);
       	cache_get_field_content(0, "playerCarColor41", result); playerVariables[extraid][pCarColour4][0] = strval(result);
       	cache_get_field_content(0, "playerCarColor42", result); playerVariables[extraid][pCarColour4][1] = strval(result);
       	cache_get_field_content(0, "playerCarPaintJob4", result); playerVariables[extraid][pCarPaintjob4] = strval(result);
       	cache_get_field_content(0, "playerCarLock4", result); playerVariables[extraid][pCarLock4] = strval(result);
       	cache_get_field_content(0, "playerCarKM3", result); playerVariables[extraid][pCarKM3] = strval(result);
       	cache_get_field_content(0, "playerCarKM4", result); playerVariables[extraid][pCarKM4] = strval(result);
       	cache_get_field_content(0, "playerFightStyle", result); playerVariables[extraid][pFightStyle] = strval(result);
       	cache_get_field_content(0, "playerCarWeapon1", result); playerVariables[extraid][pCarWeapons] = strval(result);
       	cache_get_field_content(0, "playerCarWeapon2", result); playerVariables[extraid][pFPunish] = strval(result);
       	cache_get_field_content(0, "playerCarWeapon3", result); playerVariables[extraid][pFWarns] = strval(result);
       	cache_get_field_content(0, "playerCarWeapon4", result); playerVariables[extraid][pSpawnChange] = strval(result);
       	cache_get_field_content(0, "playerCarWeapon5", result); playerVariables[extraid][pPremiumPoints] = strval(result);
       	cache_get_field_content(0, "playerCarTrunk1", result); playerVariables[extraid][pCarKM] = strval(result);
       	cache_get_field_content(0, "playerCarKM2", result); playerVariables[extraid][pCarKM2] = strval(result);
       	cache_get_field_content(0, "playerCarTrunk2", result); playerVariables[extraid][pDrugs] = strval(result);
       	cache_get_field_content(0, "playerCarModel2", result); playerVariables[extraid][pCarModel2] = strval(result);
       	cache_get_field_content(0, "playerCarModel3", result); playerVariables[extraid][pCarModel3] = strval(result);
       	cache_get_field_content(0, "playerCarModel4", result); playerVariables[extraid][pCarModel4] = strval(result);
       	cache_get_field_content(0, "playerPhoneCredit", result); playerVariables[extraid][pPhoneCredit] = strval(result);
       	cache_get_field_content(0, "playerWalkieTalkie", result); playerVariables[extraid][pWalkieTalkie] = strval(result);
       	cache_get_field_content(0, "playerManager", result); playerVariables[extraid][pManager] = strval(result);
       	cache_get_field_content(0, "playerGiftHours", result); playerVariables[extraid][pGiftHours] = strval(result);
       	cache_get_field_content(0, "playerHud", result); playerVariables[extraid][ShowHealth] = strval(result);
       	cache_get_field_content(0, "playerInsurance", result); playerVariables[extraid][pInsurance] = strval(result);
       	cache_get_field_content(0, "playerInsurance2", result); playerVariables[extraid][pInsurance2] = strval(result);
       	cache_get_field_content(0, "playerInsurance3", result); playerVariables[extraid][pInsurance3] = strval(result);
       	cache_get_field_content(0, "playerInsurance4", result); playerVariables[extraid][pInsurance4] = strval(result);
		cache_get_field_content(0, "playerInsurancePoints", result); playerVariables[extraid][pInsurancePoints] = strval(result);
       	cache_get_field_content(0, "playerInsurancePoints2", result); playerVariables[extraid][pInsurancePoints2] = strval(result);
       	cache_get_field_content(0, "playerInsurancePoints3", result); playerVariables[extraid][pInsurancePoints3] = strval(result);
       	cache_get_field_content(0, "playerInsurancePoints4", result); playerVariables[extraid][pInsurancePoints4] = strval(result);
		cache_get_field_content(0, "playerHelperDays", result); playerVariables[extraid][pHelperDays] = strval(result);
		cache_get_field_content(0, "playerDMStatus", result); playerVariables[extraid][pDMStatus] = strval(result);
		cache_get_field_content(0, "playerFunc", result); playerVariables[extraid][pFunc] = strval(result);
		cache_get_field_content(0, "playerHoursTWPoints", result); playerVariables[extraid][pHPoints] = strval(result);
		cache_get_field_content(0, "playerHoursThisWeek", result); playerVariables[extraid][pHThisWeek] = strval(result);
		cache_get_field_content(0, "playerALocked", result); playerVariables[extraid][pALock] = strval(result);
		cache_get_field_content(0, "playerAdminIP", playerVariables[extraid][pAdminIP], handle, 256);
		cache_get_field_content(0, "playerWantedSeconds", result); playerVariables[extraid][pWantedSeconds] = strval(result);
		cache_get_field_content(0, "playerRepairKit", result); playerVariables[extraid][pRepairKit] = strval(result);
		cache_get_field_content(0, "playerSkillFarm", result); playerVariables[extraid][pSkillFarm] = strval(result);
		cache_get_field_content(0, "playerSkillGarbage", result); playerVariables[extraid][pSkillGarbage] = strval(result);
		cache_get_field_content(0, "playerSkillTruck", result); playerVariables[extraid][pSkillTruck] = strval(result);
		cache_get_field_content(0, "playerSkillStreet", result); playerVariables[extraid][pSkillStreet] = strval(result);
		cache_get_field_content(0, "playerSkillMechanic", result); playerVariables[extraid][pSkillMechanic] = strval(result);
		cache_get_field_content(0, "playerSkillArms", result); playerVariables[extraid][pSkillArms] = strval(result);
		cache_get_field_content(0, "playerSkillPizza", result); playerVariables[extraid][pSkillPizza] = strval(result);
		cache_get_field_content(0, "playerSkillCurier", result); playerVariables[extraid][pSkillCurier] = strval(result);
		cache_get_field_content(0, "playerSkillCarJack", result); playerVariables[extraid][pSkillCarJack] = strval(result);
		cache_get_field_content(0, "playerSkillFish", result); playerVariables[extraid][pSkillFish] = strval(result);		
		cache_get_field_content(0, "playerFarms", result); playerVariables[extraid][pFarms] = strval(result);
		cache_get_field_content(0, "playerGarbs", result); playerVariables[extraid][pGarbs] = strval(result);
		cache_get_field_content(0, "playerTrucks", result); playerVariables[extraid][pTrucks] = strval(result);
		cache_get_field_content(0, "playerStreets", result); playerVariables[extraid][pStreets] = strval(result);
		cache_get_field_content(0, "playerMechanics", result); playerVariables[extraid][pMechanics] = strval(result);
		cache_get_field_content(0, "playerArms", result); playerVariables[extraid][pArms] = strval(result);
		cache_get_field_content(0, "playerPizza", result); playerVariables[extraid][pPizza] = strval(result);
		cache_get_field_content(0, "playerCurier", result); playerVariables[extraid][pCurier] = strval(result);
		cache_get_field_content(0, "playerJacks", result); playerVariables[extraid][pJacks] = strval(result);
		cache_get_field_content(0, "playerFish", result); playerVariables[extraid][pFishAm] = strval(result);			
		cache_get_field_content(0, "playerNeededFarm", result); playerVariables[extraid][pNeededFarm] = strval(result);
		cache_get_field_content(0, "playerNeededGarbage", result); playerVariables[extraid][pNeededGarbage] = strval(result);
		cache_get_field_content(0, "playerNeededTruck", result); playerVariables[extraid][pNeededTruck] = strval(result);
		cache_get_field_content(0, "playerNeededStreet", result); playerVariables[extraid][pNeededStreet] = strval(result);
		cache_get_field_content(0, "playerNeededMechanic", result); playerVariables[extraid][pNeededMechanic] = strval(result);
		cache_get_field_content(0, "playerNeededArms", result); playerVariables[extraid][pNeededArms] = strval(result);
		cache_get_field_content(0, "playerNeededPizza", result); playerVariables[extraid][pNeededPizza] = strval(result);
		cache_get_field_content(0, "playerNeededCurier", result); playerVariables[extraid][pNeededCurier] = strval(result);
		cache_get_field_content(0, "playerNeededCarJack", result); playerVariables[extraid][pNeededCarJack] = strval(result);
		cache_get_field_content(0, "playerNeededFish", result); playerVariables[extraid][pNeededFish] = strval(result);
		cache_get_field_content(0, "playerArmor", result); playerVariables[extraid][ShowArmor] = strval(result);
		cache_get_field_content(0, "playerFPS", result); playerVariables[extraid][ShowFPS] = strval(result);
		
		format(playerVariables[extraid][pLastMessage], 256, "");

		ClearChat(extraid);
	

		GetPlayerName(extraid, playerVariables[extraid][pNormalName], MAX_PLAYER_NAME);
		GetPlayerIp(extraid, playerVariables[extraid][pConnectionIP], 32);
		
		if(playerVariables[extraid][pAdminLevel] > 0)
		{
			new str[512];
			if(playerVariables[extraid][pConnectionIP] != playerVariables[extraid][pAdminIP] && playerVariables[extraid][pALock] == 0)
			{
				SCM(extraid, COLOR_RED, "(!) You have logged in from a different location as an administrator. Your account has been blocked.");
				SCM(extraid, COLOR_RED, "(!) Contact an administrator on withal.slack.com, create a ticket or contact us at support@withal.ro.");
				format(str, sizeof(str), "AdmWarn: {FFFFFF}Administrator %s has tried to login from a different IP address (%s) than his Admin IP address (%s).", GetName(extraid), playerVariables[extraid][pConnectionIP], playerVariables[extraid][pAdminIP]);
				foreach(Player, i)
				{
					if(playerVariables[i][pAdminLevel] < 0 && i != extraid)
					{
						SCM(i, COLOR_ADMWARN, str);
					}
				}
				SetTimerEx("kick2", 1, 0, "d", extraid);
			}
			else
			{
				if(playerVariables[extraid][pStatus] >= 1)
				{
					SCM(extraid, COLOR_RED, "(!) You already are logged in on this account.");
					SCM(extraid, COLOR_RED, "(!) If you're not the one logged in on this account, use the disconnect function located in your user profile on the userpanel.");
					SetTimerEx("kick2", 1, 0, "d", extraid);
				}
				else
				{
					playerVariables[extraid][pStatus] = 1;

					mysql_format(handle, result, sizeof(result), "UPDATE playeraccounts SET playerStatus = '1' WHERE playerID = %d", playerVariables[extraid][pInternalID]);
					mysql_tquery(handle, result);

					SetSpawnInfo(extraid, 0, playerVariables[extraid][pSkin], playerVariables[extraid][pPos][0], playerVariables[extraid][pPos][1], playerVariables[extraid][pPos][2], 0, 0, 0, 0, 0, 0, 0);
					SpawnPlayer(extraid);
					
					if(playerVariables[extraid][pGroup] == 11)
					{
						GivePlayerWeapon(extraid, 5, 1);
					}
					else if(playerVariables[extraid][pGroup] == 5 || playerVariables[extraid][pGroup] == 6 || playerVariables[extraid][pGroup] == 7 || playerVariables[extraid][pGroup] == 8 || playerVariables[extraid][pGroup] == 13 || playerVariables[extraid][pGroup] == 14)
					{
						GivePlayerWeapon(extraid, 24, 999);
					}
					else if(playerVariables[extraid][pGroup] == 12)
					{
						GivePlayerWeapon(extraid, 43, 999);
					}

					if(playerVariables[extraid][pWarrants] > 0)
					{
						SetPlayerWantedLevel(extraid, playerVariables[extraid][pWarrants]);
						SendClientMessage(extraid, COLOR_YELLOW, "You're still a wanted man! Your criminal record has been reinstated.");
					}

					if(playerVariables[extraid][pCarModel1] > 0)
						SpawnPlayerVehicle(extraid);

					if(playerVariables[extraid][pCarModel2] > 0)
						SpawnPlayerVehicle(extraid);

					if(playerVariables[extraid][pCarModel3] > 0)
						SpawnPlayerVehicle(extraid);

					if(playerVariables[extraid][pCarModel4] > 0)
						SpawnPlayerVehicle(extraid);

					if(playerVariables[extraid][pLevel] >= 0)
						SetPlayerScore(extraid, playerVariables[extraid][pLevel]);

					cache_get_data(rows, fields, handle);

					if(rows == 0)
							 return SendClientMessage(extraid, COLOR_GENANNOUNCE, "SERVER:"EMBED_WHITE" Welcome to the server!");

					GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);
					if(assetVariables[2][aAssetValue] == 1)
					{
						ServerNews[extraid] = 1;
						TextDrawShowForPlayer(extraid, News1[extraid]);
						TextDrawShowForPlayer(extraid, News2[extraid]);
						TextDrawShowForPlayer(extraid, News3[extraid]);
					}

					if(playerVariables[extraid][pDonate] == 1)
					{
						SendClientMessage(extraid, -1, "You are a Premium Account user.");
					}
					new playersip[24];
					GetPlayerIp(extraid, playersip, sizeof(playersip));

					if(playerVariables[extraid][pGroup] >= 1)
					{
						format(szMessage, sizeof(szMessage), "(Group) "EMBED_WHITE"%s from your group has just logged in.", szPlayerName);
						SendToGroup(playerVariables[extraid][pGroup], COLOR_GENANNOUNCE, szMessage);

						format(szMessage, sizeof(szMessage), "(Group) MOTD: "EMBED_WHITE"%s", groupVariables[playerVariables[extraid][pGroup]][gGroupMOTD]);
						SendClientMessage(extraid, COLOR_GENANNOUNCE, szMessage);
					}
					if(playerVariables[extraid][pAdminLevel] >= 1 || playerVariables[extraid][pHelper] >= 1)
					{
						new string2[256], aName[MAX_PLAYER_NAME];
						GetPlayerName(extraid, aName, sizeof(aName));
						format(string2, sizeof(string2), "HelloBot: {FFFFFF}%s has just connected!", aName);
						submitToAdmins(string2, 0xCC8E33C8);
					}

					new string[500];
					if(playerVariables[extraid][ShowHealth] == 1)
					{
						new Float: health;
						GetPlayerHealth(extraid, health);
						TextDrawShowForPlayer(extraid, HealthTD[extraid]);
						format(szMessage, sizeof(szMessage), "%.0f", health);
						TextDrawSetString(HealthTD[extraid], szMessage);
					}
					if(playerVariables[extraid][pClan] >= 1)
					{
								if(playerVariables[extraid][pClanTagType] == 0)
								{
									format(string,256,"%s",playerVariables[extraid][pNormalName]);
									SetPlayerName(extraid, string);
								}
								else if(playerVariables[extraid][pClanTagType] == 1)
								{
									format(string,256,"%s%s",clanVariables[playerVariables[extraid][pClan]][cClanTag],playerVariables[extraid][pNormalName]);
									SetPlayerName(extraid, string);
								}
								else if(playerVariables[extraid][pClanTagType] == 2)
								{
									format(string,256,"%s%s",playerVariables[extraid][pNormalName],clanVariables[playerVariables[extraid][pClan]][cClanTag]);
									SetPlayerName(extraid, string);
								}
					}
					new aName[256];
					format(aName, sizeof(aName), playerVariables[extraid][pNormalName]);
					uppercase(aName);
					PlayerTextDrawSetString(extraid, TDEditor_PTD[extraid][0], aName);
					PlayerTextDrawShow(extraid, TDEditor_PTD[extraid][0]);
					PlayerTextDrawShow(extraid, Textdraw2[extraid]);
				}
			}
		}
		else
		{
			if(playerVariables[extraid][pStatus] >= 1)
			{
				SCM(extraid, COLOR_RED, "(!) You already are logged in on this account.");
				SCM(extraid, COLOR_RED, "(!) If you're not the one logged in on this account, use the disconnect function located in your user profile on the userpanel.");
				SetTimerEx("kick2", 1, 0, "d", extraid);
			}
			else
			{
				playerVariables[extraid][pStatus] = 1;
				mysql_format(handle, result, sizeof(result), "UPDATE playeraccounts SET playerStatus = '1' WHERE playerID = %d", playerVariables[extraid][pInternalID]);
				mysql_tquery(handle, result);
				
				SetSpawnInfo(extraid, 0, playerVariables[extraid][pSkin], playerVariables[extraid][pPos][0], playerVariables[extraid][pPos][1], playerVariables[extraid][pPos][2], 0, 0, 0, 0, 0, 0, 0);
				SpawnPlayer(extraid);
					
				if(playerVariables[extraid][pGroup] == 11)
				{
					GivePlayerWeapon(extraid, 5, 1);
				}
				else if(playerVariables[extraid][pGroup] == 5 || playerVariables[extraid][pGroup] == 6 || playerVariables[extraid][pGroup] == 7 || playerVariables[extraid][pGroup] == 8 || playerVariables[extraid][pGroup] == 13 || playerVariables[extraid][pGroup] == 14)
				{
					GivePlayerWeapon(extraid, 24, 999);
				}
				else if(playerVariables[extraid][pGroup] == 12)
				{
					GivePlayerWeapon(extraid, 43, 999);
				}

				if(playerVariables[extraid][pWarrants] > 0)
				{
					SetPlayerWantedLevel(extraid, playerVariables[extraid][pWarrants]);
					SendClientMessage(extraid, COLOR_YELLOW, "You're still a wanted man! Your criminal record has been reinstated.");
				}

				if(playerVariables[extraid][pCarModel1] > 0)
					SpawnPlayerVehicle(extraid);
					
				if(playerVariables[extraid][pCarModel2] > 0)
				SpawnPlayerVehicle(extraid);
				
				if(playerVariables[extraid][pCarModel3] > 0)
					SpawnPlayerVehicle(extraid);

				if(playerVariables[extraid][pCarModel4] > 0)
					SpawnPlayerVehicle(extraid);

				if(playerVariables[extraid][pLevel] >= 0)
					SetPlayerScore(extraid, playerVariables[extraid][pLevel]);

				cache_get_data(rows, fields, handle);

				if(rows == 0)
					return SendClientMessage(extraid, COLOR_GENANNOUNCE, "SERVER:"EMBED_WHITE" Welcome to the server!");

				GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);
				if(assetVariables[2][aAssetValue] == 1)
				{
					ServerNews[extraid] = 1;
					TextDrawShowForPlayer(extraid, News1[extraid]);
					TextDrawShowForPlayer(extraid, News2[extraid]);
					TextDrawShowForPlayer(extraid, News3[extraid]);
				}

				if(playerVariables[extraid][pDonate] == 1)
				{
					SendClientMessage(extraid, -1, "You are a Premium Account user.");
				}
				new playersip[24];
				GetPlayerIp(extraid, playersip, sizeof(playersip));

				if(playerVariables[extraid][pGroup] >= 1)
				{
					format(szMessage, sizeof(szMessage), "(Group) "EMBED_WHITE"%s from your group has just logged in.", szPlayerName);
					SendToGroup(playerVariables[extraid][pGroup], COLOR_GENANNOUNCE, szMessage);

					format(szMessage, sizeof(szMessage), "(Group) MOTD: "EMBED_WHITE"%s", groupVariables[playerVariables[extraid][pGroup]][gGroupMOTD]);
					SendClientMessage(extraid, COLOR_GENANNOUNCE, szMessage);
				}
				if(playerVariables[extraid][pAdminLevel] >= 1 || playerVariables[extraid][pHelper] >= 1)
				{
					new string2[256], aName[MAX_PLAYER_NAME];
					GetPlayerName(extraid, aName, sizeof(aName));
					format(string2, sizeof(string2), "HelloBot: {FFFFFF}%s has just connected!", aName);
					submitToAdmins(string2, 0xCC8E33C8);
				}

				new string[500];
				if(playerVariables[extraid][ShowHealth] == 1)
				{
					new Float: health;
					GetPlayerHealth(extraid, health);
					TextDrawShowForPlayer(extraid, HealthTD[extraid]);
					format(szMessage, sizeof(szMessage), "%.0f", health);
					TextDrawSetString(HealthTD[extraid], szMessage);
				}
				if(playerVariables[extraid][pClan] >= 1)
				{
					if(playerVariables[extraid][pClanTagType] == 0)
					{
						format(string,256,"%s",playerVariables[extraid][pNormalName]);
						SetPlayerName(extraid, string);
					}
					else if(playerVariables[extraid][pClanTagType] == 1)
					{
						format(string,256,"%s%s",clanVariables[playerVariables[extraid][pClan]][cClanTag],playerVariables[extraid][pNormalName]);
						SetPlayerName(extraid, string);
					}
					else if(playerVariables[extraid][pClanTagType] == 2)
					{
						format(string,256,"%s%s",playerVariables[extraid][pNormalName],clanVariables[playerVariables[extraid][pClan]][cClanTag]);
						SetPlayerName(extraid, string);
					}
				}
				new aName[256];
				format(aName, sizeof(aName), playerVariables[extraid][pNormalName]);
				uppercase(aName);
				PlayerTextDrawSetString(extraid, TDEditor_PTD[extraid][0], aName);
				PlayerTextDrawShow(extraid, TDEditor_PTD[extraid][0]);
				PlayerTextDrawShow(extraid, Textdraw2[extraid]);
			}
		}
		new year, month, day, hour, minute, second;
		getdate(year, month, day);
		gettime(hour, minute, second);
		format(playerVariables[extraid][pLastLogin], 20, "%02d.%02d.%d %02d:%02d", day, month, year, hour, minute);
		new queryasd[256];
		format(queryasd, sizeof(queryasd), "UPDATE playeraccounts SET playerLastLogin = '%s' WHERE playerID = '%d'", playerVariables[extraid][pLastLogin], playerVariables[extraid][pInternalID]);
		mysql_tquery(handle, queryasd);
		LoadClanForPlayer(extraid);
		gPlayerLogged[extraid] = 1;
		LoadUserVeh(extraid);
	}
	return 1;
}



Re: Stock not working. - OneDay - 10.07.2016

you should upgade to mysql_function_query like in https://sampforum.blast.hk/showthread.php?tid=337810 it is the new one for threads that are faster


Re: Stock not working. - danielpalade - 10.07.2016

Quote:
Originally Posted by OneDay
Посмотреть сообщение
you should upgade to mysql_function_query like in https://sampforum.blast.hk/showthread.php?tid=337810 it is the new one for threads that are faster
I don't think that that is the problem.