/pm command
#1

Hey, i made the /pm command for 0.3, but it seem like i'm missing something with the CallLocalFunction.

The script :
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256], idx;
  cmd = strtok(cmdtext, idx);
	if(strcmp(cmd, "/pm", true) == 0)
	{
		new x_nr[256];
		x_nr = strtok(cmdtext, idx);
		new recieverid = strval(x_nr);
		new text[MAX_STRING];
		
		if(!strlen(x_nr)) return SendClientMessage(playerid, 0x00C8C8FF, "Enter a valid player ID!");
		if(cmdtext[5] == 0) return SendClientMessage(playerid, 0x00C8C8FF, "Enter a message!");
		if(!IsPlayerConnected(recieverid)) return SendClientMessage(playerid, 0x00C8C8FF, "Enter a valid player ID!");
		if(recieverid == playerid) return SendClientMessage(playerid, 0x00C8C8FF, "You cannot PM yourself!");
		
		if(strlen(x_nr) == 1) { format(text,sizeof(text), "%s", cmdtext[6]); }
		if(strlen(x_nr) == 2) { format(text,sizeof(text), "%s", cmdtext[7]); }
		if(strlen(x_nr) == 3) { format(text,sizeof(text), "%s", cmdtext[8]); }
		
		CallLocalFunction("OnPlayerPrivmsg","playerid,recieverid,text[]");
		return 1;
	}
}
Reply
#2

There is no OnPlayerPrivmsg function in 0.3
Reply
#3

You can make OnPlayerPrivmsg yourself.

https://sampwiki.blast.hk/wiki/OnPlayerPrivmsg - there is an example how to make /pm command.
Reply
#4

He obviously has his /pm command, he's just calling an invalid function with CallRemoteFunction
Reply
#5

Quote:
Originally Posted by dice7
He obviously has his /pm command, he's just calling an invalid function with CallRemoteFunction
What is the valid function to call then?

I was obviously showing how he can make that function.
Reply
#6

It's invalid, indeed.

This is his code:
Quote:
Originally Posted by Alice[A11
]
Код:
CallLocalFunction("OnPlayerPrivmsg","playerid,recieverid,text[]");
This is correct:
pawn Код:
CallLocalFunction("OnPlayerPrivmsg", "iis", playerid, recieverid, text);
Reply
#7

Quote:
Originally Posted by Don Correlli
This is correct:
pawn Код:
CallLocalFunction("OnPlayerPrivmsg", "iis", playerid, recieverid, text);
Thanks you

Quote:
Originally Posted by dice7
There is no OnPlayerPrivmsg function in 0.3
I knew it ^^' i just added the forward and the command to make it like on 0.2
Reply
#8

Why don't you use the base filterscript?

You can edit that one too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)