24.07.2015, 23:46
Use my code.
Please REP+1 me.
PHP код:
CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pModerator] >= 1)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [playerid/partofname]");
if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
{
SendClientMessage(playerid,COLOR_WHITE, "You can't slap a higher admin.");
return 1;
}
new
Float:shealth;
if(IsPlayerConnected(giveplayerid)) {
GetPlayerHealth(giveplayerid, shealth);
SetPlayerHealth(giveplayerid, shealth-5);
GetPlayerPos(giveplayerid, PlayerInfo[giveplayerid][pPos_x], PlayerInfo[giveplayerid][pPos_y], PlayerInfo[giveplayerid][pPos_z]);
SetPlayerPos(giveplayerid, PlayerInfo[giveplayerid][pPos_x], PlayerInfo[giveplayerid][pPos_y], PlayerInfo[giveplayerid][pPos_z]+5);
PlayerPlaySound(giveplayerid, 1130, PlayerInfo[giveplayerid][pPos_x], PlayerInfo[giveplayerid][pPos_y], PlayerInfo[giveplayerid][pPos_z]+5);
format(string, sizeof(string), "AdmCmd: %s was slapped by %s",GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;
}