ZCMD -
Windrush - 24.08.2012
How to make pm in zcmd?
Re: ZCMD -
Calabresi - 24.08.2012
Here is my version.
pawn Код:
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;
}
Change the colors as you wish.
Re: ZCMD -
Shetch - 24.08.2012
Read through the ZCMD and sscanf official thread.
It's better to script when you actually understand what you're doing.
Re: ZCMD -
Windrush - 24.08.2012
pawn Код:
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.
[PAWN] if (PlayerInfo[playerid][pLogged] == 0) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must be logged in to use this."); //LINE
Re: ZCMD -
Calabresi - 24.08.2012
pawn Код:
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;
}
All you need to do is deleting places that you don't have in your script. I did it for you, here you are.
Re: ZCMD -
kbalor - 24.08.2012
Here's mine
pawn Код:
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;
}
Re: ZCMD -
Windrush - 24.08.2012
hi kbalor pde ba akong maging co-owner mo sa server mo?
Re: ZCMD -
leonardo1434 - 24.08.2012
Calabresi, 2 strings with size 512 are you crazy or what?
&
kbalor, on sscanf, it should be "us[128]" instead of "ds[128]". "i" or "d" are for integers, "u" for players ID and "s[size]" are for strings.