21.07.2012, 13:34
pawn Код:
#include <sscanf2>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(cuff,4,cmdtext);
return 0;
}
dcmd_cuff(playerid,params[])
{
new targetid;
if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff <playerid>");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Invalid ID.");
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(targetid, 10.0, x, y, z))
{
new metin[512];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new target[MAX_PLAYER_NAME];
GetPlayerName(targetid, target, sizeof(target));
format(metin, sizeof(metin), "INFO: You have cuffed %s!",target);
SendClientMessage(playerid, COLOR_WHITE, metin);
format(metin, sizeof(metin), "WARNING: You have been cuffed by %s!",name);
SendClientMessage(targetid, COLOR_WHITE, metin);
SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);
SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
return 1;
}
if(!IsPlayerInRangeOfPoint(targetid, 10.0, x, y, z))
{
SendClientMessage(playerid,-1,"ERROR: The player that you have tried to cuff him is away from you.");
return 1;
}
}
return 1;
}