SA-MP Forums Archive
/makeleader [id] [faction name] | /jail command - 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: /makeleader [id] [faction name] | /jail command (/showthread.php?tid=263632)



/makeleader [id] [faction name] | /jail command - DaRealz - 22.06.2011

Im trying to make a command "/makeleader [playername/id] [factionname/number].
Im currently using a filterscript titled "Job filterscript." I took out the weed one though...
now i want to make it so i do /makeleader [playername/id] [factionname/number] and then it makes that player the faction. Its just that, in this it has Swat[playerid] = 1; Cop[playerid] = 1; Etc. and i dont know how to do it. If someone could help me it would be appreciated.

PS: My spelling/grammar sucks.
PSS: Im new to scripting.... so... and i wanted to make a simple rp script, as im just beggining.

EDIT: also, im wondering how do i edit the /jail command. This is the command:
pawn Код:
dcmd_jail(playerid, params[])
{
    if (strlen(params))
    {
        new time;
        id = strval(params[0]);
        time = strval(params[1]);
        if (IsPlayerConnected(id))
        {
            if(Army[playerid] == 1 || Swat[playerid] == 1 || Cop[playerid] == 1 || Ss[playerid] == 1)
            {
                new Float:x;
                new Float:y;
                new Float:z;
                new string[265];
                GetPlayerPos(playerid,Float:x,Float:y,Float:z);
                SetPlayerPos(id,Float:x,Float:y,Float:z);
                SetTimer("jail",time+000,0);
                format(string,sizeof(string),"Jail:You got jailed for %s ",time);
                SendClientMessage(id,0x00FF00AA,string);
            }
            else
            {
                SendClientMessage(playerid,0xFF0000AA,"You dont have permission for this commands");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: /jail <playerid> <seconds>");
    }
    return 1;
}
But it will just instantly put them in jail (i think) and im wondering how do i edit it so you have to be close to the player, and to the a certain spot?


Re: /makeleader [id] [faction name] | /jail command - ZBits - 06.07.2012

i think use
if(IsPlayerInRangeOfPoint(playerid,,7.0,PosX,PosY, PosZ)
{
//your code
}
else
{
//your code
}
return 1:
}

NOTE: I am not sire if it will work for you


Re: /makeleader [id] [faction name] | /jail command - SnG.Scot_MisCuDI - 06.07.2012

pawn Код:
dcmd_jail(playerid, params[])
{
    if (strlen(params))
    {
        new time,
            Pos[3];
        id = strval(params[0]);
        time = strval(params[1]);
        GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
        if (IsPlayerConnected(id))
        {
            if(Army[playerid] == 1 || Swat[playerid] == 1 || Cop[playerid] == 1 || Ss[playerid] == 1) && if(IsPlayerInRangeOfPoint(playerid,7.0,Pos[0], Pos[1], Pos[2])
            {
                new string[265];
                GetPlayerPos(playerid,Pos[0], Pos[1], Pos[2]);
                SetPlayerPos(id,Pos[0], Pos[1], Pos[2]);
                SetTimer("jail",time+000,0);
                format(string,sizeof(string),"Jail:You got jailed for %s ",time);
                SendClientMessage(id,0x00FF00AA,string);
            }
            else
            {
                SendClientMessage(playerid,0xFF0000AA,"You dont have permission for this commands");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: /jail <playerid> <seconds>");
    }
    return 1;
}
Now the player using the /jail command has to be within 7(meters?) of the player.