How to calculate respect points at /buylevel?
#1

Ok , this is my "/buylevel" command.

The problem is i don't know how to calculate to set the "RespectNEC" (Respect necessary)

x1/x2 (Respect now / Respect necessary)
can somebody do me a example please?

Код:
	if (strcmp(cmd, "/buylevel", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (IsPlayerAlreadyLoggedIN[playerid] != 0)
			{
				PlayerInfo[playerid][Money] = GetPlayerMoney(playerid);
				if(PlayerInfo[playerid][Respect] >= 0)
				{
					new nxtlevel = PlayerInfo[playerid][Nivel] * 2;
					new costlevel = nxtlevel*130;
					new infostring[256];
     				if ( PlayerInfo[playerid][Respect] < nxtlevel )
					{
						format(infostring, 256, "{FFFFFF}(( {FFCC00}Informatie - {C0C0C0}urmatorul nivel necesita %d/%d respect points din pacate {FFFFFF} )) ",PlayerInfo[playerid][Respect], PlayerInfo[playerid][RespectNEC]);
						SendClientMessage(playerid, COLOR_GRAD1, infostring);
						return 1;
					}
					else if(GetPlayerMoney(playerid) < costlevel)
					{
						format(infostring, 256, "{FFFFFF}(( {FFCC00}Informatie - {C0C0C0}urmatorul nivel costa %s$ din pacate {FFFFFF} )) ",FormatMoney(costlevel));
						SendClientMessage(playerid, COLOR_GRAD1, infostring);
						return 1;
					}

					else
					{
						GivePlayerMoney(playerid, (-costlevel));
						PlayerInfo[playerid][Nivel]++;
						PlayerInfo[playerid][Respect] -= PlayerInfo[playerid][RespectNEC];
						new respectramas = PlayerInfo[playerid][Respect];
						if(respectramas > 0)
					    {
						    PlayerInfo[playerid][Respect] = respectramas;
						}
						else if(respectramas == 0)
					    {
						    PlayerInfo[playerid][Respect] = 1;
						}
						SetPlayerScore(playerid, PlayerInfo[playerid][Nivel]);
						new string[250];
                        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						format(string, sizeof(string), "~w~Level UP %d!~n~~r~-%d$", PlayerInfo[playerid][Nivel], costlevel);
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						GameTextForPlayer(playerid, string, 5000, 1);
						SetTimerEx("PlayerPlayMusic", 5000, false, "i", playerid);
					}
				}
				return 1;
			}
		}
		return 1;
	}
Reply


Messages In This Thread
How to calculate respect points at /buylevel? - by Metharon - 15.10.2014, 12:11

Forum Jump:


Users browsing this thread: 1 Guest(s)