[Help] Server Sided Money Pawn [Please] - 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: [Help] Server Sided Money Pawn [Please] (
/showthread.php?tid=299904)
[Help] Server Sided Money Pawn [Please] -
andrew2695 - 27.11.2011
Hi im trying to put a server sided money on my server, I folowed this tutorial
http://forum.sa-mp.com/showthread.ph...er+money+sided But when im done, I get 4 pawn errors. :/ Could any help me?
Код:
error 029: invalid expression, assumed zero
error 017: undefined symbol "MoneyTimer"
error 029: invalid expression, assumed zero
error 017: undefined symbol "MoneyTimer"
symbol is never used: "cash"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Thx
Re: [Help] Server Sided Money Pawn [Please] -
Jake__ - 27.11.2011
Here you go.
I compiled this and it works just fine.
Код:
#include <a_samp> // If you've already included this, don't bother copy+pasting this.
#define ResetMoneyBar ResetPlayerMoney // Goes at the top of your GM
#define UpdateMoneyBar GivePlayerMoney // Same applies here
new cash[MAX_PLAYERS]; // Goes above all of the stocks
stock GivePlayerCash(playerid, money) // Place these before OnPlayerConnect and OnGameModeInit
{
cash[playerid] += money;
ResetMoneyBar(playerid, cash[playerid);
return cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
cash[playerid] = money;
ResetMoneyBar(playerid);
UpdateMoneyBar(playerid, cash[playerid])
return cash[playerid];
}
stock ResetPlayerCash(playerid)
{
cash[playerid] = 0;
ResetMoneyBar(playerid)
UpdateMoneyBar(playerid, cash[playerid]);
return cash[playerid]
}
stock GetPlayerCash(playerid)
{
return cash[playerid];
}
OnPlayerConnect()
{
ResetPlayerCash(playerid) // Copy only this if you have only OnPlayerConnect
return 1;
}
OnGameModeInit() // Don't redefine
{
SetTimer("mtimer" , 1000, 1); // Copy only this if you already have OnGameModeInit
return 1;
}
forward mtimer();
public mtimer()
{
new un[MAX_PLAYER_NAME];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerCash(i) != GetPlayerMoney(i))
{
ResetMoneyBar(i);
UpdateMoneyBar(i, GetPlayerCash (i));
new hack = GetPlayerMoney(i) - GetPlayerCash(i);
GetPlayerName(i, un, sizeof(un));
{
printf("%s has tried to hack $%d.", un, hack);
}
}
}
}
//return 1;
}