07.09.2013, 13:50
Hi, I have this bug in my script, it's about /ad command. In that command I added flood protection Ad lenght.
When I type in just /ad command in server, it works, But when I type in my Ad. example: /ad Infernus on sale .
Than it says that this command does not exist, and also when I type too less word, he reminds me that I have enterd too less words, but when it's complete it doesn't work.
Pictures of command existence:
This one is for level warning
This one is for sentence lenght warning
And finally the bugged one.
And this is the code:
When I type in just /ad command in server, it works, But when I type in my Ad. example: /ad Infernus on sale .
Than it says that this command does not exist, and also when I type too less word, he reminds me that I have enterd too less words, but when it's complete it doesn't work.
Pictures of command existence:
This one is for level warning
This one is for sentence lenght warning
And finally the bugged one.
And this is the code:
Код:
CMD:ad(playerid, params[]) { if(KiwiBot[0][kb_Oglasi] == 0) return SCM(playerid, CRVENA, "| AntiBoT |: Ads are temporaly disabled!"); if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1806.7473,-1293.5951,13.5762)) { SCM(playerid, GRAD2, "(error) You are not on place for advertising! Location is indicated on your map."); h_SetPlayerCheckpoint(playerid, 1806.7473,-1293.5951,13.5762, 5.0); PosaoGPS[playerid] = 1; return 1; } if(PI[playerid][Utisan] != 0) return SCM(playerid, CRVENA, "AntiBoT | {FFFFFF}You are muted, you cant use chat!"); if(PI[playerid][Telefon] == -1) return SCM(playerid, GRAD2, "(error) To make an Ad you must have a cell phone and a SIM card for it!"); if(PI[playerid][Nivo] < 3) return SCM(playerid, GRAD2, "(error) Your level needs to be 3 or higher to make an Ad!"); if(PI[playerid][Novac] < 35) return SCM(playerid, GRAD2, "Ad costs $35!"); //if(gettime() < OglasVreme) return SCMF(playerid, GRAD2, "Izmedju oglasa mora proci 30 sekundi. Pokusajte ponovo za %d sekundi.", OglasVreme); if(gettime() < Oglasvr[playerid]) return SCM(playerid, GRAD2, "(error) To prevent ad flood, you can give ad every 10 minutes. Try again later."); new x, y, oglasaispred, vremecekanja, text[100]; if(sscanf(params, "s[100]", text)) return SCM(playerid, GRAD3, "Usage: {BFC0C2}/ad [Ad text]"); if(strlen(text) < 10 || strlen(text) > 100) return SCM(playerid, GRAD2, "(error) Ad text must contain more than 10 letters, and less then 100 letters!"); new ime[MAX_PLAYER_NAME]; ImeIgraca(playerid, ime); if(strfind(text, "~", true) != -1) { SCM(playerid, GRAD2, "(error) You cant use \"~\" in ad!"); format(CmdString, 128, "Player: %s | Type: Cell phone | Text: %s", ime, text); UpisiLog(FAJL_CRTICALOG, CmdString); return 1; } for(new i; i < sizeof(Oglasi); i++) { if(strcmp(Oglasi[i][oText], "Empty", true)) { x = i; break; } } for(new i = x; i <= sizeof(Oglasi)+1; i++) { if(i == sizeof(Oglasi)+1) { SCM(playerid, GRAD2, "(error) No more space for ads!"); break; } if(!strcmp(Oglasi[i][oText], "Empty", true)) { y = i; strmid(Oglasi[i][oText], text, 0, strlen(text), 255); strmid(Oglasi[i][oIme], ime, 0, strlen(ime), 255); Oglasi[i][oTelefon] = PI[playerid][Telefon]; for(new ii; ii < y; ii++) { if(strcmp(Oglasi[ii][oText], "Empty", true)) oglasaispred++; } new xvremecekanja = oglasaispred*60; vremecekanja = xvremecekanja + 30; SCMF(playerid, BELA, "You successfully made an Ad. In front of your ad there is still {48E31C}%d {FFFFFF}ads. Time of waiting: about {48E31C}%d {FFFFFF}secunds.", oglasaispred, vremecekanja); NovacMinus(playerid, 35); Oglasvr[playerid] = gettime() + 600; format(CmdString, 180, "| AD | %s | %s", ime, text); UpisiLog(FAJL_OGLASLOG, CmdString); break; } } return 1; }