Problem gamemode compbiler - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem gamemode compbiler (
/showthread.php?tid=548799)
Problem gamemode compbiler -
ewenement - 02.12.2014
I have a problem with the map
Код:
C:\Users\Michał\Desktop\PAWNO\include\moneyhax.inc(29) : warning 219: local variable "money" shadows a variable at a preceding level
C:\Users\Michał\Desktop\PAWNO\include\moneyhax.inc(52) : warning 219: local variable "money" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Re: Problem gamemode compbiler -
UltraScripter - 02.12.2014
that means u allready have new money
just change the new money; to something else
Re: Problem gamemode compbiler -
ewenement - 02.12.2014
I would ask for the code, because it is difficult for me.
Re: Problem gamemode compbiler -
AnthonyTimmers - 02.12.2014
Show us your lines from 29 till 52.
It basically means you are using
multiple times.
Re: Problem gamemode compbiler -
ewenement - 02.12.2014
29. new money;
52. public GivePlayerMonez(playerid, money)
55. if( rmoney < PMoney[playerid] && rmoney > -1 ) PMoney[playerid]=rmoney;
Re: Problem gamemode compbiler -
AnthonyTimmers - 02.12.2014
Either change money to another name on both line 29 and 52 if it is a different variable. If it's the same variable, remove line 29.
Re: Problem gamemode compbiler -
ewenement - 02.12.2014
Please edit, becouse i don't understand ;<
Код:
/**********************************
* *
* @Author: wups *
* @Version: 1.1.0 *
* @Released: 31/10/2010 *
* *
**********************************/
#if defined FILTERSCRIPT
#endinput
#endif
#if defined _moneyhax_included
#endinput
#endif
#define _moneyhax_included
#define CHECK_TIME 30 // in seconds to check if money is equal to the saved one.
new PMoney[MAX_PLAYERS];
forward GetPlayerMonez(playerid);
forward ResetPlayerMonez(playerid);
forward GivePlayerMonez(playerid,money);
forward MoneyCheck();
public MoneyCheck()
{
new money;
#if defined _foreach_included
foreach(Player,playerid)
{
money = GetPlayerMoney(playerid);
if( money < PMoney[playerid] && money > -1 ) PMoney[playerid]=money;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PMoney[playerid]);
}
#else
for(new playerid;playerid<MAX_PLAYERS;playerid++) if(IsPlayerConnected(playerid))
{
money = GetPlayerMoney(playerid);
if( money < PMoney[playerid] && money > -1 ) PMoney[playerid]=money;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PMoney[playerid]);
}
#endif
return 1;
}
public GivePlayerMonez(playerid, money)
{
new rmoney = GetPlayerMoney(playerid);
if( rmoney < PMoney[playerid] && rmoney > -1 ) PMoney[playerid]=rmoney;
PMoney[playerid]+=money;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PMoney[playerid]);
return 1;
}
public ResetPlayerMonez(playerid)
{
ResetPlayerMoney(playerid);
PMoney[playerid]=0;
return 1;
}
public GetPlayerMonez(playerid) return PMoney[playerid];
#define GivePlayerMoney GivePlayerMonez
#define GetPlayerMoney GetPlayerMonez
#define ResetPlayerMoney ResetPlayerMonez
public OnGameModeInit()
{
SetTimer("MoneyCheck",CHECK_TIME*1000,true);
if (funcidx("moneyhax_OnGameModeInit") != -1)
{
return CallLocalFunction("moneyhax_OnGameModeInit", "");
}
return 1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit moneyhax_OnGameModeInit
forward moneyhax_OnGameModeInit();
public OnPlayerConnect(playerid)
{
PMoney[playerid]=0;
if (funcidx("moneyhax_OnPlayerConnect") != -1)
{
return CallLocalFunction("moneyhax_OnPlayerConnect", "i", playerid);
}
return 1;
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect moneyhax_OnPlayerConnect
forward moneyhax_OnPlayerConnect(playerid);