Код:
command(b, playerid, params[])
{
new Message[128], string[128];
if(sscanf(params, "z", Message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /b [message]");
}
else
{
if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
{
return 1;
}
else
{
if(Player[playerid][PrisonID] == 1)
{
SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
}
else
{
format(string, sizeof(string), "%s says: ((%s)) ", GetName(playerid), Message);
NearByMessage(playerid, WHITE, string);
}
}
}
return 1;
}
command(me, playerid, params[]) {
new
string[128]; // Updated this as I forgot about the whole params usage at the time of originally creating this.... but seeing as how noobs constantly rip this command I might as well give them some good code to rip from! (yes I'm talking about you, RealCop228 and all the others)
if(isnull(params)) {
return SendClientMessage(playerid, WHITE, "SYNTAX: /me [action]");
}
else {
if(Player[playerid][PrisonID] == 1) {
SendClientMessage(playerid, WHITE, "You're unable to do this right now!");
}
else {
format(string, sizeof(string), "* %s %s", GetName(playerid), params);
NearByMessage(playerid, NICESKY, string);
Player[playerid][MeActions]++;
switch(Player[playerid][MeActions]) {
case 100: {
SendClientMessage(playerid, WHITE, "You have unlocked a new achievement!");
SendClientMessage(playerid, GREY, "You have executed 100 /me actions.");
Player[playerid][AchievementRank]++;
}
case 200: {
SendClientMessage(playerid, WHITE, "You have unlocked a new achievement!");
SendClientMessage(playerid, GREY, "You have executed 200 /me actions.");
Player[playerid][AchievementRank]++;
}
}
}
}
return 1;
}
command(do, playerid, params[])
{
new Message[128], string[128];
if(sscanf(params, "z", Message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /do [action]");
}
else
{
if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
{
return 1;
}
else
{
format(string, sizeof(string), "* %s ((%s)) ", Message, GetName(playerid));
NearByMessage(playerid, NICESKY, string);
}
}
return 1;
}
command(ooc, playerid, params[])
{
new Message[128], string[128];
if(sscanf(params, "z", Message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /o(oc) [message]");
}
else
{
if(Player[playerid][oMuted] >= 1)
{
SendClientMessage(playerid, WHITE, "You have been muted from the global OOC channel by an administrator.");
}
else
{
if(Player[playerid][AdminDuty] >= 1)
{
format(string, sizeof(string), "((Server Admin %s: %s)) ", GetName(playerid), Message);
SendClientMessageToAll(OOC_CHAT, string);
}
else if(oocenabled == 1 && Player[playerid][Authenticated] >= 1)
{
if(Player[playerid][VipRank] >= 1)
{
format(string, sizeof(string), "((VIP %s: %s)) ", GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
OOCChatLog(string);
}
else
{
if(Player[playerid][PlayingHours] < 1)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank1], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 1 && Player[playerid][PlayingHours] < 25)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank2], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 25 && Player[playerid][PlayingHours] < 100)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank3], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 100 && Player[playerid][PlayingHours] < 300)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank4], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 300)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank5], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
OOCChatLog(string);
}
}
else if(oocenabled == 0)
{
SendClientMessage(playerid, WHITE, "OOC channel is currently disabled.");
}
}
}
return 1;
}
command(pm, playerid, params[])
{
new string[128], message[128], id;
if(sscanf(params, "uz", id, message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /pm [playerid] [message]");
}
else
{
if(IsPlayerConnectedEx(id))
{
if(strlen(message) >= 1)
{
if(Player[id][PMsEnabled] == 1)
{
if(Player[id][AFKStat] == 1)
{
SendClientMessage(playerid, WHITE, "This administrator is away from keyboard, right now.");
}
else
{
format(string, sizeof(string), "((You have sent %s: %s)) ", GetName(id), message);
SendClientMessage(playerid, PLAYERCOM, string);
format(string, sizeof(string), "((PM from %s (ID: %d): %s)) ", GetName(playerid), playerid, message);
SendClientMessage(id, PLAYERCOM, string);
PMsLog(string);
}
}
else
{
SendClientMessage(playerid, WHITE, "That player has disabled PMs!");
}
}
else
{
SendClientMessage(playerid, WHITE, "SYNTAX: /pm [playerid] [message]");
}
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
}
}
return 1;
}