Cuffing bug 0.3e
#1

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(cmdtextidx);
                if(!
strlen(tmp)){
                    
SendClientUsage(playeridcmd"[Name/ID]");
                    return 
1;
                }
                if(!
IsNumeric(tmp) && (PlayerID(tmp)==-|| PlayerID(tmp)==-1))
                {
                       
SendClientError(playerid,   "Not found. Invalid part of name or more than one result");
                    return 
1;
                }
                if(!
IsNumeric(tmp) && PlayerID(tmp)>=0giveplayerid 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]==1myStrcpy(sender,"Stranger");
                    if(
PlayerInfo[playerid][playerteam]==SASFformat(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(giveplayeridSPECIAL_ACTION_CUFFED);
                     
SetPlayerAttachedObject(giveplayerid0194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.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
Reply
#2

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.
Reply
#3

Holy shiet, thanks men.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)