[Ayuda] SetPlayerWeather...
#1

Buenas a todos, Como puedo hacer para chekear un clima y si esta ese clima puesto le de tal funcion, intente poniendo SetPlayerWeather en un if peor no sirve, por ke le da el clima y yo kiero ke lo chekee solamente y le de una funcion.

PHP код:
if(SetPlayerWeather(playerid37)) 

     
//Funcion 

Alguien sabe como puedo hacerlo?

Desde ya muchas gracias.
Reply
#2

No hay una funcion directa para realizar lo que tu quieres. Sin embargo, puedes realizar lo siguiente:

pawn Код:
new Clima[MAX_PLAYERS];
//debajo de los includes
#define SetPlayerWeather _SetPlayerWeather
#define GetPlayerWeather(%0) Clima[(%0)]

//en el final de tu script
stock _SetPlayerWeather(playerid, weatherid)
{
    Clima[playerid] = weatherid;
    return SetPlayerWeather(playerid, weatherid);
}
Reply
#3

Eso del Player Weather se podrнa utilizar para detectar cheats, cierto? Ya que el cheat te permite cambiar el tiempo.
Reply
#4

Quote:
Originally Posted by santi.arg
Посмотреть сообщение
Eso del Player Weather se podrнa utilizar para detectar cheats, cierto? Ya que el cheat te permite cambiar el tiempo.
no se puede, porque el cheat cambia el tiempo del lado del cliente y no del servidor.
Reply
#5

Quote:
Originally Posted by santi.arg
Посмотреть сообщение
Eso del Player Weather se podrнa utilizar para detectar cheats, cierto? Ya que el cheat te permite cambiar el tiempo.
En este caso en particular no.

Quote:
Originally Posted by Daniel-92
Посмотреть сообщение
no se puede, porque el cheat cambia el tiempo del lado del cliente y no del servidor.
Justamente eso es lo que permite saber si un jugador utiliza o no cheats. Aъn asi en este caso en particular no es posible detectarlo, ya que nativamente no hay una funcion que permita obtener el clima del cliente, pero si existiese, se podria.
Reply
#6

no me funciono, no lo detecta :S
Reply
#7

Intenta colocarlo en la funciуn OnPlayerUpdate(playerid)
Reply
#8

Quote:
Originally Posted by bytytus
Посмотреть сообщение
no me funciono, no lo detecta :S
Como utilizas la funcion?

Notas:
  • Si cambias el clima desde un script diferente al script donde esta la funcion, la misma no guardara dicho valor, para evitar esto deberas cambiar el array por pVars.
  • Si cambias el clima con cheats, esta funcion no detectara el cambio.
  • Si utilizas la funcion GetPlayerWeather antes de SetPlayerWeather, la misma retornara 0.
Quote:
Originally Posted by Soi_salva
Посмотреть сообщение
Intenta colocarlo en la funciуn OnPlayerUpdate(playerid)
Con que fin?
Reply
#9

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
Como utilizas la funcion?

Notas:
  • Si cambias el clima desde un script diferente al script donde esta la funcion, la misma no guardara dicho valor, para evitar esto deberas cambiar el array por pVars.
  • Si cambias el clima con cheats, esta funcion no detectara el cambio.
  • Si utilizas la funcion GetPlayerWeather antes de SetPlayerWeather, la misma retornara 0.


Con que fin?
Asi lo Utilizo:

PHP код:
#include <a_samp>
new Text:TextDraw[2];
new 
Clima[MAX_PLAYERS];
#define SetPlayerWeather _SetPlayerWeather
#define GetPlayerWeather(%0) Clima[(%0)]
public OnFilterScriptInit()
{
    
//TextDraw ...
    
return 1;
}
public 
OnPlayerSpawn(playerid)
{
    if(
_SetPlayerWeather(playerid2)) TextDrawShowForPlayer(playeridTextDraw[1]);
    return 
1;
}
stock _SetPlayerWeather(playeridweatherid)
{
    
Clima[playerid] = weatherid;
    return 
SetPlayerWeather(playeridweatherid);

Reply
#10

la funcion que debes utilizar para saber el clima que le colocaste al usuario es "GetPlayerWeather", SetPlayerWeather es para setear el mismo, (y no hace falta que utilizes _SetPlayerWeather, ya que gracias a la macro, SetPlayerWeather es _SetPlayerWeather).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)