SA-MP Forums Archive
Pleese look ! - 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: Pleese look ! (/showthread.php?tid=367962)



Pleese look ! - Akcent_Voltaj - 11.08.2012

i need help this spams the chat!

PHP код:
public ScheduledRespawn(){
                    new 
bool:unwanted[CAR_AMOUNT];
                    for(new 
i=0i<MAX_PLAYERSi++)
                    {
                    
SendClientMessage(i,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
                    for(new 
player=0player<MAX_PLAYERSplayer++)
                    {
                    if(
IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
                    }
                    for(new 
car 1car <= 400car++)
                    {
                    if(!
unwanted[car]) SetVehicleToRespawn(car);
                    }
                    }
                    } 
PHP код:
"• Toate masinile au fost respawnate ! • 
This is the problem


Re: Pleese look ! - Kindred - 11.08.2012

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
                    {
                    SendClientMessage(i,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
OBVIOUSLY, it's because you have it INSIDE the loop, therefore it will right the message in the chat x amount of times (x being MAX_PLAYERS).

Place it outside the loop.


Re: Pleese look ! - Roko_foko - 11.08.2012

Quote:
Originally Posted by Kindred
Посмотреть сообщение
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
                    {
                    SendClientMessage(i,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
OBVIOUSLY, it's because you have it INSIDE the loop, therefore it will right the message in the chat x amount of times (x being MAX_PLAYERS).

Place it outside the loop.
This will send message to every player once ONLY.

On Topic: show us where you call ScheduledRespawn(). With some timer or?
To find where are you using it press CTRL+F


Re: Pleese look ! - Akcent_Voltaj - 11.08.2012

PHP код:
public SyncTime()
                    {
                    new 
string[64];
                    new 
tmphour;
                    new 
tmpminute;
                    new 
tmpsecond;
                    
gettime(tmphourtmpminutetmpsecond);
                    if ((
tmphour ghour) || (tmphour == && ghour == 23))
                    {
                    
format(stringsizeof(string), "Este ora Fix Ceasul acuma este: %d:00 Succes incontinuare!",tmphour);
                    
BroadCast(COLOR_WHITE,string);
                    
ghour tmphour;
                    
PayDay();
                    if (
realtime)
                    {
                    
SetWorldTime(tmphour);
                    }
                    for(new 
i=0i<MAX_PLAYERSi++)
                    {
                    
SendClientMessageiYELLOW"• In 20 secunde toate masinile se vor respawna ! •");
                    
SetTimer("ScheduledRespawn",20000,false);
                    }
                    }
                    } 



Re: Pleese look ! - Roko_foko - 11.08.2012

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
                    {
                    SendClientMessage( i, YELLOW, "• In 20 secunde toate masinile se vor respawna ! •");
                    SetTimer("ScheduledRespawn",20000,false);
                    }
(Taken from last post.)

change to
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
    SendClientMessage( i, YELLOW, "• In 20 secunde toate masinile se vor respawna ! •");
}
SetTimer("ScheduledRespawn",20000,false);



Re: Pleese look ! - Akcent_Voltaj - 11.08.2012

Quote:
Originally Posted by Akcent_Voltaj
Посмотреть сообщение
i need help this spams the chat!

PHP код:
public ScheduledRespawn(){
                    new 
bool:unwanted[CAR_AMOUNT];
                    for(new 
i=0i<MAX_PLAYERSi++)
                    {
                    
SendClientMessage(i,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
                    for(new 
player=0player<MAX_PLAYERSplayer++)
                    {
                    if(
IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
                    }
                    for(new 
car 1car <= 400car++)
                    {
                    if(!
unwanted[car]) SetVehicleToRespawn(car);
                    }
                    }
                    } 
PHP код:
"• Toate masinile au fost respawnate ! • 
This is the problem
This Spams!


Re: Pleese look ! - Youarex - 11.08.2012

Why is there nested loop? This:

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
    SendClientMessage(i,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
    for(new player=0; player<MAX_PLAYERS; player++)
    {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
    }



Re: Pleese look ! - Roko_foko - 11.08.2012

Quote:
Originally Posted by Akcent_Voltaj
Посмотреть сообщение
This Spams!
Why don't you read my post?


Re: Pleese look ! - Akcent_Voltaj - 11.08.2012

fixed. i made an onplayerregister mail

Type in your mail but i want to make it so it has to have "@" ...cause i typed dd and worked thats not good i want to type full adress or with .com.. .ca..

PHP код:
if(dialogid == 53)
                    {
                    if(
response)
                    {
                    
ShowPlayerDialog(playerid,53,DIALOG_STYLE_INPUT,"Scrieti Adresa Ta Yahoo!"," ","Ok","");
                    return 
0;
                    }
                    
RegistrationStep[playerid] = 0;
                    
TutTime[playerid] = 1;
                    
OnPlayerUpdateEx(playerid);
                    } 



Re: Pleese look ! - Akcent_Voltaj - 14.08.2012

Quote:
Originally Posted by Roko_foko
Посмотреть сообщение
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
                    {
                    SendClientMessage( i, YELLOW, "• In 20 secunde toate masinile se vor respawna ! •");
                    SetTimer("ScheduledRespawn",20000,false);
                    }
(Taken from last post.)

change to
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
    SendClientMessage( i, YELLOW, "• In 20 secunde toate masinile se vor respawna ! •");
}
SetTimer("ScheduledRespawn",20000,false);
this stills spams..... please help i thought i fixed it but no..