commands will work only with player whose id is 0
#1

This is a code
Код:
CMD:ant(playerid, params[])
{	if(Policininkas[playerid] == false) return SendClientMessage(playerid,0x33CCFFAA, "Tokios komandos nera!");
    new targetid;//this defines the id of the player you want to cuff((playerid id your id and the target id that I defined it the id of the player you want to cuff))
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[Naudojimas]: /ant [V_P/ID]");
    if(IsPlayerConnected(targetid))//this will check that if the player you want to cuff is connected to the server or not.
        {
            new Float:x, Float:y, Float:z;//these are the defines of your x,y and z position.
               GetPlayerPos(playerid, x, y, z);//this will store your position to be used in the following codes.((this stores the your x,y, and z position in to the variables we created.))
               if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))//this will check that if the player you want to cuff is near you or not.
                   {
                    new str[512];//this it the define for the string you will format further.((str means string.You can also change it to string but this seems to be easy.))
                      new name[MAX_PLAYER_NAME];//this is the variable you created to store the your name.
                    GetPlayerName(playerid, name, sizeof(name));//this will get your name and store it in the variable you defines as name.
                    new target[MAX_PLAYER_NAME];//this is the variable you created to store the name of the player you want to cuff.
                       GetPlayerName(targetid, target, sizeof(target));//this will get the name of the person you want to cuff and will store it into a variable we defined as target.
                       format(str, sizeof(str), "Tu surakinai %s!",target);//explained at the end of the tutorial.
                       new id = GetPlayeridMid(name);
                       SendClientMessage(playerid, 0xE01B1B, str);//this will send the formated message to you that you created before.
                       format(str, sizeof(str), "POLICIJA: Tave surakino %s!",name);//explained at the end of the tutorial.
                       SendClientMessage(targetid, 0xE01B1B, str);//this will send the formated message to the player you cuffed.
                       TogglePlayerControllable(targetid,false);
                    SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);//this will set the object cuffs at the hand of the player you want to cuff.
                      SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);//this will set players hand backwards.
                      return 1;
                }

        }
    return 1;
}

CMD:atr(playerid, params[])//sfcs cmd.
{
if(Policininkas[playerid] == false) return SendClientMessage(playerid,0x33CCFFAA, "Tokios komandos nera!");
        new targetid;//this defines the id of the player you want to cuff((playerid id your id and the target id that I defined it the id of the player you want to cuff))
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[Naudojimas]: /atr [V_P/ID]");
        if(IsPlayerConnected(targetid))//this will check that if the player you want to cuff is connected to the server or not.
        {
            new Float:x, Float:y, Float:z;//these are the defines of your x,y and z position.
               GetPlayerPos(playerid, x, y, z);//this will store your position to be used in the following codes.((this stores the your x,y, and z position in to the variables we created.))
               if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))//this will check that if the player you want to cuff is near you or not.
                   {
                    if(!SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000))return SendClientMessage(playerid,-1," Zaidejas nesurakintas!");//this will check that if the player is not cuffed and you are trying to apply this cmd,this will send him a error message.
                      SetPlayerSpecialAction(targetid,SPECIAL_ACTION_NONE);//this will remove the players cuffs and his arms will go normal.
                      RemovePlayerAttachedObject(targetid,0);
                    new str[512];//this it the define for the string you will format further.((str means string.You can also change it to string but this seems to be easy.))
                      new name[MAX_PLAYER_NAME];//this is the variable you created to store the your name.
                    GetPlayerName(playerid, name, sizeof(name));//this will get your name and store it in the variable you defines as name.
                    new target[MAX_PLAYER_NAME];//this is the variable you created to store the name of the player you want to cuff.
                       GetPlayerName(targetid, target, sizeof(target));//this will get the name of the person you want to cuff and will store it into a variable we defined as target.
                        new id = GetPlayeridMid(name);
                       format(str, sizeof(str), "Tu atrakinai %s!",target);//explained at the end of the tutorial.
                       TogglePlayerControllable(targetid,true);
                       SendClientMessage(playerid, 0xE01B1B, str);//will send the formated message to you that you created above.
                       format(str, sizeof(str), " Jus atrakino %s!",name);//explained bellow.
                       SendClientMessage(targetid, 0xE01B1B, str);//will send the formated message to the player you want to cuff that you created above.
                      return 1;
                }

        }
        return 1;
}
i want to those commands work on all player ids i want
Reply
#2

Update your sscanf plugin.
Reply
#3

To download Sscanf download here
https://sampforum.blast.hk/showthread.php?tid=570927
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)