Jump to content
  • 0

/buymats , cand scriu cu minus(-) da bani


Question

Posted (edited)


Problema intalnita (descriere): Daca scriu suma pe care vreau sa o cumpar de materiale cu - in fata imi da bani pe materiale si materialele pe minus.

Folosesc raven's rp

Ero(area / rile) / warning-(ul / urile): -

Liniile de cod / sursa / script-ul:

 if(strcmp(cmd,"/buymats",true)==0) // By LordMan
	{
		if(IsPlayerConnected(playerid))
		{
			if(gPlayerLogged[playerid] == 0)
			{
			SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
			return 1;
			}
			if(PlayerInfo[playerid][pJob] != 23)
			{
			SendClientMessage(playerid, COLOR_GREY, "   You are not a gun maker. ");
			return 1;
			}
			if(!IsPlayerInRangeOfPoint(playerid, 2, 2230.3579,-2286.2107,14.3751))
			{
			SendClientMessage(playerid, COLOR_GREY, "   You are not at the materials bank !");
			return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buymats [ammount]");
			return 1;
			}
			new mammount;
			mammount = strval(tmp);
			if(mammount > matssys[MatsAmmount])
			{
			SendClientMessage(playerid, COLOR_GREY, "   They don't have enough materials ! ");
			return 1;
			}
			if(GetPlayerMoney(playerid) < mammount * 15 - 1)
			{
			SendClientMessage(playerid, COLOR_GREY, "   You don't have enough money ! ");
			return 1;
			}
			if (GetPlayerMoney(playerid) > ScriptMoney[playerid])
			{
			    format(string, sizeof(string), "[Mândârie]: %s (%d) Is possibly Using Money Hacks; Check him inmediately!!", sendername,playerid);
				SendAdminMessage(COLOR_YELLOW, string);
				PlayerSuspicious[playerid] = 1;
				PlayerMoneyHacking[playerid] = 1;
				PlayerSuspiciousMoney[playerid] = (GetPlayerMoney(playerid) - ScriptMoney[playerid]);
				PlayerGotSpottedRecently[playerid] = 1;
				SetTimerEx("ResetAcWarn", 300000, 0, "i", playerid);
     			SendClientMessage(playerid, COLOR_CREAM, "* Transaction Stopped, you're probably on a cash inbalance, contact an administrator.");
			    return 1;
			}
			matssys[MatsAmmount] -= mammount;
			PlayerInfo[playerid][pMats] += mammount;
			SafeGivePlayerMoney(playerid, - mammount);
			format(string, sizeof(string), "   You have bought %d materials for %d$ !", mammount, mammount * 15);
			SendClientMessage(playerid, COLOR_GREY, string);
			SaveMatsSystem();
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /buymats %d ($%d)",d,m,y,h,mi,s,sendername, mammount, mammount * 15);
			CommandLog(string);
			return 1;
		}
		return 1;
	}
Imagini / Video (optional):-

Ati incercat sa rezolvati singur?:-

Edited by MAXYMUSS

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

Vezi asa : 

	if(strcmp(cmd,"/buymats",true)==0) // By LordMan
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
            SendClientMessage(playerid, COLOR_GREY, " You need to login first !");
            return 1;
            }
            if(PlayerInfo[playerid][pJob] != 23)
            {
            SendClientMessage(playerid, COLOR_GREY, " You are not a gun maker. ");
            return 1;
            }
            if(!IsPlayerInRangeOfPoint(playerid, 2, 2230.3579,-2286.2107,14.3751))
            {
            SendClientMessage(playerid, COLOR_GREY, " You are not at the materials bank !");
            return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buymats [ammount]");
            return 1;
            }
            new mammount;
            mammount = strval(tmp);
            if(mammount <= 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "You need to buy more materials .");
                return 1;
	    }
            if(mammount > matssys[MatsAmmount])
            {
            SendClientMessage(playerid, COLOR_GREY, " They don't have enough materials ! ");
            return 1;
            }
            if(GetPlayerMoney(playerid) < mammount * 15 - 1)
            {
            SendClientMessage(playerid, COLOR_GREY, " You don't have enough money ! ");
            return 1;
            }
            if (GetPlayerMoney(playerid) > ScriptMoney[playerid])
            {
           		format(string, sizeof(string), "[Mândârie]: %s (%d) Is possibly Using Money Hacks; Check him inmediately!!", sendername,playerid);
                SendAdminMessage(COLOR_YELLOW, string);
                PlayerSuspicious[playerid] = 1;
                PlayerMoneyHacking[playerid] = 1;
                PlayerSuspiciousMoney[playerid] = (GetPlayerMoney(playerid) - ScriptMoney[playerid]);
                PlayerGotSpottedRecently[playerid] = 1;
                SetTimerEx("ResetAcWarn", 300000, 0, "i", playerid);
            	SendClientMessage(playerid, COLOR_CREAM, "* Transaction Stopped, you're probably on a cash inbalance, contact an administrator.");
           		return 1;
            }
            matssys[MatsAmmount] -= mammount;
            PlayerInfo[playerid][pMats] += mammount;
            SafeGivePlayerMoney(playerid, - mammount);
            format(string, sizeof(string), " You have bought %d materials for %d$ !", mammount, mammount * 15);
            SendClientMessage(playerid, COLOR_GREY, string);
            SaveMatsSystem();
            new y, m, d;
            new h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /buymats %d ($%d)",d,m,y,h,mi,s,sendername, mammount, mammount * 15);
            CommandLog(string);
            return 1;
        }
        return 1;
  }
Edited by NoNamed
  • 0
Posted (edited)
if(strcmp(cmd,"/buymats",true)==0) // By LordMan
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
            SendClientMessage(playerid, COLOR_GREY, " You need to login first !");
            return 1;
            }
            if(PlayerInfo[playerid][pJob] != 23)
            {
            SendClientMessage(playerid, COLOR_GREY, " You are not a gun maker. ");
            return 1;
            }
            if(!IsPlayerInRangeOfPoint(playerid, 2, 2230.3579,-2286.2107,14.3751))
            {
            SendClientMessage(playerid, COLOR_GREY, " You are not at the materials bank !");
            return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buymats [ammount]");
            return 1;
            }
            new mammount;
            mammount = strval(tmp);
            if(mammount <= 0) return 1; //sau un text, ceva
            if(mammount > matssys[MatsAmmount])
            {
            SendClientMessage(playerid, COLOR_GREY, " They don't have enough materials ! ");
            return 1;
            }
            if(GetPlayerMoney(playerid) < mammount * 15 - 1)
            {
            SendClientMessage(playerid, COLOR_GREY, " You don't have enough money ! ");
            return 1;
            }
            if (GetPlayerMoney(playerid) > ScriptMoney[playerid])
            {
             format(string, sizeof(string), "[Mândârie]: %s (%d) Is possibly Using Money Hacks; Check him inmediately!!", sendername,playerid);
                SendAdminMessage(COLOR_YELLOW, string);
                PlayerSuspicious[playerid] = 1;
                PlayerMoneyHacking[playerid] = 1;
                PlayerSuspiciousMoney[playerid] = (GetPlayerMoney(playerid) - ScriptMoney[playerid]);
                PlayerGotSpottedRecently[playerid] = 1;
                SetTimerEx("ResetAcWarn", 300000, 0, "i", playerid);
            SendClientMessage(playerid, COLOR_CREAM, "* Transaction Stopped, you're probably on a cash inbalance, contact an administrator.");
             return 1;
            }
            matssys[MatsAmmount] -= mammount;
            PlayerInfo[playerid][pMats] += mammount;
            SafeGivePlayerMoney(playerid, - mammount);
            format(string, sizeof(string), " You have bought %d materials for %d$ !", mammount, mammount * 15);
            SendClientMessage(playerid, COLOR_GREY, string);
            SaveMatsSystem();
            new y, m, d;
            new h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /buymats %d ($%d)",d,m,y,h,mi,s,sendername, mammount, mammount * 15);
            CommandLog(string);
            return 1;
        }
        return 1;
    }
Edited by Crocodilu
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.