10.02.2018, 09:00
*Features:
This system contain, 4 commands, are the following:
-/w (/whisper).
-/cw (whispering inside a car).
-/wspy (spying whisper messages).
-/cwspy (spying car whisper)
*Includes used:
-a_samp...
-Zeex command processor.
-sscanf2
Source:
Includes:
Variables:
some optimization under public OnPlayerConnect(playerid) callback:
Also under public OnPlayerSpawn(playerid):
/*Car Whisper Code:*/
/*Note: you can replaceIsPlayerAdmin(playerid) with your own administrator's system variable.*/
/* Car Whisper Spying */
/* Whisper */
/* Whisper spy */
*Whole source code:
If you find anything strange feel free to remind me!
This system contain, 4 commands, are the following:
-/w (/whisper).
-/cw (whispering inside a car).
-/wspy (spying whisper messages).
-/cwspy (spying car whisper)
*Includes used:
-a_samp...
-Zeex command processor.
-sscanf2
Source:
Includes:
PHP код:
//===Includes===//
#include <a_samp>
#include <zcmd>
#include <sscanf2>
//-------------//
PHP код:
//===Variables===//
new wspy[MAX_PLAYERS];
new cwspy[MAX_PLAYERS];
new pmspy[MAX_PLAYERS];
new IsSpawned[MAX_PLAYERS];
//=================//
PHP код:
public OnPlayerConnect(playerid)
{
IsSpawned[playerid] = 0;
wspy[playerid] = 0;
cwspy[playerid] = 0;
pmspy[playerid] = 0;
return 1;
}
PHP код:
public OnPlayerSpawn(playerid)
{
IsSpawned[playerid] = 1;
return 1;
}
PHP код:
CMD:cw(playerid, params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
new string[250], textes[120], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof(name));
if (sscanf(params, "s[250]", string))
{
SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {f48006}/cw <message>");
}
else
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleID = GetPlayerVehicleID(playerid);
new string2[250];
format(string2, sizeof(string2), "{adf407}[Car Whisper] {FFFFFF}%s(%i): {adf407}%s",name, playerid, string);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicleID))
{
SendClientMessage(i, -1, string2);
}
}
}
else
{
SendClientMessage(playerid,0xf8f8f8fff, "ERROR: {F00f00}You are not in a vehicle.");
}
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(playerid))
{
if (IsPlayerAdmin(i))
{
if (cwspy[i])
{
new cwtext[200];
format(cwtext, sizeof(cwtext), "{f00f00}[Car Whisper SPY]>> %s: %s",name, string, textes);
SendClientMessage(i, -1, cwtext);
}
}
}
}
}
}
return 1;
}
/* Car Whisper Spying */
PHP код:
CMD:cwspy(playerid, params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
if (cwspy[playerid])
{
cwspy[playerid] = false;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {f41f07}You are not spying on car whisper.");
}
else
{
cwspy[playerid] = true;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {adf407}You are now spying on car whisper.");
}
}
}
return 1;
}
PHP код:
CMD:w(playerid, params[])
{
new string[250];
new nameplaya[MAX_PLAYER_NAME];
new textes2[120];
GetPlayerName(playerid, nameplaya,sizeof(nameplaya));
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
if (sscanf(params, "s[250]", string))
{
SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {f48006}/(w)hisper <message>");
}
else
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
new string2[250];
format(string2, sizeof(string2), "{f47e07}[WHISPER] {FFFFFF}%s(%i): {f47e07}%s",nameplaya, playerid, string);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 15.0, x, y, z))
{
SendClientMessage(i, -1, string2);
PlayerPlaySound(i, 1085,0.0,0.0,0.0);
}
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i))
{
if (wspy[i])
{
new wtext[200];
format(wtext, sizeof(wtext), "{f904e9}[WHISPER SPY]> {FFFFFF}%s: %s",nameplaya, string, textes2);
SendClientMessage(i, -1, wtext);
}
}
}
}
}
return 1;
}
PHP код:
COMMAND:wspy(playerid, params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
if (wspy[playerid])
{
wspy[playerid] = false;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {f41f07}You are no longer spying on WHISPERS.");
}
else
{
wspy[playerid] = true;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {a1f406}You are now spying on WHISPERS.");
}
}
}
return 1;
}
PHP код:
//Whisper, Car Whsiper simple systems, with some administration control.
//Made by RxErT
//===Includes===//
#include <a_samp>
#include <zcmd>
#include <sscanf2>
//-------------//
//===Variables===//
new wspy[MAX_PLAYERS];
new cwspy[MAX_PLAYERS];
new pmspy[MAX_PLAYERS];
new IsSpawned[MAX_PLAYERS];
//=================//
public OnPlayerConnect(playerid)
{
IsSpawned[playerid] = 0;
wspy[playerid] = 0;
cwspy[playerid] = 0;
pmspy[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
IsSpawned[playerid] = 1;
return 1;
}
/*Car Whisper*/
CMD:cw(playerid, params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
new string[250], textes[120], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof(name));
if (sscanf(params, "s[250]", string))
{
SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {f48006}/cw <message>");
}
else
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleID = GetPlayerVehicleID(playerid);
new string2[250];
format(string2, sizeof(string2), "{adf407}[Car Whisper] {FFFFFF}%s(%i): {adf407}%s",name, playerid, string);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicleID))
{
SendClientMessage(i, -1, string2);
}
}
}
else
{
SendClientMessage(playerid,0xf8f8f8fff, "ERROR: {F00f00}You are not in a vehicle.");
}
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(playerid))
{
if (IsPlayerAdmin(i))
{
if (cwspy[i])
{
new cwtext[200];
format(cwtext, sizeof(cwtext), "{f00f00}[Car Whisper SPY]>> %s: %s",name, string, textes);
SendClientMessage(i, -1, cwtext);
}
}
}
}
}
}
return 1;
}
/* Car Whisper Spying */
CMD:cwspy(playerid, params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
if (cwspy[playerid])
{
cwspy[playerid] = false;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {f41f07}You are not spying on car whisper.");
}
else
{
cwspy[playerid] = true;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {adf407}You are now spying on car whisper.");
}
}
}
return 1;
}
/*Done*/
/* Whisper */
CMD:w(playerid, params[])
{
new string[250];
new nameplaya[MAX_PLAYER_NAME];
new textes2[120];
GetPlayerName(playerid, nameplaya,sizeof(nameplaya));
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
if (sscanf(params, "s[250]", string))
{
SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {f48006}/(w)hisper <message>");
}
else
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
new string2[250];
format(string2, sizeof(string2), "{f47e07}[WHISPER] {FFFFFF}%s(%i): {f47e07}%s",nameplaya, playerid, string);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 15.0, x, y, z))
{
SendClientMessage(i, -1, string2);
PlayerPlaySound(i, 1085,0.0,0.0,0.0);
}
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i))
{
if (wspy[i])
{
new wtext[200];
format(wtext, sizeof(wtext), "{f904e9}[WHISPER SPY]> {FFFFFF}%s: %s",nameplaya, string, textes2);
SendClientMessage(i, -1, wtext);
}
}
}
}
}
return 1;
}
/* Whisper spy */
COMMAND:wspy(playerid, params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {f00f00}You should be spawned first!");
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
if (wspy[playerid])
{
wspy[playerid] = false;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {f41f07}You are no longer spying on WHISPERS.");
}
else
{
wspy[playerid] = true;
SendClientMessage(playerid, 0xf8f8f8fff, "[SERVER] {a1f406}You are now spying on WHISPERS.");
}
}
}
return 1;
}
/* Done */