[HELP] Will this work?
#1

Hello, I have been experimenting with a TPM command, do you think this will work, if not, can oyu please help me to fix it?

Код:
	if(strcmp("/tpm", cmd, true) == 0)
	{
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[256];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		if(!strlen(result))
		{
			SendClientMessage(playerid, COLOR_GREY, "	USAGE: /tpm [text]");
			return 1;
		}
		format(string, sizeof(string), "TPM: %s: %s", sendername, result);
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(gTeam[i] == gTeam[playerid])
				SendClientMessage(playerid, PM_INCOMING_COLOR, string);
			}
			return 0;
		}
		return 1;
	}
Thanks
Reply
#2

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(gTeam[i] == gTeam[playerid])
                SendClientMessage(i, PM_INCOMING_COLOR, string);
            }
        }
Changed playerid to i and removed return 0;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)