pm command with id o
#2

I am new at scripting so I'm not sure if this works,

try:
Код:
if(strcmp(cmd, "/pm", true) == 0 || strcmp(cmd, "/p", true) == 0)
{
if(IsPlayerConnected(playerid))
	 {
	    if(gPlayerLogged[playerid] == -1)
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet!");
	      return 1;
	       }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)m [playerid/PartOfName] [text]");
				return 1;
			}
			giveplayerid = GetPlayerID(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			  if(giveplayerid != INVALID_PLAYER_ID)
			  {
			    if(HidePM[giveplayerid] > 1)
			    {
			      SendClientMessage(playerid, COLOR_GREY, "  That player is blocking messages!");
			      return 1;
			    }
					GetPlayerName(playerid, sendername, sizeof(sendername));
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					if(giveplayerid == playerid)
					{
						return SendClientMessage(playerid, COLOR_GREY, "  You can`t send private message to yourself.");
					}
					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: (/p)m [playerid/PartOfName] [text]");
						return 1;
					}
					/*new namestring = strfind(result, ":", true);
				 	if(namestring != -1)
					{
					  new pmsplit[4][256];
					  new str[256];
					  for(new l=0;l<256;l++) str[l]=result[l];
						split((str), pmsplit, '.');
						if(strval(pmsplit[1]) != 0 && strval(pmsplit[2]) != 0)
						{
						  new year, month,day;
							getdate(year, month, day);
							format(string, sizeof(string), "AdmCmd: %s was kicked, reason: Server advert in PM(%d-%d-%d)", giveplayer, sendername, (result),day,month,year);
							KickLog(string);
							SendClientMessageToAll(COLOR_LIGHTRED, string);
							Kick(playerid);
							return 1;
						}
					}*/
					CheckPM(playerid,(result));
					format(string, sizeof(string), "[ID:%d] %s pm: %s", playerid, sendername, (result));
					SendClientMessage(giveplayerid, 0xBBA033AA, string);
					format(string, sizeof(string), "PM sent to [ID:%d]%s: %s", giveplayerid, giveplayer, (result));
					SendClientMessage(playerid, 0xE5C43EAA, string);
					format(string, sizeof(string), ">>PM from [%d]%s to [%d]%s: %s", playerid,sendername,giveplayerid, giveplayer, (result));
					PMLog(string);
					for(new z=0;z<MAX_PLAYERS;z++)
	  			if (BigEar[z])
	    		SendClientMessage(z, 0x1ED5C7FF, string);
					return 1;
				}
			}
			else
			{
					format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
					SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
I changed this line:
if(gPlayerLogged[playerid] == 0)

Now it is if(gPlayerLogged[playerid] == -1)
I don't think it will work. But just give it a try
Reply


Messages In This Thread
pm command with id o - by ihatetn931 - 08.02.2010, 05:57
Re: pm command with id o - by bartje01 - 08.02.2010, 06:42
Re: pm command with id o - by mansonh - 08.02.2010, 06:56
Re: pm command with id o - by bartje01 - 08.02.2010, 07:13
Re: pm command with id o - by mansonh - 08.02.2010, 07:39
Re: pm command with id o - by ihatetn931 - 08.02.2010, 18:15

Forum Jump:


Users browsing this thread: 4 Guest(s)