I have a little bug
#1

I have a little bug. When I respond to PM a /r [text], the recipient does not receive the words that I wrote after intervals.
Text after the first space is not visible (by /r [text])

Код:
	if(strcmp(cmd, "/r", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /r [text]");
				return 1;
			}
			giveplayerid = GetPVarInt(playerid, "LastID");
			if (IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
			    {
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					for(new i = 0; i < MAX_PLAYERS; i++)
					{
					    if(IsPlayerConnected(i))
					    {
							format(string, sizeof(string), "* PM from %s(ID: %d): %s", PlayerName(playerid), playerid, tmp);
							SendClientMessage(giveplayerid, 0xffff00ff, string);
						}
					}
					format(string, sizeof(string), "* PM to %s(ID: %d): %s", giveplayer, giveplayerid, tmp);
					SendClientMessage(playerid,  0xffff00ff, string);
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, 0xFF0000FF, "You didn't have a PM!");
			}
		}
		return 1;
	}
Reply
#2

if you would use the sscanf2 plugin, it would be easier to make that command (also using zcmd).
Reply
#3

sscanf 2.5 is the latest version. Can you fix code?
Reply
#4

Can you give me correct code because I make more mistakes.
Reply
#5

I fixed it, thank ******
Reply
#6

Why are you checking IsPlayerConnected? How can non-connected players send commands? Think about it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)