02.07.2014, 15:46
I want to make an /ad command that allows you to make an advertisement only when you are at the ad center.However it`s not working. I know there is one extra closing bracket.
Here`s the code:
Here`s the code:
Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, "Nu esti logat!"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/ad)vertise [advert text]"); return 1; } if(PermisAnunt[playerid] == 1) { IfIsPlayerInRangeOfPoint(7,-25.1326,-139.0670,1003.5469,0,0,0,0,0,0,0); { new payout = idx * 5; if(GetPlayerMoney(playerid) < payout) { format(string, sizeof(string), "* Acest anunt costa $%d, bani de care nu dispuneti.", payout); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); return 1; } GivePlayerMoney(playerid, - payout); SBizzInfo[7][sbTill] += payout; ExtortionSBiz(7, payout); format(string, sizeof(string), "PUBLICITATE: %s, Contact: %d", result,PlayerInfo[playerid][pPnumber],playerid); OOCNews(TEAM_GROVE_COLOR,string); format(string, sizeof(string), "~r~Ai platit $%d~n~~w~Mesajul contine: %d Caractere", payout, idx); GameTextForPlayer(playerid, string, 5000, 5); PermisAnunt[playerid] = 0; SetTimerEx("Anunt", 60000, 0, "d", playerid); } } else { SendClientMessage(playerid, COLOR_GREY,"Nu esti la centrul de publicitate!"); } } else { SendClientMessage(playerid, COLOR_GREY, "Trebuie sa astepti 1 minut dupa fiecare anunt"); } } return 1; }