make spamming?
#1

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));
}
Reply
#2

"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.
Reply
#3

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 -_-
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)