24.08.2012, 18:11
How to make pm in zcmd?
CMD:pm(playerid, params[])
{
if (PlayerInfo[playerid][pLogged] == 0) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must be logged in to use this.");
if(PlayerInfo[playerid][pMute] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You are currently muted.");
new str[512], str2[512], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, -1, "USAGE: /pm [ID] [Message]");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "WARNING: Player is not connected.");
if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "WARNING: You cannot pm to yourself!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "(( PM to [%d] %s: %s ))", id, Name2, str2);
SendClientMessage(playerid, 0xFFBF00FF, str);
format(str, sizeof(str), "(( PM from [%d] %s: %s ))", playerid, Name1, str2);
SendClientMessage(id, 0xFFFF00FF, str);
}
return 1;
}
C:\Users\carlo\Desktop\New folder\gamemodes\SATDM_v11.pwn(34129) : error 017: undefined symbol "PlayerInfo"
C:\Users\carlo\Desktop\New folder\gamemodes\SATDM_v11.pwn(34129) : warning 215: expression has no effect
C:\Users\carlo\Desktop\New folder\gamemodes\SATDM_v11.pwn(34129) : error 001: expected token: ";", but found "]"
C:\Users\carlo\Desktop\New folder\gamemodes\SATDM_v11.pwn(34129) : error 029: invalid expression, assumed zero
C:\Users\carlo\Desktop\New folder\gamemodes\SATDM_v11.pwn(34129) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
CMD:pm(playerid, params[])
{
new str[512], str2[512], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, -1, "USAGE: /pm [ID] [Message]");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "WARNING: Player is not connected.");
if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "WARNING: You cannot pm to yourself!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "(( PM to [%d] %s: %s ))", id, Name2, str2);
SendClientMessage(playerid, 0xFFBF00FF, str);
format(str, sizeof(str), "(( PM from [%d] %s: %s ))", playerid, Name1, str2);
SendClientMessage(id, 0xFFFF00FF, str);
}
return 1;
}
CMD:pm(playerid, params[])
{
new pID, Msg[128];
if(sscanf(params, "ds[128]", pID, Msg)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}Usage: /pm [PlayerID] [Message]");
if(pID == playerid) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You can't PM to yourself!");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Invalid PlayerID or the PlayerID is not online");
new str[256], pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pID, pName2, sizeof(pName2));
format(str, sizeof(str), ">PM Sent to %s (ID: %d): %s", pName2, pID, Msg);
SendClientMessage(playerid, red, str);
format(str, sizeof(str), ">>> PM from %s (ID: %d): %s", pName, playerid, Msg);
SendClientMessage(pID, red, str);
return 1;
}