30.01.2014, 12:23
pawn Код:
public OnPlayerText(playerid, text[])
{
new sendername[24];
GetPlayerName(playerid, sendername 24);
if(IsShmlPil[playerid] != 0) //or whatever the default is
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{//loop thru all players
if(!IsPlayerConnected(i))
continue;
if(IsInShml[i] != IsShmlPil[playerid])
continue;
//exclude those who are disconnected OR not a passanger in the pilot's shamal
if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
{
format(string, sizeof(string), "{157DEC}(IC){FFFFFF} %s Says: %s", sendername, text);
SetPlayerChatBubble(playerid, string, COLOR_WHITE, 8.5, 8000);
format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Local): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
ChatLog(string);
format(string, sizeof(string), "Pilot: %s Says: %s", sendername, text);
SCM(i, 0xD7DFF3AA, string);
}
else if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 1)
{
format(string, sizeof(string), "{157DEC}(IC){FFFFFF} Stranger Says: %s", text);
SetPlayerChatBubble(playerid, string, COLOR_WHITE, 8.5, 8000);
format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Local Masked): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
ChatLog(string);
format(string, sizeof(string), "Pilot: Stranger Says: %s", text);
SCM(i, 0xD7DFF3AA, string);
}
else if(PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pMaskuse] == 0)
{
format(string, sizeof(string), "{157DEC}(A){FFFFFF} Admin Says: %s", text);
SetPlayerChatBubble(playerid, string, COLOR_NICERED, 8.5, 8000);
format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Local Admin): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
ChatLog(string);
format(string, sizeof(string), "Pilot: Admin %s Says: %s",sendername, text);
SCM(i, 0xD7DFF3AA, string);
}
}
}
if(IsInShml[playerid] != 0) // or whatever the default is
{//the following code should run if the player IS in any shamal AS passanger.
for(new i = 0; i < MAX_PLAYERS; i ++)
{//loop thru all players
if(!IsPlayerConnected(i))
continue;
if(IsInShml[i] != IsInShml[playerid] && IsShmlPilot[i] != IsInShml[playerid])
continue;
//exclude disconnected and/or those who are NOT in the small or IS NOT the shamal pilot.
if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
{
format(string, sizeof(string), "Passenger %s Says: %s", sendername, text);
SCM(i, 0xD7DFF3AA, string);
ChatLog(string);
}
else if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 1)
{
format(string, sizeof(string), "Passenger Stranger Says: %s", text);
SCM(i, 0xD7DFF3AA, string);
ChatLog(string);
}
else if(PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pMaskuse] == 0)
{
format(string, sizeof(string), "Passenger Admin %s Says: %s",sendername, text);
SCM(i, 0xD7DFF3AA, string);
ChatLog(string);
}
}
}
return 0;
}
GetVehicleModel/ID would be useless here since those who are passangers (of the shamal) ARE NOT in any vehicle, you have to use your custom defined variables instead. This works like this because the shamal does not allow passangers and while you're inside a shamal interior, you're not in a vehicle id according the game.
If the player is a pilot, then check which players are in the pilot's shamal and send the message as pilot.
If the player is IN a shamal, then check which players are also inside that shamal including the pilot and send the message as passanger.
Also logging would not work properly, I fixed them; you have to change the order of functions.