local variable and public function lacks errors
#1

Код:
dcmd_adgivecash(playerid,params[])
{
	new ID;
	new Cash;
	new string[128];
    if(sscanf(params,"ui",ID,Cash))
	{
	    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /adg(ive)c(ash) (Player Name/ID) (Amount)");
	    return 1;
	}
	if(IsSpawned[ID] == 0)
	{
	    format(string,sizeof(string),"%s(%d) is must be alive and spawned in order to give them cash.",PlayerName(ID),ID);
	    SendClientMessage(playerid,COLOR_ERROR,string);
	    return 1;
	}
	if(!IsPlayerConnected(ID))
	{
	    format(string,sizeof(string),"The Player ID (%d) is not connected to the server.",ID);
	    SendClientMessage(playerid,COLOR_ERROR,string);
	    return 1;
	}
	GivePlayerCash(ID,Cash);
	format(string,sizeof(string),"[ADMIN CASH] Administrator has given you Cash. Amount: %d.",Cash);
	SendClientMessage(ID,COLOR_ADMIN,string);

	format(string,sizeof(string),"[ADMIN CASH] You have given %s(%d) Cash. Amount: %d.",PlayerName(ID),ID,Cash);
	SendClientMessage(playerid,COLOR_ADMIN,string);

	format(string,sizeof(string),"9[ADMIN CASH] Administrator %s(%d) has given %s(%d) Cash. Amount: %d.",PlayerName(playerid),playerid,PlayerName(ID),ID,Cash);
	IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
	return 1;
}
and

Код:
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);
			}
		}
	}
}
any help?
Reply
#2

I'm confused. The problem is that it /LACKS/ errors?
Reply
#3

All those return 1; is kinda useless, remove them except THE last one
Reply
#4

Quote:
Originally Posted by saffierr
Посмотреть сообщение
All those return 1; is kinda useless, remove them except THE last one
if he removed return 1; from if else conditions then command will works if there are any if else conditions like any player is not connected then it will show player is not connected but command will works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)