06.04.2012, 10:34
I did what you said, but now, another error comes up
The thing is, my cash functions are in my gamemode and the XtremeAdministrator2 with the /setcash command is a filescript. So can you help me?
Here's all of my 'Cash' stuff.
And here is the current /setcash command
So once again, my Cash publics are in my gamemode and /setcash is in a filescript. Please help!
pawn Код:
C:\Documents and Settings\Administrator\My Documents\Downloads\Basic RP Script Scratch FIX\filterscripts\XtremeAdmin2.pwn(640) : error 017: undefined symbol "GivePlayerCash"
1 Error.
Here's all of my 'Cash' stuff.
pawn Код:
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
new Cash[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("MoneyTimer", 1000, 1);
public OnPlayerConnect(playerid)
{
ResetPlayerCash(playerid); //Resetting the players cash variable to zero.
forward GivePlayerCash(playerid, money);
forward SetPlayerCash(playerid, money);
forward ResetPlayerCash(playerid);
forward GetPlayerCash(playerid);
public GivePlayerCash(playerid, money)
{
Cash[playerid] += money;
ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
return Cash[playerid];
}
public SetPlayerCash(playerid, money)
{
Cash[playerid] = money;
ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
return Cash[playerid];
}
public ResetPlayerCash(playerid)
{
Cash[playerid] = 0;
ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
return Cash[playerid];
}
public GetPlayerCash(playerid)
{
return Cash[playerid];
}
public MoneyTimer()
{
new username[MAX_PLAYER_NAME];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerCash(i) != GetPlayerMoney(i))
{
ResetMoneyBar(i);//Resets the money in the original moneybar, Do not remove!
UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove!
new hack = GetPlayerMoney(i) - GetPlayerCash(i);
GetPlayerName(i,username,sizeof(username));
printf("%s has picked up/attempted to spawn $%d.", username,hack);
}
}
}
}
pawn Код:
dcmd_setcash(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"setcash")) {
new tmp[256],tmp2[256],Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp)||!strlen(tmp2)||!IsNumeric(tmp2)||!(strval(tmp2) >= 1 && strval(tmp2) <= 1000000)) return SendClientMessage(playerid,red,"Syntax Error: \"/SETCASH <NICK OR ID> <1 - 1,000,000>\".");
new id; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID) {
SendCommandMessageToAdmins(playerid,"SETCASH");
new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
if(id != playerid) { format(string,256,"Administrator \"%s\" has set your cash to $%d.",name,strval(tmp2)); SendClientMessage(id,yellow,string); format(string,256,"You have set \"%s's\" cash to $%d.",ActionName,strval(tmp2)); SendClientMessage(playerid,yellow,string); }
else { format(string,256,"You have set your cash to $%d.",strval(tmp2)); SendClientMessage(playerid,yellow,string); }
ResetPlayerMoney(id); return GivePlayerCash(id,strval(tmp2));
} return SendClientMessage(playerid,red,"ERROR: You can not set a disconnected player's cash.");
} else return SendLevelErrorMessage(playerid,"setcash");
}