SA-MP Forums Archive
command wont work properly - 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: command wont work properly (/showthread.php?tid=652267)



command wont work properly - MarianImmortalGod - 06.04.2018

Hey guys i have a vehicle ownership command everything works perfectly if i am alone on server but if sm1 joins and have a vehicle that he owns his /v wont work properly and my 1st car wont despawn and if i spawn it(still if the car was already spawned i can spawn it again after the player joined) and it spawns with the car model that he has it in the last slot.

Код HTML:
CMD:v(playerid)
{
    new gQuery[85], aim[190];
	
	mysql_format(handle, gQuery, sizeof(gQuery), "SELECT * FROM `personalcars` WHERE `Owner` = '%s'", GetName(playerid));
	new Cache: result12 = mysql_query(handle, gQuery);
	
	new gString[55], query[4], query2[4], coordsstring[60] = "ID\tModel\tStatus\tDespawn Time\n";
	for(new i, j = cache_num_rows(); i != j; ++i)
	{
		tospawn[playerid] = 0;
		cache_get_value_name_int(i, "ID", CarInfo[playerid][pcID]); format(query, 4, CarInfo[playerid][pcID]);
		format(Selected[i][scarid], 4, query);
		cache_get_value_name_int(i, "CarID", CarInfo[playerid][pcCarID]); format(query2, 4, CarInfo[playerid][pcCarID]);
		cache_get_value_name_int(i, "Model", CarInfo[playerid][pcCarModel]);
		cache_get_value_name_int(i, "Status", CarInfo[playerid][pcStatus]);

		if(CarInfo[vDBID[i]][pcStatus] == 0)
		{
			format(gString, sizeof(gString), "%d\t%s\tDespawned\tNo Time\n", i+1, VehicleNames[CarInfo[playerid][pcCarModel] - 400]);
			strcat(aim, gString);
		}
		else
		{
	        format(gString, sizeof(gString), "%d\t%s\tSpawned\t%d min\n", i+1, VehicleNames[CarInfo[playerid][pcCarModel] - 400], TimerToDespawnCar[CarInfo[query2[i+1]][pcCarID]]);
	        strcat(aim, gString);
		}
		masinacars[playerid][i] = Selected[i][scarid];
	}
	cache_delete(result12);
	strins(aim, coordsstring, 0);
	ShowPlayerDialog(playerid, DIALOG_OWNEDCARS, DIALOG_STYLE_TABLIST_HEADERS, "Garajul tau", aim, "Choose", "Leave");
    return 1;
}