07.09.2014, 12:43
Hello,
I want to make a [/pm] command for admins & helpers level 1+.
My Player info code :
I want it to be like [/w] command but it be [/pm] and for admins and send the player : PM from Admin %s : Text
And if pm sender is a helper : PM from Helper %s : Text.
[/w] Command :
I want to make a [/pm] command for admins & helpers level 1+.
My Player info code :
Код:
Admin : if (PlayerInfo[playerid][pAdmin] >= 1) Helper: if (PlayerInfo[playerid][pHelper] >= 1)
And if pm sender is a helper : PM from Helper %s : Text.
[/w] Command :
pawn Код:
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;
}