08.09.2015, 11:57
Код:
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;
}
Код:
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);
}
}
}
}


