if( !strcmp(cmdtext, "/advertise", true, 10) )
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (advert[i] == 0)
{
advert[i] = 1;
new str[256];
new namez[MAX_PLAYER_NAME];
GetPlayerName(playerid,namez,sizeof(namez));
format(str, 256, "[ADVERTISMENT]: %s | Name: %s | ", cmdtext[10], namez);
SendClientMessage(playerid, COLOR_YELLOW, "The cost of your advertisment is 150$");
SendClientMessageToAll(COLOR_GREEN, str);
GivePlayerMoney(playerid, -150);
SetTimer("advoff", 60000, true);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You must wait 1 minute to post your advertise again");
}
}
return 1;
}
|
Originally Posted by tour15
Код:
if( !strcmp(cmdtext, "/advertise", true, 10) )
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (advert[i] == 0)
{
advert[i] = 1;
new str[256];
new namez[MAX_PLAYER_NAME];
GetPlayerName(playerid,namez,sizeof(namez));
format(str, 256, "[ADVERTISMENT]: %s | Name: %s | ", cmdtext[10], namez);
SendClientMessage(playerid, COLOR_YELLOW, "The cost of your advertisment is 150$");
SendClientMessageToAll(COLOR_GREEN, str);
GivePlayerMoney(playerid, -150);
SetTimer("advoff", 60000, true);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You must wait 1 minute to post your advertise again");
}
}
return 1;
}
why this command spams the advertisment in main chat? I think something is going wrong with [i] [i] can someone tell me what could i do to stop it? |
SendClientMessageToAll(COLOR_GREEN, str);
SendClientMessageToAll(COLOR_GREEN, str);
SendClientMessage(i,COLOR_GREEN, str);
[ADVERTISEMENT]: Example | Name: VonLeeuwen | [ADVERTISEMENT]: Example | Name: VonLeeuwen | [ADVERTISEMENT]: Example | Name: VonLeeuwen | [ADVERTISEMENT]: Example | Name: VonLeeuwen | [ADVERTISEMENT]: Example | Name: VonLeeuwen |
if( !strcmp(cmdtext, "/advertise", true, 10) )
{
if (!advert[playerid])return SendClientMessage(playerid, COLOR_GREY, "You must wait 1 minute to post your advertise again");
advert[playerid] = 1;
new str[128],namez[MAX_PLAYER_NAME];
GetPlayerName(playerid,namez,sizeof(namez));
format(str, sizeof str, "[ADVERTISMENT]: %s | Name: %s | ", cmdtext[12], namez);
SendClientMessage(playerid, COLOR_YELLOW, "The cost of your advertisment is 150$");
SendClientMessageToAll(COLOR_GREEN, str);
GivePlayerMoney(playerid, -150);
SetTimer("advoff", 60000, true);
return 1;
}