SA-MP Forums Archive
[ajuda]/noticias - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [ajuda]/noticias (/showthread.php?tid=163210)



[ajuda]/noticias - tshadow - 26.07.2010

Boas pessoal,
hoje fiz um comando /noticias mas queria que tipo um player /noticias e enquanto a noticia dura, nгo se possa fazer comandos que utilizem o radio do tipo:/noticias /entrevistar.
Tкm aqui o comando /noticias:
pawn Код:
if(strcmp(cmd, "/noticias", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 4)
                {
                    if(NewOnDuty[playerid] == 0)
                    {
                        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;
                        SendClientMessageToAll(COLOR_LIGHTYELLOW2,"[INFO:] Para ouvires as noticias ou comunicados tens de ligar o radio.");
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "______________________[TRV-News]________________________");
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "              ***Jingle da TRV-News***");
                        NewOnDuty[playerid] = 1;
                    }
                    else
                    {
                        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;
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "              ***Jingle da TRV-News***");
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "_________________________________________________________");
                        NewOnDuty[playerid] = 0;
                    }
                }
            }
            return 1;
        }
Alguem sabe como o fazer?


Re: [ajuda]/noticias - tshadow - 27.07.2010

alguйm em me pode ajudar a fazer isto?


Re: [ajuda]/noticias - SlashPT - 27.07.2010

fazes tipo:

no topo do gm

pawn Код:
new podecomando[MAX_PLAYERS];
e depois metes a variavel em 1 e se tiver em 1 nao se pode usar mais o comando tipo assim:
pawn Код:
if(strcmp(cmd, "/noticias", true) == 0)
         {
            if(podecomando[playerid] == 1) return SendClientMessage(playerid,LIGHTGREEN,"Nao pode usar o comando");
            if(IsPlayerConnected(playerid))
            {
                if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 4)
                {
                    if(NewOnDuty[playerid] == 0)
                    {
                        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;
                        SendClientMessageToAll(COLOR_LIGHTYELLOW2,"[INFO:] Para ouvires as noticias ou comunicados tens de ligar o radio.");
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "______________________[TRV-News]________________________");
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "              ***Jingle da TRV-News***");
                        NewOnDuty[playerid] = 1;
                        podecomando[playerid] = 1;
                    }
                    else
                    {
                        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;
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "              ***Jingle da TRV-News***");
                        SendClientMessageToAll(COLOR_LIGHTGREEN, "_________________________________________________________");
                        NewOnDuty[playerid] = 0;
                        podecomando[playerid] = 0;
                    }
                }
            }
            return 1;
        }
mas altera como kiseres...


Re: [ajuda]/noticias - tshadow - 27.07.2010

O problema й que vai ser sу para esse player, mesmo assim vai dar um erro que depois de fazer uma vez ja nгo vai dar vai dar este erro "Nao pode usar o comando" depois de fazer /noticias, a unica maniera й Max_Players menos o que fez o comando.