CMD:Detain Help
#1

pawn Код:
if(strcmp(cmd, "/detain", true) == 0)
    new seat;
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid) || IsAFreecop(playerid))
            {
            tmp = strtok(cmdtext, idx, seat);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /detain [playerid/PartOfName] [seatid]");
                return 1;
            }
            if(seat < 1 || seat > 3)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
                return 1;
            }
            if(PlayerInfo[playerid][pDBanned] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
                return 1;
            }
            new newcar = gLastCar[playerid];
            new playa;
            playa = ReturnUser(tmp);
            if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        if(PlayerCuffed[giveplayerid] = 1)
                            {
                                new Float:x, Float:y, Float:z;
                                GetPlayerPos(playa,x,y,z);
                                if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                                    {
                                        PutPlayerInVehicle(playa, newcar, seat);
                                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                                        format(string, sizeof(string), "* %s throws %s in the vehicle.", sendername ,giveplayer);
                                        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                                        new y1, m, d;
                                        new h,mi,s;
                                        getdate(y1,m,d);
                                        gettime(h,mi,s);
                                        TogglePlayerControllable(giveplayerid, 0);
                                        GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
                                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /detain %s",d,m,y1,h,mi,s,sendername,giveplayer);
                                        CommandLog(string);
                                    }
                                else
                                {
                                    SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
                                }
                        }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "Player isn't cuffed.");
                    }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
            }
        }
        else
        {
                SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
                return 1;
            }
            }
        return 1;
    }
Can someone please correct this?

Thanks
Reply
#2

PHP код:
if (strcmp(cmd"/detain"true) == 0)
{
    new 
seat;
    
    {
        if (
IsPlayerConnected(playerid))
        {
            if (
IsACop(playerid) || IsAFreecop(playerid))
            {
                
tmp strtok(cmdtextidxseat);
                if (!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /detain [playerid/PartOfName] [seatid]");
                    return 
1;
                }
                
                if (
seat &lt|| seat &gt3)
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"The seat ID cannot be above 3 or below 1.");
                    return 
1;
                }
                
                if (
PlayerInfo[playerid][pDBanned] == 1)
                {
                    
SendClientMessage(playeridCOLOR_GREY"** You are Banned From Cop Duty!");
                    return 
1;
                }
                
                new 
newcar gLastCar[playerid];
                new 
playa;
                
playa ReturnUser(tmp);
                if (
IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar))
                {
                    if (
IsPlayerConnected(playa))
                    {
                        if (
playa != INVALID_PLAYER_ID)
                        {
                            if (
PlayerCuffed[giveplayerid] = 1)
                            {
                                new 
Float:xFloat:yFloat:z;
                                
GetPlayerPos(playaxyz);
                                if (
IsPlayerInRangeOfPoint(playerid5xyz))
                                {
                                    
PutPlayerInVehicle(playanewcarseat);
                                    
GetPlayerName(playagiveplayersizeof(giveplayer));
                                    
format(stringsizeof(string), "* %s throws %s in the vehicle."sendernamegiveplayer);
                                    
ProxDetector(30.0playeridstringCOLOR_CHAT1COLOR_CHAT2COLOR_CHAT3COLOR_CHAT4COLOR_CHAT5);
                                    new 
y1md;
                                    new 
hmis;
                                    
getdate(y1md);
                                    
gettime(hmis);
                                    
TogglePlayerControllable(giveplayerid0);
                                    
GameTextForPlayer(giveplayerid"~r~Detained"25003);
                                    
format(stringsizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -&gt; /detain %s"dmy1hmissendernamegiveplayer);
                                    
CommandLog(string);
                                }
                                else
                                {
                                    
SendClientMessage(playeridCOLOR_GREY"Player is not near you.");
                                }
                                
                            }
                            else
                            {
                                
SendClientMessage(playeridCOLOR_GREY"Player isn't cuffed.");
                            }
                            
                        }
                        
                    }
                    
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"You are not in police vehicle!");
                }
                
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"You are not a cop!");
                return 
1;
            }
            
        }
        
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)