Admin : if (PlayerInfo[playerid][pAdmin] >= 1) Helper: if (PlayerInfo[playerid][pHelper] >= 1)
if(strcmp(cmd, "/whisper", true) == 0 || strcmp(cmd, "/w", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You havent logged in yet");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_WHITE, "You need level 2 to use this");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /whisper [playerid/PartOfName] [whisper text]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(HidePM[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "That player is blocking Whispers");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == playerid)
{
format(string, sizeof(string), "%s mutters somthing", sendername);
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /whisper [playerid/PartOfName] [whisper text]");
return 1;
}
format(string, sizeof(string), "{FF8000}[ID: %d] {FFFFFF}%s {FF8000}Whisper: {FFFFFF}%s", playerid, sendername, (result));
SendClientMessage(giveplayerid, 0xFFFFFFFF, string);
format(string, sizeof(string), "{FFFFFF}Whisper sent to {FF8000}[ID: %d] {FFFFFF}%s: {FF8000}%s", giveplayerid, giveplayer, (result));
SendClientMessage(playerid, 0xFFFFFFFF, string);
SBizzInfo[1][sbTill] += txtcost / 2;
ExtortionSBiz(1, txtcost / 2);
return 1;
}
}
else
{
format(string, sizeof(string), "That player is not connected", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
dcmd_pm(playerid, params[]) { if(PlayerInfo[playerid][pLevel] < 1) { SendClientMessage(playerid, COLOR_WHITE, "You need level 2 to use this"); return 1; } if(PlayerInfo[playerid][pHelper] == 1) { SendClientMessage(playerid, TEAM_CYAN_COLOR, "you are not a helper."); return 1; } new pID, text[128], string[128]; if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected."); if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself."); format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID); if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string); format(string, sizeof(string), "(( PM to %s: %s ))", PlayerName(pID), text); SendClientMessage(playerid, COLOR_YELLOW, string); format(string, sizeof(string), "(( PM from %s: %s ))", PlayerName(playerid), text); SendClientMessage(pID, COLOR_YELLOW, string); pInfo[pID][Last] = playerid; return 1; }
do this will work!
Код:
dcmd_pm(playerid, params[]) { if(PlayerInfo[playerid][pLevel] < 1) { SendClientMessage(playerid, COLOR_WHITE, "You need level 2 to use this"); return 1; } if(PlayerInfo[playerid][pHelper] == 1) { SendClientMessage(playerid, TEAM_CYAN_COLOR, "you are not a helper."); return 1; } new pID, text[128], string[128]; if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected."); if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself."); format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID); if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string); format(string, sizeof(string), "(( PM to %s: %s ))", PlayerName(pID), text); SendClientMessage(playerid, COLOR_YELLOW, string); format(string, sizeof(string), "(( PM from %s: %s ))", PlayerName(playerid), text); SendClientMessage(pID, COLOR_YELLOW, string); pInfo[pID][Last] = playerid; return 1; } |
if(strcmp(cmd, "/whisper", true) == 0 || strcmp(cmd, "/w", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You havent logged in yet");
return 1;
}
if(PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You need level 2 to use this or helpers level 1+");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /whisper [playerid/PartOfName] [whisper text]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(HidePM[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "That player is blocking Whispers");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == playerid)
{
format(string, sizeof(string), "%s mutters somthing", sendername);
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /whisper [playerid/PartOfName] [whisper text]");
return 1;
}
format(string, sizeof(string), "{FF8000}[ID: %d] {FFFFFF}%s {FF8000}Whisper: {FFFFFF}%s", playerid, sendername, (result));
SendClientMessage(giveplayerid, 0xFFFFFFFF, string);
format(string, sizeof(string), "{FFFFFF}Whisper sent to {FF8000}[ID: %d] {FFFFFF}%s: {FF8000}%s", giveplayerid, giveplayer, (result));
SendClientMessage(playerid, 0xFFFFFFFF, string);
SBizzInfo[1][sbTill] += txtcost / 2;
ExtortionSBiz(1, txtcost / 2);
return 1;
}
}
else
{
format(string, sizeof(string), "That player is not connected", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
if(strcmp(cmd, "/pm", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1){
new id, msg[128],string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "USAGE: /pm [playerid] [message]");
return 1;
}
id = ReturnUser(tmp);
if(!IsPlayerConnected(id)){
SendClientMessage(playerid, -1, "USAGE: /pm [playerid] [message]");
return 1;
}
msg = strtok(cmdtext, idx);
new name[40],sender[40];
GetPlayerName(id, name, sizeof(name));
GetPlayerName(playerid, sender, sizeof(sender));
format(string, sizeof(string), "{FF8000}[ID: %d] {FFFFFF}%s {FF8000}PM: {FFFFFF}%s", playerid, sendername, msg);
SendClientMessage(id, 0xFFFFFFFF, string);
format(string, sizeof(string), "{FFFFFF}PM sent to {FF8000}[ID: %d] {FFFFFF}%s: {FF8000}%s", id, name, msg);
SendClientMessage(playerid, 0xFFFFFFFF, string);
}
return 1;
}