SA-MP Forums Archive
house thingy - 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: house thingy (/showthread.php?tid=216038)



house thingy - WardenCS - 24.01.2011

hey,i dont know how to fix this,i added some lines under the ongamemodeinit,it should load houses like this from playerinfo,it should check if player has house and if he has,it should create it,even if the player aint logged in

Код:
public OnGameModeInit()
{
	for(new v; v < MAX_PLAYERS; v++)
	{
			if(PlayerInfo[v][pHouseAccepted] > 0)
		{
		    new hnametag[64];
		    new hloctag[64];
		    //pickup
			HousePickupIDTemp[v] = CreatePickup(1273,1,PlayerInfo[v][pHouseX],PlayerInfo[v][pHouseY],PlayerInfo[v][pHouseZ]);
			printf("PickupID: %d", HousePickupIDTemp[v]);
		    //nametag
		    strmid(hnametag, PlayerInfo[v][pHouseTag], 0, strlen(PlayerInfo[v][pHouseTag]), 255);
			House3dTextID[v] = Create3DTextLabel(hnametag,COLOR_HOUSETEXT,PlayerInfo[v][pHouseX],PlayerInfo[v][pHouseY],PlayerInfo[v][pHouseZ]+0.88,20.0,0,1);
			printf("House3dTextID: %d", _:House3dTextID[v]);
			//owner
			new string[256];
			format(string, sizeof(string),"Owner: %s", PlayerName(v));
			HouseTextOwnerID[v] = Create3DTextLabel(string,COLOR_HOUSETEXT,PlayerInfo[v][pHouseX],PlayerInfo[v][pHouseY],PlayerInfo[v][pHouseZ]+0.74,20.0,0,1);
			strmid(PlayerInfo[v][pHouseOwnerTag], PlayerName(v), 0, strlen(PlayerName(v)), 255);
			printf("HouseTextOwnerID: %d", _:HouseTextOwnerID[v]);
			//location
			strmid(hloctag, PlayerInfo[v][pHouseLocTag], 0, strlen(PlayerInfo[v][pHouseLocTag]), 255);
			format(string, sizeof(string),"Location: %s", hloctag);
			HouseTextLocationID[v] = Create3DTextLabel(string,COLOR_HOUSETEXT,PlayerInfo[v][pHouseX],PlayerInfo[v][pHouseY],PlayerInfo[v][pHouseZ]+0.60,20.0,0,1);
			printf("HouseTextLocationID: %d", _:HouseTextLocationID[v]);
			//vehicle
			HouseVehicleIDTemp[v] = CreateVehicle(PlayerInfo[v][pHouseCarModel],PlayerInfo[v][pHouseCarX],PlayerInfo[v][pHouseCarY],PlayerInfo[v][pHouseCarZ],PlayerInfo[v][pHouseCarFacing],PlayerInfo[v][pHouseCarColor],PlayerInfo[v][pHouseCarColor2], 900);
			if(PlayerInfo[v][hVehLock] > 0)
			{
				LockCar(HouseVehicleIDTemp[v]);
			}
		}
		}
....



Re: house thingy - WardenCS - 25.01.2011

upp!


Re: house thingy - Fool - 25.01.2011

you didnt return 1; ??


Re: house thingy - Vince - 25.01.2011

How's this ever gonna work if there are no players connected at all? Unless you load the Playerinfo of ALL players in your database (which may go into the ten-thousands) first...


Re: house thingy - WardenCS - 25.01.2011

i didnt return 1 cause its not all of the gamemodeinit,and ummh yeah i know that,i guess i remake the house sys