SA-MP Forums Archive
[INCLUDE] Casas - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: [INCLUDE] Casas (/showthread.php?tid=108232)



[INCLUDE] Casas - [BR]Michael - 12.11.2009

native CreateHouse(Float:X, Float:Y, Float:Z, Float:A, price, own[]="ninguem", sold=0)
native GetHouseOwn(houseid);
native SetHouseOwn(houseid, own[]);
native SetHouseSold(houseid, sold);
native IsHouseSold(houseid);
native GetHousePrice(houseid);
native SetHousePrice(houseid, price);
native SetHousePos(houseid, Float:X, Float:Y, Float:Z, Float:A);
native GetHousePos(houseid, &Float:X, &Float:Y, &Float:Z, &Float:A);
native LoadHousePickups();
native IsPlayerInAnyHouse(playerid);
native IsPlayerInHouse(playerid, houseid);
native GetPlayerHouseID(playerid);

Esse sistema й muito antigo foi feito para o meu RPG, feito por mim e o Vancy





Re: [INCLUDE] Casas - rannyere - 13.11.2009

Bom, mas vocк poderia colocar um gm simples sу mostrando um exemplo de como usar ele e fazer dentreo do gm.


Re: [INCLUDE] Casas - Kutrhys - 13.11.2009

Concordo plenamente com o Fake.


editado por djlobo (usa o botao "edit" / "modify")
__________________________________________________ ____________
AA, ENTENDI
Й ASSIM OLHA

CreateHouse(X, Y, :Z, angulo , preco, own[]="RONALDO", sold=0)

X = Coordenada X
Y = Coordenada Y
Z = Coordenada Z
ANGULO = Dг, angulo ¬¬
PRECO = Dг, preco da casa ¬¬
own[]="AKI" = dono da casa ou seja o AKI й o dono da casa
Pode fazer por um Get, pra pegar o nome de kem comprou a ksa!


Re: [INCLUDE] Casas - [BR]Michael - 13.11.2009

Code:
	if(!strcmp(cmd,"/casa",true)){
	  new tmp[256];
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp)){
	    SendClientMessage(playerid, COLOR_RED, "/casa [preзo]");
	    return 1;
	  }
	  
		if(IsPlayerConnected(playerid)){
		  new Float:X, Float:Y, Float:Z, Float:A, str[256], File:temp;
		  GetPlayerPos(playerid, X, Y, Z);
		  GetPlayerFacingAngle(playerid, A);
		  format(str,sizeof(str),"%f %f %f %f %d\r\n", X, Y, Z, A, strval(tmp));
		  temp = fopen("Casas/Coords.info", io_append);
		  fwrite(temp, str);
		  fclose(temp);
			CreatePickup(1273, 1, X, Y, Z);
			return 1;
		}
	if(strcmp(cmd, "/comprar", true) == 0) {
	  new Float:X, Float:Y, Float:Z, Float:A;
		if(IsPlayerInAnyHouse(playerid)){
		  new h = GetPlayerHouseID(playerid);
		  if(IsHouseSold(h)){
		    SendClientMessage(playerid, COLOR_RED, "Essa casa jб foi comprada.");
		    return 1;
		  } else {
			  if(GetPlayerMoney(playerid) >= GetHousePrice(h)){
			    SendClientMessage(playerid, COLOR_JUIZ, "Casa comprada.");
					GivePlayerMoney(playerid, 0 - GetHousePrice(h));
					GetHousePos(h, X, Y, Z, A);
					db_SetPlayerPos(PlayerName(playerid), X, Y, Z, A);
					SetHouseOwn(h, PlayerName(playerid));
					SetHouseSold(h, 1);
					DestroyAllHousePickups();
					LoadHousePickups();
					return 1;
				} else {
				  SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem dinheiro suficiente para comprar essa casa.");
				  return 1;
				}
			}
		} else {
		  SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб em uma casa.");
		  return 1;
		}
	}	}
stock LoadHouses()
{
  new File:temp;
	new index = 0;
	new tmp[256];
	new Float:X, Float:Y, Float:Z, Float:A, Price;
	temp = fopen("Casas/Coords.info", io_readwrite);
	while(fread(temp, tmp, sizeof(tmp), false)) {
		index = 0;
		X     = Float:floatstr(strtok(tmp, index));
		Y     = Float:floatstr(strtok(tmp, index));
		Z     = Float:floatstr(strtok(tmp, index));
		A	    = Float:floatstr(strtok(tmp, index));
		Price   = strval(strtok(tmp, index));

		CreateHouse(X, Y, Z, A, Price);
	}
	fclose(temp);
}



Re: [INCLUDE] Casas - ashiuashiu - 15.11.2009

Olha o double post aн, gente...


Re: [INCLUDE] Casas - LeoH - 05.01.2010

Cara, vocк poderia explicar como se aplica a um GM!


Re: [INCLUDE] Casas - John_Race - 24.01.2010

Fica dando erro no include.




Re: [INCLUDE] Casas - ScriptGameS - 04.01.2014

revivendo post