SA-MP Forums Archive
Problema com comando /Sos - 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: Problema com comando /Sos (/showthread.php?tid=159054)



Problema com comando /Sos - GuikBretas - 12.07.2010

Pessoal estou com seguinte problema

D:\GM\larp.pwn(12776) : error 035: argument type mismatch (argument 1)
D:\GM\larp.pwn(1277 : error 033: array must be indexed (variable "sendername")
D:\GM\larp.pwn(12780) : error 033: array must be indexed (variable "sendername")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.


Код:
	new SoS[MAX_PLAYERS];
	if(strcmp(cmd, "/sos", 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, "USAGE: /sos [texto]");
				return 1;
			}
			format(string, sizeof(string), "Pedido de Ajuda de (ID:%d)%s: %s",playerid, sendername, (result));
			ABroadCast(COLOR_LIGHTRED,string,1);
			SendClientMessage(playerid, COLOR_YELLOW, "Your Report Message was sent to the Admins.");
			SoS[playerid] = 1;
	    }
	    return 1;
	}

	if(strcmp(cmd, "/atenderajuda", true) == 0) // By Ellis
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa se logar primeiro !");
	            return 1;
	        }
	        if(PlayerInfo[playerid][pAdmin] > 0)
	        {
	            tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
			    	SendClientMessage(playerid, COLOR_WHITE, "HINT: /atenderajuda [playerid/PartOfName]");
			    	return 1;
				}
				if(IsPlayerConnected(sendername))
				{
				        if(SoS[sendername] == 1)
				        {
				            SoS[sendername] = 0;
				            GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "[LS-PP] %s aceitou o pedido de ajuda de [ID:%d]%s.", sendername);
							ABroadCast(COLOR_YELLOW, string, 1);
							format(string, sizeof(string), "** LARP Administrator [ID:%d]%s has accepted your report and now ready to assist you! Please be patience.", playerid, sendername);
							SendClientMessage(giveplayerid, 0x4D903DAA, string);
				        }
				        else
				        {
				            SendClientMessage(playerid, COLOR_GREY, "   Player didn't send a report message or it's out of stock !");
				            return 1;
				        }
				}
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo estб autorizado para usar esse comando ! ");
	            return 1;
	        }
	    }
	    return 1;
	}



Re: Problema com comando /Sos - Fred_Marley - 12.07.2010

ve ce resolve


if(strcmp(cmd, "/sos", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Voce nгo estб logado!");
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_GRAD2, "USE: /sos [text]");
return 1;
}
format(string, sizeof(string), "==> sos de %s(%d)[%d]: %s <==", sendername, playerid, pVIP, (result));
ABroadCast(0xFFFF66FF,string,1);
SendClientMessage(playerid, 0xFFFF66FF, "Sua mensagem foi enviada aos admins.");
}
return 1;
}


Re: Problema com comando /Sos - GuikBretas - 12.07.2010

Cara, eu num queria comando tipo esse que vocк enviou, eu queria tipo um comando que os administradores tem que aceitar, exemplo, uma pessoa manda /Sos, o admin confere, e digita /aceitarajuda id