SA-MP Forums Archive
PM help- - 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 help- (/showthread.php?tid=613941)



PM help- - b0b - 02.08.2016

PHP Code:
CMD:pm(playeridparams[])
{
    new 
targetidstring[258], tekst[128];
    if(
sscanf(params"us[128]"targetidtekst)) return SendClientMessage(playeridCOLOR_WHITE"{3BB9FF}use: {FFFFFF}/pm  < ID > < tekst >");
    if(
targetid == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"Wrong ID");
    
format(stringsizeof(string), "[PM][IN] %s: %s"PlayerName(playerid), tekst);
    
SendClientMessage(targetidCOLOR_YELLOWstring);
    
format(stringsizeof(string), "[PM][out] %s: %s"PlayerName(targetid), tekst);
    
SendClientMessage(playeridCOLOR_REDstring);
    return 
1;

Hello.
I have problem with this command?
If i try to ingame /pm 0 Test

Its says "Wrong ID" Why? )


Re: PM help- - J0sh... - 02.08.2016

if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Wrong ID");


Re: PM help- - SyS - 02.08.2016

you might check whether you inputted correct player id and also check ifthe player is connected or not


Re: PM help- - F1N4L - 02.08.2016

You're using sscanf version by Emmet_ or ******?
Use by Emmet_: https://sampforum.blast.hk/showthread.php?tid=570927
Test it...


Re: PM help- - b0b - 02.08.2016

Quote:

if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Wrong ID");

this dosnt work /: says Wornh ID i want try by my self..
Like why i cant send myself PM?


Re: PM help- - Shinja - 02.08.2016

In your code you save targetid as "u", it can be a name so no "targetid = INVALID_PLAYER_ID" nor IsPlayerConnected(targetid) can slove it maybe in your sscanf version, "u" works fine with me but try to change "u" to "d"

PHP Code:
CMD:pm(playeridparams[])
{
    new 
targetidstring[258], tekst[128];
    if(
sscanf(params"ds[128]"targetidtekst)) return SendClientMessage(playeridCOLOR_WHITE"{3BB9FF}use: {FFFFFF}/pm  < ID > < tekst >");
    if(
targetid == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"Wrong ID");
    
format(stringsizeof(string), "[PM][IN] %s: %s"PlayerName(playerid), tekst);
    
SendClientMessage(targetidCOLOR_YELLOWstring);
    
format(stringsizeof(string), "[PM][out] %s: %s"PlayerName(targetid), tekst);
    
SendClientMessage(playeridCOLOR_REDstring);
    return 
1;




Re: PM help- - Stinged - 02.08.2016

Quote:
Originally Posted by Shinja
View Post
In your code you save targetid as "u", it can be a name so no "targetid = INVALID_PLAYER_ID" nor IsPlayerConnected(targetid) can slove it, change "u" to "d"
"u" allows sscanf to search for both names and ids.
And if the id or name doesn't exist, it sets the variable as INVALID_PLAYER_ID.
So it has nothing to with "d" and "u"

https://sampforum.blast.hk/showthread.php?tid=602923
Read the specifiers section.


Re: PM help- - Shinja - 02.08.2016

Quote:
Originally Posted by Stinged
View Post
"u" allows sscanf to search for both names and ids.
And if the id or name doesn't exist, it sets the variable as INVALID_PLAYER_ID.
So it has nothing to with "d" and "u"

https://sampforum.blast.hk/showthread.php?tid=602923
Read the specifiers section.
I already edited my post.
But, where the hell mistake can be lol? my command have almost same syntax and working perfectly
PHP Code:
new idmess[40];
     if(
sscanf(params"us[40]"idmess)) return SendClientMessage(playerid, -1"{0008F7}USAGE: {FFFFFF}/PM ID MESSAGE");
     if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xCD0000FF"Player is not connected");
     if(
DND[id] == 1) return SendClientMessage(playerid0xCD0000FF"Player is on DND mode");
     new 
PName[24];
    
GetPlayerName(idPNamesizeof(PName));
    new 
string[100], name[24];
    
GetPlayerName(playeridnamesizeof(name));
    
format(string,sizeof(string),"{FCDF00}[PRIVATE MESSAGE] {8A887B}From %s(%d): {8C8656}%s"nameplayeridmess);
    
SendClientMessage(id, -1string);
    
format(string,sizeof(string),"{FCDF00}[PRIVATE MESSAGE] {8A887B}To %s(%d): {8C8656}%s"PNameidmess);
    
SendClientMessage(playerid, -1string); 



Re: PM help- - Fantje - 02.08.2016

Still need help?


Re: PM help- - AlexPalermitano97 - 03.08.2016

you try to change "u" in "i"..