Jump to content
  • 0

Question

Posted

Salut. Revin din nou cu o noua problema, acum cand creez o casa noua, daca sunt doua case cu acelasi interior ma da cand la una, cand la alta atunci cand ies din casa. Deci, ce e de facut? Asta e codul din cmd

CMD:createhouse(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][pAdmin] >= 7)
		{
			new house[64],Float:pX,Float:pY,Float:pZ,string[128],PropertyString[256],field[256];
			if(sscanf(params, "s[64]", house)) return SendClientMessage(playerid, 0xFFFFFFFF, "Scrie: /createhouse <exterior/interior/complete>");
		    if(strcmp(house,"exterior",true) == 0)
			{
			    GetPlayerPos(playerid, pX, pY, pZ);
				SetPVarFloat(playerid, "pHeX", pX);
	        	SetPVarFloat(playerid, "pHeY", pY);
	        	SetPVarFloat(playerid, "pHeZ", pZ);
				SetPVarInt(playerid, "hExt", 1);
				SendClientMessage(playerid, COLOR_YELLOW, "House exterior position configured.");
			}
			if(strcmp(house,"interior",true) == 0)
			{
			    GetPlayerPos(playerid, pX, pY, pZ);
				SetPVarFloat(playerid, "pHiX", pX);
            	SetPVarFloat(playerid, "pHiY", pY);
            	SetPVarFloat(playerid, "pHiZ", pZ);
				SetPVarInt(playerid, "pHiID", GetPlayerInterior(playerid));
				SetPVarInt(playerid, "pHiVW", GetPlayerVirtualWorld(playerid));
            	SetPVarInt(playerid, "hInt", 1);
				SendClientMessage(playerid, COLOR_YELLOW, "House interior position configured.");
			}
			if(strcmp(house,"complete",true) == 0)
			{
			    if(GetPVarInt(playerid, "hExt") != 1 || GetPVarInt(playerid, "hInt") != 1)
					return SendClientMessage(playerid, COLOR_RED, "You haven't configured either the house exterior or interior. Creation attempt failed.");

				new i = housess+1;
				format(field,256,"INSERT INTO houses (Owner, Lockk, Hel, Arm, Level, Rentabil, Rent, Owned, Discription, Value, Takings) VALUES('The State', '0', '0', '0', '10', '1', '500', '0', 'House', '10000000', '0')");
				mysql_query(SQL,field);

				HouseInfo[i][hID]                           = i;
   	    		HouseInfo[i][hEntrancex]                    = GetPVarFloat(playerid, "pHeX");
				HouseInfo[i][hEntrancey]                    = GetPVarFloat(playerid, "pHeY");
			 	HouseInfo[i][hEntrancez]                    = GetPVarFloat(playerid, "pHeZ");
        		HouseInfo[i][hExitx]                        = GetPVarFloat(playerid, "pHiX");
        		HouseInfo[i][hExity]                        = GetPVarFloat(playerid, "pHiY");
        		HouseInfo[i][hExitz]                        = GetPVarFloat(playerid, "pHiZ");
        		format(HouseInfo[i][hOwner], 64, "The State");
        		format(HouseInfo[i][hDiscription], 64, "Casa %d",i);
        		HouseInfo[i][hValue]						= 10000000;
        		HouseInfo[i][hHel]                          = 0;
 			 	HouseInfo[i][hArm]                          = 0;
        		HouseInfo[i][hInterior]                     = GetPVarInt(playerid, "pHiID");
        		HouseInfo[i][hLock]                         = 0;
        		HouseInfo[i][hOwned]                        = 0;
        		HouseInfo[i][hRent]                         = 500;
        		HouseInfo[i][hRentabil]                     = 1;
        		HouseInfo[i][hTakings]                      = 0;
        		HouseInfo[i][hLevel]                        = 10;
        		HouseInfo[i][hVirtual]                      = GetPVarInt(playerid, "pHiVW");

        		format(field,256,"UPDATE `houses` SET `Entrancex`='%f',`Entrancey`='%f',`Entrancez`='%f',`Exitx`='%f',`Exity`='%f',`Exitz`='%f',`Interior`='%d',`Virtual`='%d' WHERE `ID`='%d'",HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez],HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz],HouseInfo[i][hInterior],HouseInfo[i][hVirtual],i);
        		mysql_query(SQL,field);

        		DeletePVar(playerid, "pHeX");
			    DeletePVar(playerid, "pHeY");
			    DeletePVar(playerid, "pHeZ");
			    DeletePVar(playerid, "pHiX");
			    DeletePVar(playerid, "pHeY");
			    DeletePVar(playerid, "pHeZ");
			    DeletePVar(playerid, "pHiID");
			    DeletePVar(playerid, "pHiVW");
			    DeletePVar(playerid, "pExt");
			    DeletePVar(playerid, "pInt");

          		DestroyDynamic3DTextLabel(HouseLabel[i]);
				format(PropertyString, sizeof(PropertyString),"{347235}House {FFFFFF}%d \n{347235}This house is for sale \nDescription: {FFFFFF}%s \n{347235}Cost: {FFFFFF}$%s \n{347235}Level: {FFFFFF}%d \n{347235}To buy this house type /buyhouse",i,HouseInfo[i][hDiscription],FormatNumber(HouseInfo[i][hValue]),HouseInfo[i][hLevel]);
				HouseLabel[i] = CreateDynamic3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez],25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
				CreateDynamicMapIcon(HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez],31,0);

				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerPos(playerid, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
				housess++;
				format(string,sizeof(string),"House %d created!",i);
				SendClientMessage(playerid, COLOR_YELLOW, string);
			}
		}
		else return SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
	}
	return 1;
}

Multumesc celor care vor sa ma ajute :)

1 answer to this question

Recommended Posts

  • 0
Posted
Acum 23 ore, RazDanh a spus:

Salut. Revin din nou cu o noua problema, acum cand creez o casa noua, daca sunt doua case cu acelasi interior ma da cand la una, cand la alta atunci cand ies din casa. Deci, ce e de facut? Asta e codul din cmd


CMD:createhouse(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][pAdmin] >= 7)
		{
			new house[64],Float:pX,Float:pY,Float:pZ,string[128],PropertyString[256],field[256];
			if(sscanf(params, "s[64]", house)) return SendClientMessage(playerid, 0xFFFFFFFF, "Scrie: /createhouse <exterior/interior/complete>");
		    if(strcmp(house,"exterior",true) == 0)
			{
			    GetPlayerPos(playerid, pX, pY, pZ);
				SetPVarFloat(playerid, "pHeX", pX);
	        	SetPVarFloat(playerid, "pHeY", pY);
	        	SetPVarFloat(playerid, "pHeZ", pZ);
				SetPVarInt(playerid, "hExt", 1);
				SendClientMessage(playerid, COLOR_YELLOW, "House exterior position configured.");
			}
			if(strcmp(house,"interior",true) == 0)
			{
			    GetPlayerPos(playerid, pX, pY, pZ);
				SetPVarFloat(playerid, "pHiX", pX);
            	SetPVarFloat(playerid, "pHiY", pY);
            	SetPVarFloat(playerid, "pHiZ", pZ);
				SetPVarInt(playerid, "pHiID", GetPlayerInterior(playerid));
				SetPVarInt(playerid, "pHiVW", GetPlayerVirtualWorld(playerid));
            	SetPVarInt(playerid, "hInt", 1);
				SendClientMessage(playerid, COLOR_YELLOW, "House interior position configured.");
			}
			if(strcmp(house,"complete",true) == 0)
			{
			    if(GetPVarInt(playerid, "hExt") != 1 || GetPVarInt(playerid, "hInt") != 1)
					return SendClientMessage(playerid, COLOR_RED, "You haven't configured either the house exterior or interior. Creation attempt failed.");

				new i = housess+1;
				format(field,256,"INSERT INTO houses (Owner, Lockk, Hel, Arm, Level, Rentabil, Rent, Owned, Discription, Value, Takings) VALUES('The State', '0', '0', '0', '10', '1', '500', '0', 'House', '10000000', '0')");
				mysql_query(SQL,field);

				HouseInfo[i][hID]                           = i;
   	    		HouseInfo[i][hEntrancex]                    = GetPVarFloat(playerid, "pHeX");
				HouseInfo[i][hEntrancey]                    = GetPVarFloat(playerid, "pHeY");
			 	HouseInfo[i][hEntrancez]                    = GetPVarFloat(playerid, "pHeZ");
        		HouseInfo[i][hExitx]                        = GetPVarFloat(playerid, "pHiX");
        		HouseInfo[i][hExity]                        = GetPVarFloat(playerid, "pHiY");
        		HouseInfo[i][hExitz]                        = GetPVarFloat(playerid, "pHiZ");
        		format(HouseInfo[i][hOwner], 64, "The State");
        		format(HouseInfo[i][hDiscription], 64, "Casa %d",i);
        		HouseInfo[i][hValue]						= 10000000;
        		HouseInfo[i][hHel]                          = 0;
 			 	HouseInfo[i][hArm]                          = 0;
        		HouseInfo[i][hInterior]                     = GetPVarInt(playerid, "pHiID");
        		HouseInfo[i][hLock]                         = 0;
        		HouseInfo[i][hOwned]                        = 0;
        		HouseInfo[i][hRent]                         = 500;
        		HouseInfo[i][hRentabil]                     = 1;
        		HouseInfo[i][hTakings]                      = 0;
        		HouseInfo[i][hLevel]                        = 10;
        		HouseInfo[i][hVirtual]                      = GetPVarInt(playerid, "pHiVW");

        		format(field,256,"UPDATE `houses` SET `Entrancex`='%f',`Entrancey`='%f',`Entrancez`='%f',`Exitx`='%f',`Exity`='%f',`Exitz`='%f',`Interior`='%d',`Virtual`='%d' WHERE `ID`='%d'",HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez],HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz],HouseInfo[i][hInterior],HouseInfo[i][hVirtual],i);
        		mysql_query(SQL,field);

        		DeletePVar(playerid, "pHeX");
			    DeletePVar(playerid, "pHeY");
			    DeletePVar(playerid, "pHeZ");
			    DeletePVar(playerid, "pHiX");
			    DeletePVar(playerid, "pHeY");
			    DeletePVar(playerid, "pHeZ");
			    DeletePVar(playerid, "pHiID");
			    DeletePVar(playerid, "pHiVW");
			    DeletePVar(playerid, "pExt");
			    DeletePVar(playerid, "pInt");

          		DestroyDynamic3DTextLabel(HouseLabel[i]);
				format(PropertyString, sizeof(PropertyString),"{347235}House {FFFFFF}%d \n{347235}This house is for sale \nDescription: {FFFFFF}%s \n{347235}Cost: {FFFFFF}$%s \n{347235}Level: {FFFFFF}%d \n{347235}To buy this house type /buyhouse",i,HouseInfo[i][hDiscription],FormatNumber(HouseInfo[i][hValue]),HouseInfo[i][hLevel]);
				HouseLabel[i] = CreateDynamic3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez],25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
				CreateDynamicMapIcon(HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez],31,0);

				SetPlayerInterior(playerid, 0);
				SetPlayerVirtualWorld(playerid, 0);
				SetPlayerPos(playerid, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
				housess++;
				format(string,sizeof(string),"House %d created!",i);
				SendClientMessage(playerid, COLOR_YELLOW, string);
			}
		}
		else return SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
	}
	return 1;
}

Multumesc celor care vor sa ma ajute :)

problema este de la vw, probabil tu cand setezi interiorul intrii intr-o casa cu acel interior si automat scriputul baga in DB vw respectivei case si se produce incurcatura. Inlocuieste : SetPVarInt(playerid, "pHiVW", GetPlayerVirtualWorld(playerid)); cu: SetPVarInt(playerid, "pHiVW", GetPlayerVirtualWorld(playerid)+1);

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.