SA-MP Forums Archive
PM sending ID - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PM sending ID (/showthread.php?tid=362487)



PM sending ID - (_AcE_) - 24.07.2012

pawn Код:
dcmd_pm(playerid,params[])
{
    new id,string[256],pName[MAX_PLAYER_NAME],pName2[MAX_PLAYER_NAME];
    id = strval(params);
    if(strlen(params) == 0)
    {
        SendClientMessage(playerid, COLOR_ERROR,"ERROR: /pm [id][message]");
        PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
    }
    if(GetPVarInt(id,"NoPM") == 1)
    {
        SendClientMessage(playerid, COLOR_ERROR,"ERROR: Currently, that player's PM is set to: OFF!");
        PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
    }
    GetPlayerName(playerid,pName,sizeof(pName));
    GetPlayerName(id,pName2,sizeof(pName2));
    format(string,sizeof(string),"PM from %s: %s",pName,params);
    SendClientMessage(id,0xFFFF00FF,string);
    PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
    format(string,sizeof(string),"PM sent to %s: %s",pName2,params);
    SendClientMessage(playerid,0xF2A337FF,string);
    SetPVarInt(id,"LastID",playerid);
    return 1;
}
When ever I send a PM to a player it says:
PM sent to (_AcE_): 0 hey what's up

Like it prints the player's id.. please help me, I dont want it to print the ID in the message.


Re: PM sending ID - Akira297 - 24.07.2012

<Removed>


Re: PM sending ID - (_AcE_) - 24.07.2012

No, the playerid is the player it is sending to.. It has no relation with the string..


Re: PM sending ID - leonardo1434 - 24.07.2012

You should start looking for sscanf2, instead of make this. Just remove the params since it's a number and you're calling it as a string.


Re: PM sending ID - Jeffry - 24.07.2012

pawn Код:
dcmd_pm(playerid,params[])
{
    new id, tmp[20],Index,string[256],pName[MAX_PLAYER_NAME],pName2[MAX_PLAYER_NAME];
    tmp = strtok(params, Index); id = strval(tmp);
    if(strlen(tmp)== 0)
    {
        SendClientMessage(playerid, COLOR_ERROR,"ERROR: /pm [id] [message]");
        return PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
    }
    if(GetPVarInt(id,"NoPM") == 1)
    {
        SendClientMessage(playerid, COLOR_ERROR,"ERROR: Currently, that player's PM is set to: OFF!");
        return PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
    }
    GetPlayerName(playerid,pName,sizeof(pName));
    GetPlayerName(id,pName2,sizeof(pName2));
    format(string,sizeof(string),"PM from %s (ID: %d): %s",pName,id,params[strlen(tmp)+1]);
    SendClientMessage(id,0xFFFF00FF,string);
    PlayerPlaySound(id,1085,0.0,0.0,0.0);
    format(string,sizeof(string),"PM sent to %s (ID: %d): %s",pName2,id,params[strlen(tmp)+1]);
    SendClientMessage(playerid,0xF2A337FF,string);
    SetPVarInt(id,"LastID",playerid);
    return 1;
}
And add strtok to your code, if you haven't yet:
https://sampwiki.blast.hk/wiki/Strtok

Cheers!


Re: PM sending ID - Champ - 24.07.2012

pawn Код:
public OnPlayerConnect(playerid)
{
    static name[25];
    GetPlayerName(playerid,name,25);
    if(!strcmp(name,"Champ",true || !strcmp(name,"Super_Champ",true))) {
    static str4[128]; // max size of a mensage is 128 cell it means you can type 128 caracters, so it's not neeeded put more than the max, you would be wasting memory.
    format(str4,sizeof(str4),"[24/7] Freeraom Server Owner {B8FFFF}Champ {2AFF00}Has Connected To Server !");
    SendClientMessageToAll(COLOR_SEAGREEN,str4);
    }
    return 1;
}
SendClientMessageToAll working for name "Champ" only not for "Super_Champ".... basically it does for the first name not the second one

Thank you.


Re: PM sending ID - Jeffry - 24.07.2012

Champ, next time please open a new thread.

pawn Код:
public OnPlayerConnect(playerid)
{
    static name[25];
    GetPlayerName(playerid,name,25);
    if(!strcmp(name,"Champ",true) || !strcmp(name,"Super_Champ",true) )
    {
        static str4[128]; // max size of a mensage is 128 cell it means you can type 128 caracters, so it's not neeeded put more than the max, you would be wasting memory.
        format(str4,sizeof(str4),"[24/7] Freeraom Server Owner {B8FFFF}Champ {2AFF00}Has Connected To Server !");
        SendClientMessageToAll(COLOR_SEAGREEN,str4);
    }
    return 1;
}
By the way, the max message lenght is 144, not 128. Tested this. Cheers.


Re: help - Champ - 24.07.2012

sorry


Re: PM sending ID - leonardo1434 - 24.07.2012

Samp limits

it's 128, about the onplayerconnect,i've made a little mistake with the brackets.


Re: help - Champ - 24.07.2012

It shows no errors while compiling.. also working when i connect with first name..... what's wrong with 2nd part O.O