SA-MP Forums Archive
make spamming? - 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: make spamming? (/showthread.php?tid=636633)



make spamming? - kloning1 - 01.07.2017

I tried to use "while"
But what I get is a spam ( over than 1000 ) message to the client
What I want to ask, what is "while" and how to use it, I've seen on the wiki sa-mp and I'm still confused

There is my code
pawn Код:
while(TeamACount> = 0) // have 3 team, team B, and C. but i select only team A
{
    new i = Iter_Random(Player);
    if(PlayerTeam[z] == Team_B || PlayerTeam[z] == Team_C) continue;
    SetHealth(z, 500); // i just need one player to make high health and weapon
    GivePlayerWeapon(z, x, x);
    SendTeamMessage(Team_A, "One of your team has been selected to be a god");
    printf("%s selected team A to be a god", GetName(z));
}



Re: make spamming? - Vince - 01.07.2017

"TeamACount" never actually changes value within the loop body and as such the loop runs forever. A while-loop runs until the expression evaluates to false. What you want to use here is likely just a simple if-statement because I see no reason to use a loop at all.


Re: make spamming? - SyS - 01.07.2017

while(TeamACount> = 0) means execute the part of code inside its block till teamAcount is greater than or equal to zero.This process will only get stops when TeamACount is less than zero.And you have no statement mentioning its update. Fix the logic there.

Edit: This forum needs something to mention about newer posts while typing , seriously -_-


Re: make spamming? - kloning1 - 01.07.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
"TeamACount" never actually changes value within the loop body and as such the loop runs forever. A while-loop runs until the expression evaluates to false. What you want to use here is likely just a simple if-statement because I see no reason to use a loop at all.
TeamACount -> It's actually a callback, but I just shorten it.

Quote:
Originally Posted by SyS
Посмотреть сообщение
while(TeamACount> = 0) means execute the part of code inside its block till teamAcount is greater than or equal to zero.This process will only get stops when TeamACount is less than zero.And you have no statement mentioning its update. Fix the logic there.

Edit: This forum needs something to mention about newer posts while typing , seriously -_-
It seems like I also feel like that. Well i will justify it. ty
So, "while" will stop below zero?

Hehehe