SA-MP Forums Archive
Getting Spammed by this. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Getting Spammed by this. (/showthread.php?tid=594672)



Getting Spammed by this. - Alpha000 - 21.11.2015

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?


Re: Getting Spammed by this. - Sew_Sumi - 21.11.2015

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.


Re: Getting Spammed by this. - Alpha000 - 21.11.2015

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.


Re: Getting Spammed by this. - Sew_Sumi - 21.11.2015

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.


Re: Getting Spammed by this. - Alpha000 - 21.11.2015

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


Re: Getting Spammed by this. - Jefff - 21.11.2015

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!");
}



Re: Getting Spammed by this. - Vince - 21.11.2015

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.


Re: Getting Spammed by this. - Alpha000 - 21.11.2015

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.


Re: Getting Spammed by this. - Alpha000 - 21.11.2015

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.


Re: Getting Spammed by this. - Sew_Sumi - 22.11.2015

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.