23.09.2012, 07:38
Today I made my PM system which is little bugged.I don`t see problem.PM is working but when Admin need to see the message it`s not displeyed.I don`t know why.
Here is the code:
Here is the code:
pawn Код:
CMD:pm(playerid, params [ ] )
{
if(IsPlayerConnected(playerid)) //This one checks if the player is connected to the server or not.
{
new pID, Message[60],playername[MAX_PLAYER_NAME],targetName[MAX_PLAYER_NAME],string[128],string2[128]; // defining the pID which will hold the Player's ID. Message will hold the message and playername will hold the name of the player that sends it, also target to the target
if(sscanf(params, "us[60]", pID, Message)) return SendClientMessage(playerid, 0xAFAFAFAA, ""embed_yellow"Usage"embed_white": /pm [PlayerID/PlayerName] [Message]"); // Checks if the player has filed in both params if not it will return a error message with Color Grey
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAFAFAFAA, ""embed_red"[ERROR] "embed_white"Invalid Player"); // Checks if the player he attemps to send to is invalid if not it will send and error message
if(PMEnabled[playerid] == 0) return SendClientMessage(playerid, 0xAFAFAFAA, ""embed_red"[ERROR] "embed_white"PM Is Disabled"); // This checks if the PMs are toggled off
GetPlayerName(pID, targetName, sizeof(targetName)); // Gets the Name of The Target 1st param and stores it in targetName
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), ""embed_red"[PM] "embed_white"From "embed_sw"%s"embed_white":%s", playername, Message); // Will format the string the first %s is the name of the guy who sent pm second %s in the Message
format(string2, sizeof(string2), ""embed_red"[PM] "embed_white"Sent to "embed_sw"%s"embed_white":%s", targetName, Message); // The same as above but this time it shows the name off the player you sent it to
SendClientMessage(playerid, 0xFFFF00AA, string2); // Sends a message to the player who sent the PM
SendClientMessage(pID, 0xFFFF00AA, string); // Sends a Message to Target
//if(UserStats[playerid][Admin] == 5 || UserStats[pID][Admin] == 5) return 1;
format(string, 128,""embed_white"[PM]"embed_sw"%s(%i) "embed_white"to "embed_sw"%s(%i)"embed_white": "embed_orange"%s", UserStats[playerid][Name], playerid,UserStats[pID][Name], pID, Message);
foreach(Player, i)
{
if(UserStats[i][Admin] > 3)
{
if(i != playerid && i != pID)
{
SendClientMessage(i, blue, string);
}
}
}
}
return 1;
}