18.02.2014, 16:59
Hello,
I'm working on my gamemode and this time a PM system (Private Message)
It gives me the error that the player is not online.. but the player is ALWAYS online when I try.
After the messange is senden I like to save it in my MySQL database.
The problem:
* Invalid player
Who knows the problem?
I'm working on my gamemode and this time a PM system (Private Message)
It gives me the error that the player is not online.. but the player is ALWAYS online when I try.
After the messange is senden I like to save it in my MySQL database.
pawn Code:
CMD:pm(playerid, params[])
{
if(IsPlayerConnected(playerid)) // Checks if the Player IS connected
{
new pID, Message[60], username[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME], string[128], string2[128], query[600];
if(sscanf(params, "us[60]", pID, Message)) return SendClientMessage(playerid, COLOR_GOLD, "[REDMIN] PM Error: /pm <playerID or playername> <message>");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GOLD, "[REDMIN]PM Error: Invalid Player");
if(PMEnabled == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "PM Is Disabled");
GetPlayerName(pID, targetName, sizeof(targetName));
GetPlayerName(playerid, username, sizeof(username));
format(string, sizeof(string), "PM from %s: %s", username, Message);
format(string2, sizeof(string2), "PM sent to %s: %s", targetName, Message);
SendClientMessage(playerid, COLOR_GOLD, string2);
SendClientMessage(pID, COLOR_GOLD, string);
new timestamp = gettime()
format(query, sizeof(query), "INSERT INTO pms (id, sender, reciever, date, message) VALUES ('', '%s', '%s', '%s', '%s')", playerid, pID, timestamp, Message);
mysql_query(query);
}
return 1;
}
* Invalid player
Who knows the problem?