SA-MP Forums Archive
[Tutorial] VirtualWorld - 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: [Tutorial] VirtualWorld (/showthread.php?tid=324173)



VirtualWorld - Matheus_Ecko - 08.03.2012

Oque й um Virtual World?

Um virtual world й uma funзгo que seta o player б um mundo diferente que ele nasceu.
Ele й muito usado para usar o mesmo interior em 2 hqs. A funзгo funciona assim

pawn Код:
if(PlayerToPoint(2, playerid,957.9416,-1556.2628,13.5802))
{//ENTRADA HQ 1
GameTextForPlayer(playerid, "~w~HQ 1", 5000, 1);
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid,343.7183,304.9376,999.1484);
PlayerInfo[playerid][pInt] = 6;
SetPlayerVirtualWorld(playerid, 1);
}
else if(PlayerToPoint(2, playerid,-1681.4905,1350.2188,7.1722))
{//ENTRADA HQ 2
GameTextForPlayer(playerid, "~w~HQ 2", 5000, 1);
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid,343.7183,304.9376,999.1484);
PlayerInfo[playerid][pInt] = 6;
SetPlayerVirtualWorld(playerid, 2);
}
Como vocк pode ver usamos o mesmo interior para 2 locais diferentes (Casa 1 e Casa 2)

Mais Matheus eu ao sair do interior eu saio no mesmo lugar da outra HQ!
Entгo й sу vocк usar a funзгo abaixo.

pawn Код:
if(PlayerToPoint(1.0, playerid,343.7183,304.9376,999.1484) && GetPlayerVirtualWorld(playerid) == 1)//Aki getara o player caso ele entra no mundo 1 ele getara para GetPlayerVirtualWorld(playerid) == 1, para verificar se o player estava no mundo 1 e setar ele na pos de entrada correta.
{//SAIDA HQ 1
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,957.9416,-1556.2628,13.5802);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pLocal] = 255;
}
else if(PlayerToPoint(1.0, playerid,343.7183,304.9376,999.1484) && GetPlayerVirtualWorld(playerid) == 2)//Aki getara o player caso ele entra no mundo 2 ele getara para GetPlayerVirtualWorld(playerid) == 2, para verificar se o player estava no mundo 2 e setar ele na pos de entrada correta.
{//SAIDA HQ 2
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,-1681.4905,1350.2188,7.1722);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pLocal] = 255;
}
Criticas? Sujestoes? Sу falar ai

Crйditos:

Matheus Vieira pelo tutorial.
Tutorial feito em resposta ao tуpico: https://sampforum.blast.hk/showthread.php?tid=324086&page=2



Re: VirtualWorld - Đeagle - 08.03.2012

Poderia explicar as funзхes e etc.
Mais o que vale e a intenзгo.

Й essas definiзхes/variaveis sei lб o nome, que eu saiba irб dar error no GM.


Re: VirtualWorld - mau.tito - 08.03.2012

pawn Код:
if(PlayerToPoint(1.0, playerid,343.7183,304.9376,999.1484) && GetPlayerVirtualWorld(playerid) == 2)//Aki getara o player caso ele entra no mundo 2 ele getara para GetPlayerVirtualWorld(playerid) == 2, para verificar se o player estava no mundo 2 e setar ele na pos de entrada correta.
{//SAIDA HQ 2
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,-1681.4905,1350.2188,7.1722);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pLocal] = 255;
}
Pra Que Seta o Interior 2 Vezes?


Re: VirtualWorld - ApeloForum - 08.03.2012

Que vergonha disso --'
Vocк tem bola de cristal para saber se o cara usa o BMG (PlayerInfo --') Isso com certeza vai dar erro ¬ Alйm disso vocк nгo explicou nada e a estб com uma pйssima Indentaзгo -q


Re: VirtualWorld - Đeagle - 08.03.2012

Alйm disso;

[pInt] e [pLocal] provavelmente irб dar error, GF.


Re: VirtualWorld - histire - 08.03.2012

realmente pegou codigo pronto e isso nao estб explicado em nada apenas codigo pronto..


Re: VirtualWorld - [FFC]Twister - 09.03.2012

Quote:
Originally Posted by mau.tito
Посмотреть сообщение
pawn Код:
if(PlayerToPoint(1.0, playerid,343.7183,304.9376,999.1484) && GetPlayerVirtualWorld(playerid) == 2)//Aki getara o player caso ele entra no mundo 2 ele getara para GetPlayerVirtualWorld(playerid) == 2, para verificar se o player estava no mundo 2 e setar ele na pos de entrada correta.
{//SAIDA HQ 2
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,-1681.4905,1350.2188,7.1722);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pLocal] = 255;
}
Pra Que Seta o Interior 2 Vezes?
ele nao seto 2 veses veja em cima ta definido que ele ta no interior 2 e ira pro interior 0




Re: VirtualWorld - [STR]Matrix - 09.03.2012

Deu uma cabada de erros >> PlayerInfo << meu gm num usa isso n fi


Re: VirtualWorld - BlackCoder - 11.03.2012

para quem nгo entendeu vou dar um breve tutorial de virtualwordl

funзгo: SetPlayerVirtualWorld(playerid,vitualworldid);
OBS: o limite de virtuaisworlds й quase inacabбvel suhsuhs
mundo = virtual world
quando o jogador se conecta por padrгo ele й colocado no mundo 0
quando colocado em outro mundo, ele nao verб mais os carros,players e outros do mundo 0,
esta funзгo geralente й utilizada para separar o jogador do normal, em eventos, em off etc.