08.09.2014, 08:08
Buenas, segъn ando viendo tengo este code
Que es imposible de funcionar, llevo 1 hora intentando incorporarlo a mi GM (para mi canal de dudas "/n") y sinceramente no pude hacerlo funcionar, Quisiera saber si alguien podrнa ayudarme, El codigo de mi comando es:
Espero que me puedan ayudar, ya que me ando volviendo loco.
PD: Si es que pude hacerlo funcionar, en pawno no me salto ningъn problema.. Cambiй el value "text" por "result" pero al entrar y intentar utilizarlo sale: "Unknown command" y no hace la funciуn.. E si no remuevo NADA del codigo no puedo hacerlo funcionar ya que crashea mi Pawno
Код:
public OnPlayerText(playerid, text[])
{
new string[128];
format(string, sizeof(string), "%s", text);
for (new i; i < 128; i++) {
if (string[i] == '@') {
if ((string[i + 1] > 47) && (string[i + 1] < 58)) {
new id = strval(string[i + 1]);
if (id <= 500) {
if (IsPlayerConnected(id)) {
new menohraca[MAX_PLAYER_NAME];
GetPlayerName(id, menohraca, MAX_PLAYER_NAME);
new j = (i + 1);
while ((j < (i + 5)) && ((string[j] > 47) && (string[j] < 58)))
j++;
strdel(string, i, j);
strins(string, menohraca, i, 128);
} else {
SendClientMessage(playerid, 0xFF0000FF, "Introduzca la ID");
return 0;
}
} else {
SendClientMessage(playerid, 0xFF0000FF, "Introduzca la ID");
return 0;
}
}
}
}
SendPlayerMessageToAll(playerid, string);
return 0;
}
Код:
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Usted no puede hablar, usted ha sido silenciado");
return 1;
}
if(nonewbie == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Canal Newbie Apagado.");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
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, "Usa: (/n)ewbie [newbie chat]");
return 1;
}
if(PlayerInfo[playerid][pHelper] == 0)
{
format(string, sizeof(string), "[Canal Dudas (/n)]: rango %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pHelper] == 1)
{
format(string, sizeof(string), "[Canal Dudas (/n)]: rango %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pHelper] == 2)
{
format(string, sizeof(string), "[Canal Dudas (/n)]: rango %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pHelper] == 3)
{
format(string, sizeof(string), "[Canal Dudas (/n)]: rango %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pHelper] == 4)
{
format(string, sizeof(string), "[Canal Dudas (/n)]: rango %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pHelper] == 5)
{
format(string, sizeof(string), "[Canal Dudas (/n)]: rango %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pHelper] == 6)
{
format(string, sizeof(string), "[Canal Dudas (/n)]: rango %s: %s", sendername, result);
}
SendClientMessageToAll(0xFF9900AA, string);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string, sizeof(string), "[%d/%d/%d](%d:%d:%d) %s (newbie): (%s)",d,m,y,h,mi,s, sendername, result);
ChatLog(string);
}
return 1;
}
PD: Si es que pude hacerlo funcionar, en pawno no me salto ningъn problema.. Cambiй el value "text" por "result" pero al entrar y intentar utilizarlo sale: "Unknown command" y no hace la funciуn.. E si no remuevo NADA del codigo no puedo hacerlo funcionar ya que crashea mi Pawno



