SA-MP Forums Archive
Problema, "/duda" - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Problema, "/duda" (/showthread.php?tid=149508)



Problema, "/duda" - Rolespain - 22.05.2010

Quisiera poner el canal /Duda solamente que lo lean los admines en servicio.

Haber si me explico. yo mando una duda, y si no hay en servicio no les sale, ahora si hay, ya le sale al que estб en servicio.

ahora mismo lo tengo para que le salga en modo servicio o no en servicio y quisiera ponerlo en servicio.

Quote:

if(strcmp(cmd, "/duda", true) == 0)
{
if(IsPlayerConnected(playerid))
{
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, "Use: /duda [Pregunta]");
return 1;
}
format(string, sizeof(string), "Pregunta (ID:%d) %s: %s", playerid, sendername, (result));
ABroadCast(COLOR_ASKQ,string,1);
SendClientMessage(playerid, COLOR_ASKQ, "Su pregunta a sido enviada a los administradores.");
}
return 1;
}




Re: Problema, "/duda" - Cesar_Biker - 22.05.2010

Quote:
Originally Posted by Rolespain
Quisiera poner el canal /Duda solamente que lo lean los admines en servicio.

Haber si me explico. yo mando una duda, y si no hay en servicio no les sale, ahora si hay, ya le sale al que estб en servicio.

ahora mismo lo tengo para que le salga en modo servicio o no en servicio y quisiera ponerlo en servicio.

Quote:

if(strcmp(cmd, "/duda", true) == 0)
{
if(IsPlayerConnected(playerid))
{
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, "Use: /duda [Pregunta]");
return 1;
}
format(string, sizeof(string), "Pregunta (ID:%d) %s: %s", playerid, sendername, (result));
ABroadCast(COLOR_ASKQ,string,1);
SendClientMessage(playerid, COLOR_ASKQ, "Su pregunta a sido enviada a los administradores.");
}
return 1;
}

Tiendes que modificar la funciуn "ABroadCast"
pawn Код:
public ABroadCast(color,const string[],level)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if (PlayerInfo[i][pAdmin] >= level)
            {
                if(if(AdminDuty[playerid] == 1)
                {
                    SendClientMessage(i, color, string);
                    printf("%s", string);
                }
                else
                {
                    return 1;
                }
            }
        }
    }
    return 1;
}
Ten en cuenta que esto tambiйn modificara el comando /reportar y los demбs comandos que usen esta funciуn"ABroadCast".


Re: Problema, "/duda" - Rolespain - 22.05.2010

Код:
public ABroadCast(color,const string[],level)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		 if (PlayerInfo[i][pAdmin] >= level)
 			{
  			if(AdminDuty[playerid] == 0)
			{
				SendClientMessage(i, color, string);
				printf("%s", string);
			}
		}
 		}
	}
	return 1;
}
Код:
(17150) : error 017: undefined symbol "playerid"
Me dice esto. (Para mi en servicio es 0 y sin servicio es 1) por eso lo corregн


Re: Problema, "/duda" - Cesar_Biker - 22.05.2010

Cambia "AdminDuty[playerid]" por "AdminDuty[i]" y deberнa compilar bien.
No sale la i
es asн
Код:
AdminDuty[i]
no se porque no sale la [i]



Re: Problema, "/duda" - Rolespain - 22.05.2010

error 033: array must be indexed (variable "AdminDuty")