C:\Documents and Settings\Administrator\My Documents\New Folder (2)\gamemodes\DRP.pwn(15833) : error 033: array must be indexed (variable "playerb") C:\Documents and Settings\Administrator\My Documents\New Folder (2)\gamemodes\DRP.pwn(15835) : error 033: array must be indexed (variable "playerb") C:\Documents and Settings\Administrator\My Documents\New Folder (2)\gamemodes\DRP.pwn(15836) : error 033: array must be indexed (variable "playerb") C:\Documents and Settings\Administrator\My Documents\New Folder (2)\gamemodes\DRP.pwn(15838) : error 035: argument type mismatch (argument 1) C:\Documents and Settings\Administrator\My Documents\New Folder (2)\gamemodes\DRP.pwn(15839) : error 035: argument type mismatch (argument 1) C:\Documents and Settings\Administrator\My Documents\New Folder (2)\gamemodes\DRP.pwn(15840) : error 033: array must be indexed (variable "playerb") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors.
CMD:jailaccount(playerid, params[])
{
new playerb[32], string[128], file[32], time, RandomCell;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "uis[64]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jailaccount [playername] [time] [reason]");
format(file, sizeof(file), "users/%s.ini", playerb);
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
if(time > 0)
{
PlayerInfo[playerb][pPrison] = 3;
PlayerInfo[playerb][pPrisonTime] = time*60;
format(PlayerInfo[playerb][pPrisonReason], 64, "%s", params);
format(PlayerInfo[playerb][pPrisonBy], 32, "%s", RPN(playerid));
RandomCell = random(sizeof(RandomCells));
SetPlayerFacingAngle(playerb, RandomCells[RandomCell][3]);
SetPlayerPos(playerb, RandomCells[RandomCell][0], RandomCells[RandomCell][1], RandomCells[RandomCell][2]);
format(string, sizeof(string), "AdmCmd: %s has been offline-ajailed for %d minute(s) by %s, reason: %s", playerb, PlayerInfo[playerb][pPrisonTime]/60, RPN(playerid), params);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
return 1;
}
new playerb[MAX_PLAYERS];
//or
enum pInfo
{
playerb
};
new PlayerInfo[MAX_PLAYERS][pInfo];
PHP код:
|
CMD:jailaccount(playerid, params[])
{
new playerb[32], string[128], file[35], time, reason[64];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "sis[64]", playerb, time, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jailaccount [playername] [time] [reason]");
format(file, sizeof(file), "users/%s.ini", playerb);
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
if(time > 0)
{
//Save pPrison to the user's file
//save the jail time to the user's file
//Save the reason to the user's file
//save prisonby to the user's file
new RandomCell = random(sizeof(RandomCells));
//Save player angle to the users file
//Save the player pos to the user's file
format(string, sizeof(string), "AdmCmd: %s has been offline-ajailed for %d minute(s) by %s, reason: %s", playerb, PlayerInfo[playerb][pPrisonTime]/60, RPN(playerid), params);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
//After loading all the user stats
if(PlayerInfo[playerid][pPrison] == 3) //Or whatever you use to determine if they're jailed
{
SetPlayerPos(playerid... //to the position saved in their file
SetPlayerFacingAngle(playerid... //to the angle saved in their file
}
return 1;
}
error 033: array must be indexed (variable "playerb")
Код:
error 033: array must be indexed (variable "playerb") |
PlayerInfo[playerb][pPrison]
new PlayerInfo[MAX_PLAYERS][PlayerData];
PlayerInfo["BenzoAMG"][pPrison] = 3;
That is because he is using in the format of:
pawn Код:
So it's detecting that playerb is part of the MAX_PLAYERS in the variable: pawn Код:
You don't use it like this: pawn Код:
|