SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 18/10/2009, 04:55 PM   #1
XeoN_13
Huge Clucker
 
Join Date: Mar 2009
Posts: 326
Reputation: 0
Default Private Message

Hello im here to ask about the command /pm , not working on my GameMode. I Checked BARE.PWN but dint find anything about it. Could any one please help me?
XeoN_13 is offline  
Old 18/10/2009, 04:57 PM   #2
dugi
Beta Tester
 
Join Date: Jun 2007
Location: Poland
Posts: 2,321
Reputation: 848
Default Re: Private Message

Default PM system has been removed from sa-mp, check base.pwn filterscript for information about scripting your own.
__________________
dugi is offline  
Old 18/10/2009, 05:03 PM   #3
RoamPT
High-roller
 
RoamPT's Avatar
 
Join Date: Nov 2007
Location: Toronto, Canada
Posts: 1,110
Reputation: 26
Default Re: Private Message

Quote:
Originally Posted by XeoN_13
Hello im here to ask about the command /pm , not working on my GameMode. I Checked BARE.PWN but dint find anything about it. Could any one please help me?
This was answered millions of times.
pawn Code:
#define ADMINFS_MESSAGE_COLOR 0xFF444499
#define PM_INCOMING_COLOR   0xFFFF22AA
#define PM_OUTGOING_COLOR   0xFFCC2299

pawn Code:
new cmd[256];
    new tmp[256];
    new Message[256];
    new gMessage[256];
    new pName[MAX_PLAYER_NAME+1];
    new iName[MAX_PLAYER_NAME+1];
    new idx;

pawn Code:
if(strcmp("/pm", cmd, true) == 0)
    {
        tmp = strtok(cmdtext,idx);
       
        if(!strlen(tmp) || strlen(tmp) > 5) {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
            return 1;
        }
       
        new id = strval(tmp);
    gMessage = strrest(cmdtext,idx);
   
        if(!strlen(gMessage)) {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
            return 1;
        }
       
        if(!IsPlayerConnected(id)) {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID");
            return 1;
        }
       
        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
            SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
            format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
            SendClientMessage(id,PM_INCOMING_COLOR,Message);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);
           
            printf("PM: %s",Message);
           
        }
        else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself");
        }
        return 1;
    }

Here is all you need.
__________________
RoamPT is offline  
Old 18/10/2009, 05:10 PM   #4
XeoN_13
Huge Clucker
 
Join Date: Mar 2009
Posts: 326
Reputation: 0
Default Re: Private Message

Ok once i try to compli i get some erros, Could it be because i have this under onplayercommand?

Code:
	public OnPlayerCommandText(playerid, cmdtext[])
	{
	printf("DEBUG: OnPlayerCommandText(%d, %s)", playerid, cmdtext);
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
	new playermoney;
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	new cmd[256];
	new giveplayerid, moneys, idx;

	cmd = strtok(cmdtext, idx);
XeoN_13 is offline  
Old 18/10/2009, 05:10 PM   #5
RoamPT
High-roller
 
RoamPT's Avatar
 
Join Date: Nov 2007
Location: Toronto, Canada
Posts: 1,110
Reputation: 26
Default Re: Private Message

What errors it gives you?
__________________
RoamPT is offline  
Old 18/10/2009, 05:11 PM   #6
Memoryz
Gangsta
 
Join Date: Dec 2008
Posts: 726
Reputation: 26
Default Re: Private Message

Just add the base filterscript to your server.cfg

Code:
filterscripts base
Memoryz is offline  
Old 18/10/2009, 05:15 PM   #7
XeoN_13
Huge Clucker
 
Join Date: Mar 2009
Posts: 326
Reputation: 0
Default Re: Private Message

Code:
C:\Documents and Settings\Owner\Desktop\G.pwn(264) : error 017: undefined symbol "pName"
C:\Documents and Settings\Owner\Desktop\G.pwn(272) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Owner\Desktop\G.pwn(277) : error 021: symbol already defined: "idx"
C:\Documents and Settings\Owner\Desktop\G.pwn(294) : error 017: undefined symbol "strrest"
C:\Documents and Settings\Owner\Desktop\G.pwn(294) : error 033: array must be indexed (variable "gMessage")
C:\Documents and Settings\Owner\Desktop\G.pwn(269) : warning 203: symbol is never used: "idx"
C:\Documents and Settings\Owner\Desktop\G.pwn(2517) : warning 203: symbol is never used: "tmp"

i have this:
Code:
	public OnPlayerCommandText(playerid, cmdtext[])
	{
	printf("DEBUG: OnPlayerCommandText(%d, %s)", playerid, cmdtext);
	GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
	new playermoney;
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	new cmd[256];
	new giveplayerid, moneys, idx;
	

	new	tmp[256];
	new Message[256];
	new gMessage[256];
	new pName[MAX_PLAYER_NAME+1];
	new iName[MAX_PLAYER_NAME+1];
	new	idx;

	cmd = strtok(cmdtext, idx);
XeoN_13 is offline  
Old 18/10/2009, 05:16 PM   #9
Memoryz
Gangsta
 
Join Date: Dec 2008
Posts: 726
Reputation: 26
Default Re: Private Message

Quote:
Originally Posted by XeoN_13
Code:
C:\Documents and Settings\Owner\Desktop\G.pwn(264) : error 017: undefined symbol "pName"
C:\Documents and Settings\Owner\Desktop\G.pwn(272) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Owner\Desktop\G.pwn(277) : error 021: symbol already defined: "idx"
C:\Documents and Settings\Owner\Desktop\G.pwn(294) : error 017: undefined symbol "strrest"
C:\Documents and Settings\Owner\Desktop\G.pwn(294) : error 033: array must be indexed (variable "gMessage")
C:\Documents and Settings\Owner\Desktop\G.pwn(269) : warning 203: symbol is never used: "idx"
C:\Documents and Settings\Owner\Desktop\G.pwn(2517) : warning 203: symbol is never used: "tmp"

i have this:
Code:
	public OnPlayerCommandText(playerid, cmdtext[])
	{
	printf("DEBUG: OnPlayerCommandText(%d, %s)", playerid, cmdtext);
	GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
	new playermoney;
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	new cmd[256];
	new giveplayerid, moneys, idx;
	

	new	tmp[256];
	new Message[256];
	new gMessage[256];
	new pName[MAX_PLAYER_NAME+1];
	new iName[MAX_PLAYER_NAME+1];
	new	idx;

	cmd = strtok(cmdtext, idx);
Add this include

pawn Code:
#include "../include/gl_common.inc"
Memoryz is offline  
Old 18/10/2009, 05:16 PM   #10
XeoN_13
Huge Clucker
 
Join Date: Mar 2009
Posts: 326
Reputation: 0
Default Re: Private Message

Quote:
Originally Posted by Don Correlli
Sorry but im not a pawno smart guy like you
XeoN_13 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP]XtremeAdmin2 Admin Private Message!!! 0.3a BlackSkull Help Archive 7 12/12/2009 02:16 PM
[Problem] Private Message Advirtising! -PunisheR- Help Archive 6 06/11/2009 02:18 PM


All times are GMT. The time now is 04:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.