[Ayuda] Convertir Fs a Inc -
INKISICION - 16.06.2015
Hola, bueno tengo un problema, ya que estaba tratando de usar un anti money cheat con variables
pero estoy usando el Gamemode y aparte un FS por lo cual no funciona y ejecuta la funcion de Kick si se Obtiene el dinero en alguno de los 2 asн que pense hacerlo como un Inc, asн quiza podria usarlo en ambos y que no hubiera problemas de kick, pero no se aъn si funcionara
el codigo es este
PHP код:
new pMoney[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
pMoney[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
pMoney[playerid] = 0;
return 1;
}
//Funcion Por Timer OngameMode o por Update
if(GetPlayerMoney(playerid) > pMoney[playerid])
{
format(string2, sizeof(string2), "Anti money hack fuiste sacado %s",PlayerName(playerid));
SendClientMessageToAll(-1, string2);
//Kick(playerid);
}
stock a_GivePlayerMoney(playerid, money)
{
pMoney[playerid] += money;
GivePlayerMoney(playerid, money);
}
stock a_SetPlayerMoney(playerid, money)
{
pMoney[playerid] = money;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, money);
}
En el GM y FS cambiare los GivePlayerMoney por los a_GivePlayerMoney y los ResetPlayerMoney por a_SetPlayerMoney y quiza ya usando como Include sea posible evitar el Money hack, pero no sй si funcionaria, ya que mi tiempo dedicado a esto es muy escaso apesar de que lleve tiempo
Espero aguien me pueda ayudar en esto
Tengo esta
https://sampforum.blast.hk/showthread.php?tid=570910 pero como mencione no entiend mucho ya que antes no he hecho algo asн
Respuesta: [Ayuda] Convertir Fs a Inc -
Goncho28 - 16.06.2015
Para que sea .inc simplemente lo guardas como <NOMBRE>.inc
Re: Respuesta: [Ayuda] Convertir Fs a Inc -
INKISICION - 16.06.2015
Quote:
Originally Posted by Goncho28
Para que sea .inc simplemente lo guardas como <NOMBRE>.inc
|
Eso lo sй, pero hablo "Para devoluciones de llamada en cadena, simplemente comprobar si existe la siguiente funciуn en la cadena, y si lo hace entonces lo llaman"
PHP код:
public OnGameModeInit()
{
#if defined MyLib_OnGameModeInit
MyLib_OnGameModeInit();
#endif
return 1;
}
This is still followed by the standard ALS checks (note that, as ever, using "_ALS_" is VERY important - don't change that or your hooks will be incompatible with other includes):
Code:
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit MyLib_OnGameModeInit
Darle la funciуn para evitar Bugs, ya que asн simple me da errores como los de que ya esta definidas ciertas callbacks
error 021: symbol already defined: "Streamer_OnPlayerConnect"
error 021: symbol already defined: "ppb_OnPlayerDisconnect"
Respuesta: [Ayuda] Convertir Fs a Inc -
bm0z - 17.06.2015
Asн es como creo que deberнa ser:
http://pastebin.com/GLwxC7wZ
De esta forma, si se usa desde un FilterScript, utiliza CallRemoteFunction para llamar a las funciones del GameMode. Con esto se solucionarнa tu problema.
Otra cosa es que no pondrнa un Kick sino que directamente resetearнa el dinero.
Respuesta: [Ayuda] Convertir Fs a Inc -
DesingMyCry - 17.06.2015
No terminй de entender si te referias al hook de callbacks... si es asн, aquн una idea:
pawn Код:
public OnGameModeInit()
{
#if defined p_OnGameModeInit
return p_OnGameModeInit();
#else
return 1;
#endif
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit p_OnGameModeInit
#if defined p_OnGameModeInit
forward p_OnGameModeInit();
#endif
A tu cуdigo le faltу declarar la nueva callback. Lo de que ya estбn definidas, puede ser porque el prefijo ya estaba siendo usado.
Re: Respuesta: [Ayuda] Convertir Fs a Inc -
INKISICION - 18.06.2015
Quote:
Originally Posted by bm0z
Asн es como creo que deberнa ser: http://pastebin.com/GLwxC7wZ
De esta forma, si se usa desde un FilterScript, utiliza CallRemoteFunction para llamar a las funciones del GameMode. Con esto se solucionarнa tu problema.
Otra cosa es que no pondrнa un Kick sino que directamente resetearнa el dinero.
|
bm0z Muchisimas gracias brother
Si
DesingMyCry en si hablaba del hook de callbacks, gracias por su ayuda
Ha los 2 ya les di su +1 Respect por su ayuda