HOW DO YOU MAKE /DETAIN, /KIDNAP COMMAND
#1

I NEED A /DETAIN AND /KIDNAP COMMAND
Reply
#2

Could you tell what command processor you're using? (dcmd, zcmd, or someother)
Reply
#3

well im using cmd: on all of mine
Reply
#4

pawn Код:
CMD:detain(playerid, params[])
{
    if(IsACop(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            return 1;
        }

        new string[128], giveplayerid, seat;
        if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid 1-3]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(seat < 1 || seat > 3)
            {
                SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
                return 1;
            }
            if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "You can't detain other law enforcement officers.");
                return 1;
            }
            if(IsPlayerInAnyVehicle(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first.");
                return 1;
            }
            if (ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot detain yourself!"); return 1; }
                if(PlayerCuffed[giveplayerid] == 2)
                {
                    new carid = gLastCar[playerid];
                    if(IsSeatAvailable(carid, seat))
                    {
                        new Float:pos[6];
                        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                        GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
                        GetVehiclePos( carid, pos[0], pos[1], pos[2]);
                        if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
                        format(string, sizeof(string), "* You were detained by %s .", GetPlayerNameEx(playerid));
                        SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* You detained %s .", GetPlayerNameEx(giveplayerid));
                        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
                        ClearAnimations(giveplayerid);
                        TogglePlayerControllable(giveplayerid, false);
                        PutPlayerInVehicle(giveplayerid, carid, seat);
                    }
                    else
                    {
                        SendClientMessageEx(playerid, COLOR_GREY, "That seat isn't available!");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_GREY, "That person isn't cuffed.");
                    return 1;
                }
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, " You're not close enough to the player or your car!");
                return 1;
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
            return 1;
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not a Cop!");
    }
    return 1;
}
but you should have IsACop..and all of the player infos
Reply
#5

Quote:
Originally Posted by XK
Посмотреть сообщение
pawn Код:
CMD:detain(playerid, params[])
{
    if(IsACop(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            return 1;
        }

        new string[128], giveplayerid, seat;
        if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid 1-3]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(seat < 1 || seat > 3)
            {
                SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
                return 1;
            }
            if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "You can't detain other law enforcement officers.");
                return 1;
            }
            if(IsPlayerInAnyVehicle(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first.");
                return 1;
            }
            if (ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot detain yourself!"); return 1; }
                if(PlayerCuffed[giveplayerid] == 2)
                {
                    new carid = gLastCar[playerid];
                    if(IsSeatAvailable(carid, seat))
                    {
                        new Float:pos[6];
                        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                        GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
                        GetVehiclePos( carid, pos[0], pos[1], pos[2]);
                        if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
                        format(string, sizeof(string), "* You were detained by %s .", GetPlayerNameEx(playerid));
                        SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* You detained %s .", GetPlayerNameEx(giveplayerid));
                        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
                        ClearAnimations(giveplayerid);
                        TogglePlayerControllable(giveplayerid, false);
                        PutPlayerInVehicle(giveplayerid, carid, seat);
                    }
                    else
                    {
                        SendClientMessageEx(playerid, COLOR_GREY, "That seat isn't available!");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_GREY, "That person isn't cuffed.");
                    return 1;
                }
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, " You're not close enough to the player or your car!");
                return 1;
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
            return 1;
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not a Cop!");
    }
    return 1;
}
but you should have IsACop..and all of the player infos
error 017: undefined symbol "IsACop"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20417) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20422) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(2042 : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20431) : error 017: undefined symbol "gTeam"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20431) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20431) : error 001: expected token: ";", but found "]"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20431) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20431) : fatal error 107: too many error messages on one line
Reply
#6

pawn Код:
CMD:detain(playerid, params[])
{
    if(IsACop(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            return 1;
        }

        new string[128], giveplayerid, seat;
        if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid 1-3]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(seat < 1 || seat > 3)
            {
                SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
                return 1;
            }
            if(IsACop(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "You can't detain other law enforcement officers.");
                return 1;
            }
            if(IsPlayerInAnyVehicle(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first.");
                return 1;
            }
            if (ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot detain yourself!"); return 1; }
                if(PlayerCuffed[giveplayerid] == 2)
                {
                    new carid = gLastCar[playerid];
                    if(IsSeatAvailable(carid, seat))
                    {
                        new Float:pos[6];
                        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                        GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
                        GetVehiclePos( carid, pos[0], pos[1], pos[2]);
                        if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
                        format(string, sizeof(string), "* You were detained by %s .", GetPlayerNameEx(playerid));
                        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* You detained %s .", GetPlayerNameEx(giveplayerid));
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
                        ClearAnimations(giveplayerid);
                        TogglePlayerControllable(giveplayerid, false);
                        PutPlayerInVehicle(giveplayerid, carid, seat);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "That seat isn't available!");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "That person isn't cuffed.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, " You're not close enough to the player or your car!");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not a Cop!");
    }
    return 1;
}
and add this anywhere in your script
pawn Код:
stock IsACop(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new member = PlayerInfo[playerid][pMember];
        if(member == 1)
        {
            return 1;
        }
    }
    return 0;
}
Reply
#7

error 017: undefined symbol "pMember"
error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20435) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20441) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20446) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20451) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20456) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20457) : error 017: undefined symbol "PlayerCuffed"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20457) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20457) : error 001: expected token: ";", but found "]"
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20457) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\cops and robbers - Copy\gamemodes\NVCNR.pwn(20457) : fatal error 107: too many error messages on one line
Reply
#8

man you have to define all of these things,and you have to get cuff system,i cant know what you have in your gamemode,just change the things in the code i gave you and make it as the same as your details,like instead of pMember write the defintion of the faction of the player
and for the SendClientMessageEx,use this:
pawn Код:
CMD:detain(playerid, params[])
{
    if(IsACop(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            return 1;
        }

        new string[128], giveplayerid, seat;
        if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid 1-3]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(seat < 1 || seat > 3)
            {
                SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
                return 1;
            }
            if(IsACop(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "You can't detain other law enforcement officers.");
                return 1;
            }
            if(IsPlayerInAnyVehicle(giveplayerid))
            {
                SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first.");
                return 1;
            }
            if (ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot detain yourself!"); return 1; }
                if(PlayerCuffed[giveplayerid] == 2)
                {
                    new carid = gLastCar[playerid];
                    if(IsSeatAvailable(carid, seat))
                    {
                        new Float:pos[6];
                        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                        GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
                        GetVehiclePos( carid, pos[0], pos[1], pos[2]);
                        if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
                        floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
                        format(string, sizeof(string), "* You were detained by %s .", GetPlayerNameEx(playerid));
                        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* You detained %s .", GetPlayerNameEx(giveplayerid));
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
                        ClearAnimations(giveplayerid);
                        TogglePlayerControllable(giveplayerid, false);
                        PutPlayerInVehicle(giveplayerid, carid, seat);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "That seat isn't available!");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "That person isn't cuffed.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, " You're not close enough to the player or your car!");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not a Cop!");
    }
    return 1;
}
Reply
#9

Please add detain command in .pwn file i uploaded because im new to this i have no clue what defines i should add and things thank u
Reply
#10

plz help i really need help adding commands you can see the nvcnr.zip i uploaded and edit it by adding commands thank u
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)