jeudi 21 juillet 2016

PM command

Let's block ads! (Why?)



PM command
Old 21/07/2016, 05:09 PM   #1

Big Clucker

 

Join Date: Mar 2014

Posts: 83

Reputation: 1

Default[Solved] PM command

Hello there,

I am creating a PM command from various links I mash together. For some weird reason when I get in game and pm someone something it does this:

It shows the ID of the player you are sending to and then the message you wanted.

PHP Code:

#define FILTERSCRIPT

#include <a_samp>
#include <sscanf>
#include <zcmd>

enum PlayerInfo
{
    
Last,
    
NoPM,
}

new 

pInfo[MAX_PLAYERS][PlayerInfo]; //Usual OnFilterScript things are empty and so on public OnPlayerConnect(playerid)
{
    
pInfo[playerid][Last] = -1;
    
pInfo[playerid][NoPM] = 0;
    return 
1;
}

public 

OnPlayerDisconnect(playeridreason)
{
    
pInfo[playerid][Last] = -1;
    
pInfo[playerid][NoPM] = 0;
    return 
1;
}
CMD:pm(playeridparams[])
{
    new 
idmsg[128], text[128];
    if(
sscanf(params"s[128]"msg) || sscanf(params"u"id)) return SendClientMessage(playeridRED"[USAGE]: /pm [name/id] [msg]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridRED"Player not found.");
    if(
strlen(msg) < || strlen(msg) > 128) return SendClientMessage(playeridRED"Your message can only contain 1-128 characters.");
    if(
playerid == id) return SendClientMessage(playeridRED"You cannot PM yourself.");
    if(
pInfo[id][NoPM] == 1) return SendClientMessage(playerid,-1,"That player isnt recieving pm's");format(textsizeof(text), "PM To %s : %s"PlayerName(id), msg);
    
SendClientMessage(playeridYELLOWtext);
    
format(textsizeof(text), "PM From %s : %s"PlayerName(playerid), msg);
    
SendClientMessage(idYELLOWtext);
        
        
    
pInfo[id][Last] = playerid;
    return 
true;
}
stock PlayerName(playerid)//Executing function.
{
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNamesizeof(pName));
    return 
pName;

Thanks in advance


Last edited by ThatThoseTheThy; 21/07/2016 at 06:05 PM.
ThatThoseTheThy is online now   Reply With Quote

Aucun commentaire:

Enregistrer un commentaire