CMD
lap(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >=2)
{
new string[128], giveplayerid;
if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");
new Float
health;
new Float
lx, Float
ly, Float
lz;
if(IsPlayerConnected(giveplayerid))
{
GetPlayerHealth(giveplayerid, shealth);
SetPlayerHealth(giveplayerid, shealth-5);
GetPlayerPos(giveplayerid, slx, sly, slz);
SetPlayerPos(giveplayerid, slx, sly, slz+5);
PlayerPlaySound(giveplayerid, 1130, slx, sly, slz+5);
format(string, sizeof(string), "AdmCmd: %s was slapped by %s",GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
CMD
pec(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}
new tmp[32];
if(sscanf(params, "s[32]", tmp)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /spec (playerid/off)");
if(strcmp("off", tmp, true, strlen(tmp)) == 0)
{
if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 1)
{
GettingSpectated[Spectate[playerid]] = 999;
Spectating[playerid] = 0;
Spectate[playerid] = 999;
SetPVarInt(playerid, "SpecState", -1);
SetPVarInt(playerid, "SpecOff", 1 );
TogglePlayerSpectating( playerid, false );
TogglePlayerBurning(playerid, false);
SetCameraBehindPlayer(playerid);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not spectating anyone.");
return 1;
}
}
new giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new string[128];
if( InsideTut[giveplayerid] >= 1 )
{
SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: This player is in the tutorial. Please consider this before assuming that they're air-breaking.");
}
if(GetPVarInt(giveplayerid, "IsInArena") >= 0) SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: This player is in paintball. Ensure they haven't stepped out of the boundaries before assuming they are airbreaking.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin]) { format(string, sizeof(string), "NOTE: A lower level administrator (%s) is now spectating you.", GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_WHITE, string); }
if(Spectating[playerid] == 0)
{
new Float: pPositions[ 3 ];
GetPlayerPos(playerid, pPositions[ 0 ], pPositions[ 1 ], pPositions[ 2 ]);
SetPVarFloat(playerid, "SpecPosX", pPositions[ 0 ]);
SetPVarFloat(playerid, "SpecPosY", pPositions[ 1 ]);
SetPVarFloat(playerid, "SpecPosZ", pPositions[ 2 ]);
SetPVarInt(playerid, "SpecInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "SpecVW", GetPlayerVirtualWorld(playerid));
//SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( giveplayerid );
PlayerSpectateVehicle( playerid, carid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
SendClientMessageEx(playerid, COLOR_GRAD3, "HINT: Type /showcmds to see what the player is typing");
}
else
{
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( giveplayerid );
PlayerSpectateVehicle( playerid, carid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[Spectate[playerid]] = 999;
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
}
format(STRING, "%s spectated %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
Log("logs/spec.log", string);
}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "Target is not available.");
}
return 1;
}
This code will help you .