SA-MP Forums Archive
[Ajuda] Setar Climas em Cidades - 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)
+---- Thread: [Ajuda] Setar Climas em Cidades (/showthread.php?tid=658455)



Setar Climas em Cidades - Poseidon4625 - 04.09.2018

Entгo eu fiz esse sistema pro meu servidor, sу que tem um problema estб setando o clima em todo o mapa, e o engraзado й que estou usando a funзгo para o player e em locais que coloquei, sу que estб setando o clima global de San Andreas.

PHP код:
new climasValidos[]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,30,31};
public 
OnFilterScriptInit()
{
    
SetTimer("Climas",10000true);
    return 
1;
}
forward Climas(playerid);
public 
Climas(playerid)
{
    new 
test random(12);
    new 
Random random(sizeof(climasValidos));
    if(
test == 0)
    {
        
SetPlayerWeather(playeridclimasValidos[Random]),IsPlayerInLSS(playerid);
        
SendClientMessageToAll(-1"| INFO | Mudanзa de Tempo Prevista Para Los Santos!");
        return 
1;
    }
        ......
        
//regioes
        
stock IsPlayerInLSS(playerid)
       {
               new 
Float:x,Float:y,Float:z;
               
GetPlayerPos(playeridxyz);
               if(
>= -28.857421 && >= -2853.619140 && <= 2953.142578 && <= 604.380859) return 1;
               else return 
0;
        } 
Se alguйm poder ajudar agradeзo


Re: Setar Climas em Cidades - ipsLuan - 04.09.2018

PHP код:
if(IsPlayerInLS(playerid)) {
    
SetPlayerWeather(playeridclimasValidos[Random]);
    
SendClientMessageToAll(-1"| INFO | Mudanзa de Tempo Prevista Para Los Santos!"); 

PHP код:
stock IsPlayerInLS(playerid) {
    new 
Float:xls,Float:yls,Float:zls;
    
GetPlayerPos(playerid,xls,yls,zls);
    if(
xls && yls 0) return 1;
    return 
0;
}
stock IsPlayerInSF(playerid) {
    new 
Float:xls,Float:yls,Float:zls;
    
GetPlayerPos(playerid,xls,yls,zls);
    if(
xls 0) return 1;
    return 
0;
}
stock IsPlayerInLV(playerid) {
    new 
Float:xls,Float:yls,Float:zls;
    
GetPlayerPos(playerid,xls,yls,zls);
    if(
xls && yls 0) return 1;
    return 
0;

Esse sistema й um pouco complexo e irб precisar de algumas gambiarras...


Re: Setar Climas em Cidades - GSantana - 05.09.2018

olha, se nгo me falha a memуria o clima seta й no mapa inteiro e nгo em uma sу cidade


Re: Setar Climas em Cidades - Poseidon4625 - 05.09.2018

Quote:
Originally Posted by GSantana
Посмотреть сообщение
olha, se nгo me falha a memуria o clima seta й no mapa inteiro e nгo em uma sу cidade
Dб sim man, usando uma gangzone invisнvel na cidade que tu quer da pra fazer com que mude apenas lб usando tambйm a localizaзгo do player o problema й que nгo estou conseguindo fazer isso kk, eu jб vi em um servidor, acho que foi no CSA


Re: Setar Climas em Cidades - 1sbedx - 05.09.2018

https://sampforum.blast.hk/showthread.php?tid=170552


Re: Setar Climas em Cidades - Poseidon4625 - 05.09.2018

Quote:
Originally Posted by 1sbedx
Посмотреть сообщение
Show mano muito obrigado, irei ver esse sistema e fazer um.


Re: Setar Climas em Cidades - Poseidon4625 - 06.09.2018

Esse FS possui o mesmo problema que estou citando em meu tуpico, ele muda o clima no mapa todo, fiz alguns testes com apenas uma zona pequena e tem o mesmo problema, oque eu quero fazer й que set o clima em apenas uma бrea onde o jogador estб, exemplo em Los Santos estб chovendo e em San Fierro estб com o tempo limpo, e nos outros diversos locais estб com o tempo 0 que й o padrгo do gamemode, alguйm pode me ajudar com isso?


Re: Setar Climas em Cidades - FerrariL - 06.09.2018

Veja se isso resolve seu problema mano.
PHP код:
new ClimaCidades[3]; // Armazena o id do clima em cada espaзo do vetor.
//нndice 0 - corresponde a LS
//нndice 1 - corresponde a LV
//нndice 2 - corresponde a SF
public OnGameModeInit()
{
   
SetTimer("MudaClima",1000 60 60,true); 
   return 
1;
}
public 
OnPlayerConnect(playerid)
{
   
SetTimerEx("VerificaCidade"1000true"i"playerid);
   return 
1;
}
forward MudaClima();
public 
MudaClima()
{
  for(new 
0sizeof(ClimaCidades); i++)
   
ClimaCidades[i] = random(31) + 1;
}
forward VerificaCidade(playerid);
public 
VerificaCidade(playerid)
{
   if(
IsPlayerInSF(playerid))
     
SetPlayerWeather(playerid,ClimaCidades[0]);
   else if(
IsPlayerInLV(playerid))
     
SetPlayerWeather(playerid,ClimaCidades[1]);
   else if(
IsPlayerInSF(playerid))
    
SetPlayerWeather(playerid,ClimaCidades[2]);
   else 
    
SetPlayerWeather(playerid,1);
}
IsPlayerInLS(playerid) { 
    new 
Float:xls,Float:yls,Float:zls
    
GetPlayerPos(playerid,xls,yls,zls); 
    if(
xls && yls 0) return 1
    return 
0

IsPlayerInSF(playerid) { 
    new 
Float:xls,Float:yls,Float:zls
    
GetPlayerPos(playerid,xls,yls,zls); 
    if(
xls 0) return 1
    return 
0

IsPlayerInLV(playerid) { 
    new 
Float:xls,Float:yls,Float:zls
    
GetPlayerPos(playerid,xls,yls,zls); 
    if(
xls && yls 0) return 1
    return 
0




Re: Setar Climas em Cidades - Poseidon4625 - 06.09.2018

Quote:
Originally Posted by FerrariL
Посмотреть сообщение
Veja se isso resolve seu problema mano.
PHP код:
new ClimaCidades[3]; // Armazena o id do clima em cada espaзo do vetor.
//нndice 0 - corresponde a LS
//нndice 1 - corresponde a LV
//нndice 2 - corresponde a SF
public OnGameModeInit()
{
   
SetTimer("MudaClima",1000 60 60,true); 
   return 
1;
}
public 
OnPlayerConnect(playerid)
{
   
SetTimerEx("VerificaCidade"1000true"i"playerid);
   return 
1;
}
forward MudaClima();
public 
MudaClima()
{
  for(new 
0sizeof(ClimaCidades); i++)
   
ClimaCidades[i] = random(31) + 1;
}
forward VerificaCidade(playerid);
public 
VerificaCidade(playerid)
{
   if(
IsPlayerInSF(playerid))
     
SetPlayerWeather(playerid,ClimaCidades[0]);
   else if(
IsPlayerInLV(playerid))
     
SetPlayerWeather(playerid,ClimaCidades[1]);
   else if(
IsPlayerInSF(playerid))
    
SetPlayerWeather(playerid,ClimaCidades[2]);
   else 
    
SetPlayerWeather(playerid,1);
}
IsPlayerInLS(playerid) { 
    new 
Float:xls,Float:yls,Float:zls
    
GetPlayerPos(playerid,xls,yls,zls); 
    if(
xls && yls 0) return 1
    return 
0

IsPlayerInSF(playerid) { 
    new 
Float:xls,Float:yls,Float:zls
    
GetPlayerPos(playerid,xls,yls,zls); 
    if(
xls 0) return 1
    return 
0

IsPlayerInLV(playerid) { 
    new 
Float:xls,Float:yls,Float:zls
    
GetPlayerPos(playerid,xls,yls,zls); 
    if(
xls && yls 0) return 1
    return 
0

Vlws kk, problema resolvido!