SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/08/2012, 06:51 PM   #1
Akcent_Voltaj
Guest
 
Posts: n/a
Default Pleese look !

i need help this spams the chat!

PHP Code:
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 Code:
" Toate masinile au fost respawnate !  
This is the problem

Last edited by Akcent_Voltaj; 11/08/2012 at 08:14 PM.
  Reply With Quote
Old 11/08/2012, 07:01 PM   #2
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,252
Reputation: 504
Default Re: Pleese look !

pawn Code:
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.
Kindred is offline   Reply With Quote
Old 11/08/2012, 07:09 PM   #3
Roko_foko
Gangsta
 
Join Date: Jul 2009
Location: Croatia, Split
Posts: 541
Reputation: 44
Default Re: Pleese look !

Quote:
Originally Posted by Kindred View Post
pawn Code:
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
Roko_foko is offline   Reply With Quote
Old 11/08/2012, 07:11 PM   #4
Akcent_Voltaj
Guest
 
Posts: n/a
Default Re: Pleese look !

PHP Code:
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);
                    }
                    }
                    } 
  Reply With Quote
Old 11/08/2012, 07:12 PM   #5
Roko_foko
Gangsta
 
Join Date: Jul 2009
Location: Croatia, Split
Posts: 541
Reputation: 44
Default Re: Pleese look !

pawn Code:
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 Code:
for(new i=0; i<MAX_PLAYERS; i++)
{
    SendClientMessage( i, YELLOW, " In 20 secunde toate masinile se vor respawna ! ");
}
SetTimer("ScheduledRespawn",20000,false);
Roko_foko is offline   Reply With Quote
Old 11/08/2012, 08:14 PM   #6
Akcent_Voltaj
Guest
 
Posts: n/a
Default Re: Pleese look !

Quote:
Originally Posted by Akcent_Voltaj View Post
i need help this spams the chat!

PHP Code:
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 Code:
" Toate masinile au fost respawnate !  
This is the problem
This Spams!
  Reply With Quote
Old 11/08/2012, 08:28 PM   #7
Youarex
Big Clucker
 
Youarex's Avatar
 
Join Date: Jun 2012
Posts: 166
Reputation: 184
Default Re: Pleese look !

Why is there nested loop? This:

pawn Code:
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; }
    }
Youarex is offline   Reply With Quote
Old 11/08/2012, 08:32 PM   #8
Roko_foko
Gangsta
 
Join Date: Jul 2009
Location: Croatia, Split
Posts: 541
Reputation: 44
Default Re: Pleese look !

Quote:
Originally Posted by Akcent_Voltaj View Post
This Spams!
Why don't you read my post?
Roko_foko is offline   Reply With Quote
Old 11/08/2012, 09:33 PM   #9
Akcent_Voltaj
Guest
 
Posts: n/a
Default Re: Pleese look !

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 Code:
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);
                    } 
  Reply With Quote
Old 11/08/2012, 11:20 PM   #10
Akcent_Voltaj
Guest
 
Posts: n/a
Default Re: Pleese look !

anyone help?
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crashed, pleese help. Noobus Client Support 1 06/11/2011 06:37 AM


All times are GMT. The time now is 10:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.