Kill reward Not Working properly
#2

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(GetPlayerClanId(playerid) == GetPlayerClanId(killerid))
    {
          new string1[150],string[150];
          new name1[150];
          GetPlayerName(i, name1, sizeof(name1));
          format(string1,sizeof(string1),"No Reward For Killing Own Clan Member");
          SendClientMessage(playerid,COLOR_RED,string1);
          format(string,sizeof(string),"%s has killed %s",name1,Playername);
          SendMessageToClanMembers(playerid,COLOR_RED,string);
     }
     else
     {
          new string[150];
          new moneyreward = 1000+random(2001);
          foreach(new i : Player)
          {
            if(GetPlayerClanId(i) == GetPlayerClanId(killerid))
            {
		          format(string, sizeof(string), "[Clan]: You've been rewarded %i$ from %s's kill!", moneyreward, Playername);
		          SendClientMessage(i, 0x00FF7FAA, string);
		          GivePlayerMoney(i, moneyreward);
             }
      }

	return 1;
}
Try this

Also
GivePlayerMoney(i, moneyreward)
try not using GivePlayerMoney, since this can be manipulated by users and would allow money hacks to be used,
instead have a variable store the Player's money, eg

new pMoney[MAX_PLAYER];
when you load stats, load the player's money into it and when you save the stats, save this variable
Reply


Messages In This Thread
Kill reward Not Working properly - by Jokers98s - 28.01.2018, 08:06
Re: Kill reward Not Working properly - by iSteve - 28.01.2018, 09:20
Re: Kill reward Not Working properly - by Jokers98s - 28.01.2018, 09:40

Forum Jump:


Users browsing this thread: 1 Guest(s)