Need help with a command.
#1

So I made this command Ajail, but when I type a time It only jails the player and he is stuck there forever I tired to use variables but still doesn't work.
Here is the whole code:
pawn Код:
CMD:ajail(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF4646FF, "You are not authorized to use that command !");

else
{
new PlayerInfo[MAX_PLAYERS][pInfo];
new Jailed[MAX_PLAYERS];
  new otherId;
  new sendername[MAX_PLAYER_NAME];

  new string[256];
new pID, GivenName[MAX_PLAYER_NAME];


  if(sscanf(params, "u", otherId,Jailed)) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /ajail [PlayerID/PartOfName] [Time(minutes)] [Reason]");
 GetPlayerName(pID, GivenName, sizeof(GivenName));
  format(string, sizeof(string), "* You Jailed %s.", GivenName);
  SendClientMessage(playerid, COLOR_LIGHTRED, string);
 if(otherId == INVALID_PLAYER_ID) return SendClientMessage(otherId, 0xAFAFAFAA, "Invalid Player ID");
   {
Jailed[otherId] = 1;
PlayerInfo[otherId][pJailTime] = 1;
new Float:x, Float:y, Float:z;
GetPlayerPos(otherId, x, y, z);
SetPlayerPos(otherId,1769.37341309,178.79183960,1369.28161621);



GetPlayerName(playerid, sendername, sizeof(sendername)); // This is for admin name
format(string, sizeof(string), "* You have been Admin jailed by Admin %s ", sendername );
                SendClientMessage(playerid, 0xFF4646FF, string);

}

        }
    return 1;
}
this is at the top.
pawn Код:
enum pInfo
{

    pJailTime};
Reply
#2

Just make a /release that teleports and unfreezes the player to the set spawn.
Reply
#3

It's complicated but I need the system to jail by time, can you fix the script ?
Reply
#4

Hmmm, I can give it a try. I'm quite new to PAWN but give me a second.
Reply
#5

Alright, I'll be waiting.
Reply
#6

Try adding a release time being:

SetTimer.
I'm personally unsure.
Reply
#7

This script was a mess, I cleaned up what I could and put it on pastebin. Review my comments and make the changes, then get back to us with your results.
Reply
#8

Still doesn't work, when the time is up it doesn't spawn at any place can you help me with that ?
Reply
#9

Perhaps ForceClassSelection?
Reply
#10

Try this:

pawn Код:
// Add this line to the command
SetTimerEx("UnjailPlayer", jailTime * 1000, false, "d", otherId);

forward UnjailPlayer(playerid);
public UnjailPlayer(playerid) {
    // Change these coordinates to where the player goes after the jail sentence
    SetPlayerPos(otherid, 0, 0, 0);
    // Reset their jailed variables
    Jailed[otherId] = 0;
    PlayerInfo[otherId][pJailTime] = 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)