Need help with a command. -
Scriptissue - 04.10.2010
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.
Re: Need help with a command. -
CaptainOwen - 04.10.2010
Just make a /release that teleports and unfreezes the player to the set spawn.
Re: Need help with a command. -
Scriptissue - 04.10.2010
It's complicated but I need the system to jail by time, can you fix the script ?
Re: Need help with a command. -
CaptainOwen - 04.10.2010
Hmmm, I can give it a try. I'm quite new to PAWN but give me a second.
Re: Need help with a command. -
Scriptissue - 04.10.2010
Alright, I'll be waiting.
Re: Need help with a command. -
CaptainOwen - 04.10.2010
Try adding a release time being:
SetTimer.
I'm personally unsure.
Re: Need help with a command. -
samgreen - 04.10.2010
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.
Re: Need help with a command. -
Scriptissue - 04.10.2010
Still doesn't work, when the time is up it doesn't spawn at any place can you help me with that ?
Re: Need help with a command. -
CaptainOwen - 04.10.2010
Perhaps ForceClassSelection?
Re: Need help with a command. -
samgreen - 04.10.2010
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;
}