Cuffing bug 0.3e - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cuffing bug 0.3e (
/showthread.php?tid=344284)
Cuffing bug 0.3e -
AlexTm - 20.05.2012
PHP код:
if(strcmp(cmd, "/cuff",true)==0)
{
new tmp[256];
new message[MAX_STRING];
if(PlayerInfo[playerid][power] >= 10 || PlayerInfo[playerid][playerteam]==SASF || PlayerInfo[playerid][playerteam]==COPS || PlayerInfo[playerid][playerteam]==FBI)
{
//{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientUsage(playerid, cmd, "[Name/ID]");
return 1;
}
if(!IsNumeric(tmp) && (PlayerID(tmp)==-2 || PlayerID(tmp)==-1))
{
SendClientError(playerid, "Not found. Invalid part of name or more than one result");
return 1;
}
if(!IsNumeric(tmp) && PlayerID(tmp)>=0) giveplayerid = PlayerID(tmp);
if(IsNumeric(tmp)) giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid))
{
SendClientError(playerid, "Not found.");
return 1;
}
if(giveplayerid==playerid)
{
SendClientError(playerid, "You can't cuff yourself!");
return 1;
}
if(Ptazed(giveplayerid)=1))
{
new sender[MAX_STRING];
if(PlayerTemp[playerid][hname]==1) myStrcpy(sender,"Stranger");
if(PlayerInfo[playerid][playerteam]==SASF) format(message,sizeof(message),"%s cuffed %s",sender,PlayerName(giveplayerid));
else format(message,sizeof(message),"%s cuffed %s",sender,PlayerName(giveplayerid));
NearMessage(playerid,message,COLOR_ME);
cuffed[giveplayerid]=1;
tazed[giveplayerid]=0;
SetPlayerHealth(giveplayerid,50);
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
SetPlayerAttachedObject(giveplayerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
InfoText(giveplayerid,"You have been cuffed",5);
}
else SendClientError(playerid, "The player isn't in your vehicle");
}
return 1;
so, I have a problem with this script, with the "If Ptazed" and I can cuff the player everywhere I want to. I would like to do it that if the player is tazed (PTazed,SPECIAL_ACTION_HANDSUP) on the tazed command. Or that when he is in range.
+rep given to the answer
Re: Cuffing bug 0.3e -
[FMJ]PowerSurge - 20.05.2012
Squeeze a 'if(ProxDetectorS(5.0, playerid, giveplayerid))' in there somewhere :3
From my script, you should be able to work it out yourself.
pawn Код:
if(ProxDetectorS(5.0, playerid, give))
{
if(GetPlayerSpecialAction(give) == SPECIAL_ACTION_HANDSUP && PlayerInfo[give][pCuffed] == 0)
{
pawn Код:
stock ProxDetectorS(Float:radi, playerid, targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
GetPlayerPos(targetid, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
ProxDetectorS returns 1 if the player is in within
radi (5.0 in my example), or 0 if not.
Re: Cuffing bug 0.3e -
AlexTm - 20.05.2012
Holy shiet, thanks men.