Getting Spammed by this.
#1

When ever i type this message i get spammed by this :
Код:
You are not standing on any land you own!
PHP код:
 if(listitem == 1)
            {
            for(new 
xMAX_LANDSx++)
            {
             if(
IsPlayerInGangZone(playeridLandInfo[x][landZone]))
                {
                    
ShowPlayerDialogEx(playeridLANDS1DIALOG_STYLE_LIST"Lands - Building""Essentials\nDecoration\nFurniture""Select""Cancel");
                }
                else 
SendClientMessage(playeridCOLOR_GREY"You are not standing on any land you own!");
            }
            } 
any help?
Reply
#2

It's because each "x" it's checking, it's making the report.

You need to make it report that you're not standing in the zone after it's found you not standing in _any_ zone, not each as it is currently.


After the for loop that is, but that will require more code changes.
Reply
#3

sorry but i don't get you can you just tell me what i need to do to stop this and whats causing this? The thing you said before just passed over my head.
Reply
#4

It's because the message is in the for loop... That's why it spams you.

You need to put it elsewhere, but by doing so, you'll need to rewrite a bit more code.
Reply
#5

But now its in OnDialogResponse and if i place it any other place how will it work?
Reply
#6

pawn Код:
if(listitem == 1)
{
    new bool:InZone;
    for(new x; x < MAX_LANDS; x++)
        if(IsPlayerInGangZone(playerid, LandInfo[x][landZone]))
        {
            InZone = true;
            ShowPlayerDialogEx(playerid, LANDS1, DIALOG_STYLE_LIST, "Lands - Building", "Essentials\nDecoration\nFurniture", "Select", "Cancel");
            break;
        }

    if(!InZone)
        SendClientMessage(playerid, COLOR_GREY, "You are not standing on any land you own!");
}
Reply
#7

PHP код:
new bool:found false;
for(new 
xMAX_LANDSx++)
{
    if(
IsPlayerInGangZone(playeridLandInfo[x][landZone]))
    {
        
ShowPlayerDialogEx(playeridLANDS1DIALOG_STYLE_LIST"Lands - Building""Essentials\nDecoration\nFurniture""Select""Cancel");
        
found true;
        break;
    }

if(!
found)
{
    
SendClientMessage(playeridCOLOR_GREY"You are not standing on any land you own!");

Same thing with people that put a return there instead of that else ... You can't possibly know if a player isn't in any zone before you have checked all of them.

Edit: ^ slightly faster.
Reply
#8

Thanks guys!!!! it worked @Jefff i tried your code and it worked also @Vince as Jefff's code worked so i didn't tried your one but i am 100% sure your one will also work! thanks again.
Reply
#9

also guys i have one more question i want to check that if a player is standing in a land zone that he owns or in someone's else land zone how can i check that? i will provide code that you will need.
Reply
#10

Quote:
Originally Posted by Alpha000
Посмотреть сообщение
also guys i have one more question i want to check that if a player is standing in a land zone that he owns or in someone's else land zone how can i check that? i will provide code that you will need.
In the initial listitem check you had posted, in the middle. Literally.

Where it's going through the zones, and confirms you are, you'll need a check in there to see if the player owns it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)