09.08.2012, 13:27
sscanf version to use this on targets :
Though it's buggy. Unreal. I'll make a more accurate one if I have more time.
@Loc, Use IsPlayerInRangeOfPoint(targetid, playerX,playerY,playerZ); to make it RP style.
++++ Use a goddamn variable to avoid problems.
pawn Code:
CMD:cuff(playerid,params[])
{
new targetid, reason;
if(!sscanf(params, "us[40]", targetid, reason))
{
SendClientMessage(targetid, 0xFF0000AA, "* You are now cuffed.");
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_CUFFED);
SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
SendClientMessage(playerid, 0xFF0000, "Target cuffed");
}
else return SendClientMessage(playerid, 0xFF0000AA, "[ERROR]Usage: /cuff [ID] [REASON] ");
return 1;
}
CMD:uncuff(playerid,params[])
{
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR] /uncuff [ID] ");
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(IsPlayerAttachedObjectSlotUsed(targetid, i))
{
SendClientMessage(targetid, 0xF0000AA, "UNCUFFED! ");
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(playerid, i);
}
else return 0;
}
return 1;
}
Though it's buggy. Unreal. I'll make a more accurate one if I have more time.
@Loc, Use IsPlayerInRangeOfPoint(targetid, playerX,playerY,playerZ); to make it RP style.
++++ Use a goddamn variable to avoid problems.