SeleS Posted March 1, 2012 Report Share Posted March 1, 2012 Cum pot modifica limita de caractere, dau ad si maxim este 22 caractere, daca scriu un text mai mare de 22 caractere nu apare /ad-ul.[pawn]if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pLevel] < 3) { SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa ai level 3 ca sa poti folosi comanda /ad !"); return 1; } if(!PlayerToPoint(3.0,playerid,844.7697,-1045.6333,25.0159)) { SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa fi la CNN Studio sa poti da /ad !"); return 1; } if(PlayerInfo[playerid][pMuted] == 1) { SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced"); return 1; } if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet !"); 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_GREY, "USAGE: (/ad)vertise [advert text]"); return 1; } if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1)) { format(string, sizeof(string), "Please try again later %d seconds between Advertisements !", (addtimer/1000)); SendClientMessage(playerid, COLOR_GRAD2, string); return 1; } new payout = idx * 25; if(GetPlayerMoney(playerid) < payout) { format(string, sizeof(string), "* You used %d characters which cost %d$, you don't have enough.", offset, payout); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); return 1; } GivePlayerMoney(playerid, - payout); SBizzInfo[7][sbTill] += payout; ExtortionSBiz(7, payout); format(string, sizeof(string), "{00D900}Advertisement: {FFFFFF}%s{00D900}, {00D900}Contact: {FFFFFF}%s {00D900}Tel: {FFFFFF}%d {00D900}ID: {FFFFFF}%d{00D900}.", result, sendername,PlayerInfo[playerid][pPnumber],playerid); OOCNews(TEAM_GROVE_COLOR,string); format(string, sizeof(string), "~r~Paid %d$~n~~w~Message contained: %d Characters", payout, idx); GameTextForPlayer(playerid, string, 5000, 5); if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;} } return 1; }[/pawn] Link to comment Share on other sites More sharing options...
SeleS Posted March 2, 2012 Author Report Share Posted March 2, 2012 up, nimeni? Link to comment Share on other sites More sharing options...
xxSPEEDYxx Posted March 2, 2012 Report Share Posted March 2, 2012 foloseste sscanf. Fara reclama in semnatura! Link to comment Share on other sites More sharing options...
Question
SeleS
Cum pot modifica limita de caractere, dau ad si maxim este 22 caractere, daca scriu un text mai mare de 22 caractere nu apare /ad-ul.
[pawn]if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa ai level 3 ca sa poti folosi comanda /ad !");
return 1;
}
if(!PlayerToPoint(3.0,playerid,844.7697,-1045.6333,25.0159))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa fi la CNN Studio sa poti da /ad !");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet !");
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_GREY, "USAGE: (/ad)vertise [advert text]");
return 1;
}
if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
{
format(string, sizeof(string), "Please try again later %d seconds between Advertisements !", (addtimer/1000));
SendClientMessage(playerid, COLOR_GRAD2, string);
return 1;
}
new payout = idx * 25;
if(GetPlayerMoney(playerid) < payout)
{
format(string, sizeof(string), "* You used %d characters which cost %d$, you don't have enough.", offset, payout);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
GivePlayerMoney(playerid, - payout);
SBizzInfo[7][sbTill] += payout;
ExtortionSBiz(7, payout);
format(string, sizeof(string), "{00D900}Advertisement: {FFFFFF}%s{00D900}, {00D900}Contact: {FFFFFF}%s {00D900}Tel: {FFFFFF}%d {00D900}ID: {FFFFFF}%d{00D900}.", result, sendername,PlayerInfo[playerid][pPnumber],playerid);
OOCNews(TEAM_GROVE_COLOR,string);
format(string, sizeof(string), "~r~Paid %d$~n~~w~Message contained: %d Characters", payout, idx);
GameTextForPlayer(playerid, string, 5000, 5);
if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}
}
return 1;
}[/pawn]
Link to comment
Share on other sites
2 answers to this question
Recommended Posts