Im so confused with this thing.
#1

I tried to create a Family token shop,

Код:
CMD:ftokenshop(playerid, params[])
{
    if(PlayerInfo[playerid][pGang] >= 1)
    {
		if(IsPlayerInRangeOfPoint(playerid, 2.0 ,-2235.1304, 130.1577, 1035.4141))
		{
		    ShowPlayerDialogEx(playerid, DIALOG_FAM_TOKEN, DIALOG_STYLE_LIST, "Philippines-Roleplay Family Token Shop", "Sawn-off shotgun(3 Token)\n Uzi(2 Token)\nSpas(4 Token)\n200 Armor(8 Token)\nRPG(Special 200 Token", "Select", "Cancel");
		} else return SendClientMessage(playerid, COLOR_WHITE, "Your not range in Family Token Shop!");
		
    } else return SendClientMessage(playerid, COLOR_REALRED, "Your not in any gang!!");
    return 1;
}
in dialog response, I want it to Check if your Family have a 3 token to buy Sawn-Off. and If you buy it your Family Token will be lost 3 token, How?

Код:
if(dialogid == DIALOG_FAM_TOKEN)
	{
	    if(response)
	    {
			if(listitem == 0)
			{
   				if(FamilyInfo[playerid][FamilyTurfTokens] >= 3)
   				{
                	GivePlayerValidWeapon(playerid, 26, 999999999);
                	FamilyInfo[playerid][FamilyTurfTokens] -= 3;
				}
			}
	    }
		return 1;
	}
Here are some enums
Код:
enum fInfo
{
	FamilyTaken,
	FamilyName[42],
	FamilyMOTD[65],
	FamilyColor,
	FamilyTurfTokens,
	FamilyLeader[MAX_PLAYER_NAME],
	FamilyMembers,
	Float:FamilySpawn[4],
	FamilyInterior,
	FamilyCash,
	FamilyBank,
	FamilyMats,
	FamilyPot,
	FamilyCrack,
	Float:FamilySafe[3],
	FamilyUSafe,
	FamilyRank1[20],
	FamilyRank2[20],
	FamilyRank3[20],
	FamilyRank4[20],
	FamilyRank5[20],
	FamilyRank6[20],
	FamilyPickup,
	FamilyMaxSkins,
	FamilySkins[8],
	Float: FamilyEntrance[4],
	Float: FamilyExit[4],
	FamilyEntrancePickup,
	FamilyExitPickup,
	Text3D:FamilyEntranceText,
	Text3D:FamilyExitText,
	FamilyCustomMap,
	FamilyVirtualWorld,
	FamilyResetSpawns,
	FamilyGuns[10],
};
ETC: So you can help me and get information about my variables
Код:
forward CaptureTimerEx(point);
public CaptureTimerEx(point)
{
	new string[128];
	new fam;
	if(Points[point][TakeOverTimerStarted])
	{
		fam = Points[point][ClaimerTeam];
		if(Points[point][TakeOverTimer] > 0)
		{
			Points[point][TakeOverTimer]--;
			//format(string, sizeof(string), "%s has successfully attempted to take over of %s for %s, it will be theirs in %d minutes!",
			//Points[point][PlayerNameCapping], Points[point][Name], FamilyInfo[fam][FamilyName], Points[point][TakeOverTimer]);
			//UpdateDynamic3DTextLabelText(Points[point][CaptureProccess], COLOR_YELLOW, string);
		}
		else
		{
			Points[point][ClaimerTeam] = INVALID_PLAYER_ID;
			Points[point][TakeOverTimer] = 0;
			Points[point][TakeOverTimerStarted] = 0;
			Points[point][Announced] = 0;
			Points[point][Vulnerable] = NEW_VULNERABLE;
			//DestroyDynamic3DTextLabel(Points[point][CaptureProccess]);
			Points[point][CaptureProccessEx] = 0;
			strmid(Points[point][Owner], FamilyInfo[fam][FamilyName], 0, 32, 32);
			strmid(Points[point][CapperName], Points[point][PlayerNameCapping], 0, 32, 32);
			format(string, sizeof(string), "%s has taken control the %s for %s.", Points[point][CapperName], Points[point][Name], Points[point][Owner]);
			SendClientMessageToAllEx(COLOR_YELLOW, string);
			UpdatePoints();
			KillTimer(Points[point][CaptureTimerEx2]);
			Points[point][CaptureTimerEx2] = -1;
		 	FamilyInfo[fam][FamilyTurfTokens] += 1;
		 	new pstring[128];
		 	format(pstring, sizeof(pstring), "%s has captured the %s! %s has earn 1 Family Token! Congrats!",Points[point][CapperName],Points[point][Name], Points[point][Owner]);
			SendClientMessageToAll(COLOR_YELLOW, pstring);
		}
	}
}
Код:
CMD:families(playerid, params[])
{
	new string[128], familyid;

	if(sscanf(params, "d", familyid))
	{
		new number = 0;
		for(new i = 0; i < sizeof(FamilyInfo); i++)
		{
			number ++;
			format(string, sizeof(string), "Family %d | Name: %s | Leader: %s | Members: %d || FToken: %d",number,FamilyInfo[i][FamilyName],FamilyInfo[i][FamilyLeader],FamilyInfo[i][FamilyMembers], FamilyInfo[i][FamilyTurfTokens]);
			SendClientMessage(playerid, COLOR_WHITE, string);
		}
		return 1;
	}

	if(familyid < 1 || familyid > MAX_FAMILY) { SendClientMessage(playerid, COLOR_GREY, "Family slot must be between 1 and 14."); return 1; }
	familyid -= 1;
	if(FamilyInfo[familyid][FamilyTaken] != 1)
	{
		SendClientMessage(playerid, COLOR_GREY, "That family slot is empty.");
		return 1;
	}
	foreach(Player, i)
	{
		if(PlayerInfo[i][pGang] == familyid && (AdminDuty[i] != 1))
		{
			if(PlayerInfo[i][pRank] == 1)
			{
				format(string, sizeof(string), "* %s: %s | Rank: %s (1).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank1]);
			}
			else if(PlayerInfo[i][pRank] == 2)
			{
				format(string, sizeof(string), "* %s: %s | Rank: %s (2).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank2]);
			}
			else if(PlayerInfo[i][pRank] == 3)
			{
				format(string, sizeof(string), "* %s: %s | Rank: %s (3).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank3]);
			}
			else if(PlayerInfo[i][pRank] == 4)
			{
				format(string, sizeof(string), "* %s: %s | Rank: %s (4).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank4]);
			}
			else if(PlayerInfo[i][pRank] == 5)
			{
				format(string, sizeof(string), "* %s: %s | Rank: %s (5).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank5]);
			}
			else if(PlayerInfo[i][pRank] == 6)
			{
				format(string, sizeof(string), "* %s: %s | Rank: %s (6).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank6]);
			}
			else
			{
				format(string, sizeof(string), "* %s: %s | Rank: %s.",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank1]);
			}
			SendClientMessage(playerid, COLOR_GREY, string);
		}
	}
	return 1;
}
Thanks for reading, I hope this problem will solve with your helps <3
Reply
#2

pawn Код:
if(FamilyInfo[playerid][FamilyTurfTokens] < amount)
    return SendClientMessage(playerid, -1, "Incorrect amount of tokens");
Edit hte 'amount' and put them under OnDialogResponse if they have no tokens it'll give them an error message

Example;
pawn Код:
if(dialogid == DIALOG_FAM_TOKEN)
{
    if(response)
    {
        if(listitem == 0)
        {
            if(FamilyInfo[playerid][FamilyTurfTokens] < 3)
                return SendClientMessage(playerid, -1, "Incorrect amount of tokens");

            GivePlayerValidWeapon(playerid, 26, 999999999);
            FamilyInfo[playerid][FamilyTurfTokens] -= 3;
        }
    }
    return 1;
}
Reply
#3

But it wont read if player have 3 tokens, and if player is on gang

and also token doesnt lost, it should be lost 3 token when they buy the sawn-off

pawn Код:
if(dialogid == DIALOG_FAM_TOKEN)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(FamilyInfo[playerid][FamilyTurfTokens] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "Your family cannot afford that 3 token!");
                else
                {
                    GivePlayerValidWeapon(playerid, 26, 999999999);
                    FamilyInfo[playerid][FamilyTurfTokens] -= 3;
                }
            }
        }
        return 1;
    }
Reply
#4

You don't need the 'else' in there at all, that will trigger if the user has less than the required amount of tokens
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)