Family HQ Problem
#1

So I've come to make a new option for the command /famedit. Now whenever I try to confirm my HQ location, it tells me invalid option. What's wrong in this function?

Код:
else if(!strcmp(option, "HQ", true, 4))
    {
        new confirm[8];
    	if(PlayerInfo[playerid][pFamRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(FamInfo[idx][fHqX] != 0 && FamInfo[idx][fHqY] != 0 && FamInfo[idx][fHqZ] != 0)
		{
		    // SSCANF Check
		    if(sscanf(params, "s[32]s[8]", option, confirm))
		    {
		    	SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /famedit HQ [confirm]");
		    	SendClientMessage(playerid, COLOR_LIGHTRED, " Changing your family's Headquarters location will cost $100,000.");
		    	return 1;
		    }
		    // Confirm Check
		    if(strcmp(confirm, "confirm", true, 8))
		    {
		    	SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /famedit HQ [confirm]");
		    	SendClientMessage(playerid, COLOR_LIGHTRED, " Changing your family's Headquarters location will cost $100,000.");
		    	return 1;
		    }
		    // Money Check
		    if(PlayerInfo[playerid][pMoney] < 100000) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you. ($100,000)");
		    GiveDodMoney(playerid, -100000);
		}
		GetPlayerPos(playerid,FamInfo[idx][fHqX], FamInfo[idx][fHqY], FamInfo[idx][fHqZ]);
        DestroyDynamicPickup(FamInfo[idx][fPickup]);
	    FamInfo[idx][fPickup] = CreateDynamicPickup(1239, 1, FamInfo[idx][fHqX], FamInfo[idx][fHqY], FamInfo[idx][fHqZ], -1);
		DestroyDynamic3DTextLabel(FamInfo[idx][fText]);
		format(string, sizeof(string), "%s's Headquarters", FamInfo[idx][fName]);
    	FamInfo[idx][fText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, FamInfo[idx][fHqX], FamInfo[idx][fHqY], FamInfo[idx][fHqZ]+0.3, 15);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have set your family's HQ location.");
    }
Reply
#2

Use [ pawn] tags next time,
pawn Код:
if(!strcmp(confirm, "confirm", true, 8))
Returns 0 if they are the same
Reply
#3

I'm confused.. What's the issue? It's still not working properly.
Reply
#4

Then
pawn Код:
if(strcmp(confirm, "confirm", true, 7)==0)
Reply
#5

The problem still persists.
Reply
#6

Anybody know the issue? Here's the code again.

pawn Код:
else if(!strcmp(option, "HQ", true, 4))
    {
        new confirm[7];
        if(PlayerInfo[playerid][pFamRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(FamInfo[idx][fHqX] != 0 && FamInfo[idx][fHqY] != 0 && FamInfo[idx][fHqZ] != 0)
        {
            // SSCANF Check
            if(sscanf(params, "s[32]s[7]", option, confirm))
            {
                SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /famedit HQ [confirm]");
                SendClientMessage(playerid, COLOR_LIGHTRED, " Changing your family's Headquarters location will cost $100,000.");
                return 1;
            }
            // Confirm Check
            if(strcmp(confirm, "confirm", true, 7)==0)
            {
                SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /famedit HQ [confirm]");
                SendClientMessage(playerid, COLOR_LIGHTRED, " Changing your family's Headquarters location will cost $100,000.");
                return 1;
            }
            // Money Check
            if(PlayerInfo[playerid][pMoney] < 100000) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you. ($100,000)");
            GiveDodMoney(playerid, -100000);
        }
        GetPlayerPos(playerid,FamInfo[idx][fHqX], FamInfo[idx][fHqY], FamInfo[idx][fHqZ]);
        DestroyDynamicPickup(FamInfo[idx][fPickup]);
        FamInfo[idx][fPickup] = CreateDynamicPickup(1239, 1, FamInfo[idx][fHqX], FamInfo[idx][fHqY], FamInfo[idx][fHqZ], -1);
        DestroyDynamic3DTextLabel(FamInfo[idx][fText]);
        format(string, sizeof(string), "%s's Headquarters", FamInfo[idx][fName]);
        FamInfo[idx][fText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, FamInfo[idx][fHqX], FamInfo[idx][fHqY], FamInfo[idx][fHqZ]+0.3, 15);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have set your family's HQ location.");
    }
Error: It sends me the words "Invalid Option" and dosen't place the Pickup.
Reply
#7

I feel this is a small issue... can somebody help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)