/jail and /unjail script problems -
Zonoya - 21.08.2013
I downloaded a map for a jail island and decided to make a /jail command that tp's the ID specified to that jail, except I had a few issues.
I made the script fine, but this is what I get when I attempt to compile it:
Code:
C:\Users\Keira\Desktop\Simulators\filterscripts\Adminscript.pwn(500) : error 012: invalid function call, not a valid address
C:\Users\Keira\Desktop\Simulators\filterscripts\Adminscript.pwn(500) : warning 215: expression has no effect
C:\Users\Keira\Desktop\Simulators\filterscripts\Adminscript.pwn(500) : error 001: expected token: ";", but found ")"
C:\Users\Keira\Desktop\Simulators\filterscripts\Adminscript.pwn(500) : error 029: invalid expression, assumed zero
C:\Users\Keira\Desktop\Simulators\filterscripts\Adminscript.pwn(500) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
This is the code:
the new declaration for the J Variable.
Code:
//News
new J[MAX_PLAYERS] = 0;
Jail and unjail scripts.
Code:
CMD:jail(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 1336) return 0;
new ID;
new Reason[128];
if(sscanf(params,"us(No Reason)[128]", ID, Reason)) return SendClientMessage(playerid, RED, "USAGE: /jail [id/partofname] [Reason]!");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not online!");
if(IsPlayerNPC(ID)) return SendClientMessage(playerid, RED, "You cant jail NPCs!");
if(J(ID) == 1) return SendClientMessage(playerid, RED, "That player is already jailed!"); // this is Line 500, thus its also going to be repeated on line 521
{
new str[128];
new name[MAX_PLAYER_NAME];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(ID, pname, sizeof(pname));
format(str, sizeof(str), "%s(%d) jailed %s(%d). Reason: %s",name, playerid, pname, ID, Reason);
SetPlayerPos(ID, 594.9167, 4044.4280, 2.5842);
J(ID) = 1;
}
return 1;
}
CMD:unjail(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 1336) return 0;
new ID;
if(sscanf(params,"u", ID)) return SendClientMessage(playerid, RED, "USAGE: /unjail [id/partofname]!");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not online!");
if(IsPlayerNPC(ID)) return SendClientMessage(playerid, RED, "You cant unjail NPCs!");
if(J(ID) == 0) return SendClientMessage(playerid, RED, "That player isn't jailed!"); // Line 521.
{
new str[128];
new name[MAX_PLAYER_NAME];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(ID, pname, sizeof(pname));
format(str, sizeof(str), "%s(%d) unjailed %s(%d)",name, playerid, pname, ID);
SpawnPlayer(ID);
J(ID) = 0;
}
return 1;
}
I've been unable to figure out what's going on, its probably a simple fix, if you amazing contributors could help, it'd be greatly appreciated.
Regards,
Bella.
Re: /jail and /unjail script problems -
Lordzy - 21.08.2013
You've done mistakes in the brackets for the variable "J". Instead of J(ID), it must be J[ID].
pawn Code:
CMD:jail(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 1336) return 0;
new ID;
new Reason[128];
if(sscanf(params,"us(No Reason)[128]", ID, Reason)) return SendClientMessage(playerid, RED, "USAGE: /jail [id/partofname] [Reason]!");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not online!");
if(IsPlayerNPC(ID)) return SendClientMessage(playerid, RED, "You cant jail NPCs!");
if(J[ID] == 1) return SendClientMessage(playerid, RED, "That player is already jailed!"); // this is Line 500, thus its also going to be repeated on line 521
{
new str[128];
new name[MAX_PLAYER_NAME];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(ID, pname, sizeof(pname));
format(str, sizeof(str), "%s(%d) jailed %s(%d). Reason: %s",name, playerid, pname, ID, Reason);
SetPlayerPos(ID, 594.9167, 4044.4280, 2.5842);
J[ID] = 1;
}
return 1;
}
CMD:unjail(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 1336) return 0;
new ID;
if(sscanf(params,"u", ID)) return SendClientMessage(playerid, RED, "USAGE: /unjail [id/partofname]!");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not online!");
if(IsPlayerNPC(ID)) return SendClientMessage(playerid, RED, "You cant unjail NPCs!");
if(J[ID] == 0) return SendClientMessage(playerid, RED, "That player isn't jailed!"); // Line 521.
{
new str[128];
new name[MAX_PLAYER_NAME];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(ID, pname, sizeof(pname));
format(str, sizeof(str), "%s(%d) unjailed %s(%d)",name, playerid, pname, ID);
SpawnPlayer(ID);
J[ID] = 0;
}
return 1;
}
Re: /jail and /unjail script problems -
Zonoya - 21.08.2013
lol thanks, I knew it'd be a noob mistake rofl, that was the one thing I thought it was for a min but forgot to try lol
thanks, +REP