public OnPlayerText(playerid, text[])
{
new string[256];
new tmp[256];
if(WritingPaper[playerid] > 0)
{
new line;
new nstring[256];
new idx;
new length = strlen(text);
while ((idx < length) && (text[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = text[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
if(WritingLine[playerid] == 1) { SendClientMessage(playerid, COLOR_WHITE, "***Digita il tuo titolo di giornale***"); }
else { SendClientMessage(playerid, COLOR_WHITE, "* Inserisci una riga di testo del tuo giornale."); }
return 0;
}
format(nstring, sizeof(nstring), "%s", text);
switch(WritingLine[playerid])
{
case 1:
{
new sendername[MAX_PLAYER_NAME];
new fstring[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(fstring, sizeof(fstring), "%s", sendername);
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperMaker], fstring, 0, strlen(fstring), 255);
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperTitle], nstring, 0, strlen(nstring), 255);
line = 0; WritingLine[playerid] = 2;
SendClientMessage(playerid, COLOR_LIGHTRED, "* Hai iniziato il tuo giornale, 7 Linee Rimanenti");
}
case 2:
{
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperText1], nstring, 0, strlen(nstring), 255);
line = 1; WritingLine[playerid] = 3;
}
case 3:
{
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperText2], nstring, 0, strlen(nstring), 255);
line = 2; WritingLine[playerid] = 4;
}
case 4:
{
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperText3], nstring, 0, strlen(nstring), 255);
line = 3; WritingLine[playerid] = 5;
}
case 5:
{
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperText4], nstring, 0, strlen(nstring), 255);
line = 4; WritingLine[playerid] = 6;
}
case 6:
{
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperText5], nstring, 0, strlen(nstring), 255);
line = 5; WritingLine[playerid] = 7;
}
case 7:
{
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperText6], nstring, 0, strlen(nstring), 255);
line = 6; WritingLine[playerid] = 8;
}
case 8:
{
strmid(PaperInfo[WritingPaperNumber[playerid]][PaperText7], nstring, 0, strlen(nstring), 255);
PaperInfo[WritingPaperNumber[playerid]][PaperUsed] = 1;
SavePapers();
line = 7; WritingLine[playerid] = 0; WritingPaper[playerid] = 0; WritingPaperNumber[playerid] = 999;
}
}
if(line > 0)
{
format(string, sizeof(string), "* Hai scritto la linea n° %d nel tuo giornale", line);
SendClientMessage(playerid, COLOR_WHITE, string);
if(line == 7)
{
SendClientMessage(playerid, COLOR_WHITE, "* Il giornale è stato aggiunto alla lista notizie.");
}
}
return 0;
}
@
Ardaenus