an error with admin status +rep
#1

I have used to develop an admin status option so admins can put there current status or if they're available to assist players, I did all I could but few errors occured:

Quote:

../gamemodes/core.pwn(15567) : error 028: invalid subscript (not an array or too many subscripts): "pStatus"
../gamemodes/core.pwn(15567) : error 029: invalid expression, assumed zero
../gamemodes/core.pwn(15567) : error 029: invalid expression, assumed zero
../gamemodes/core.pwn(15567) : fatal error 107: too many error messages on one line

line 15567:
Quote:

stock GetPlayerStatus(playerid)
{
new string[10];
THE LINE - > switch(pStatus[playerid])
{
case 0: strcat(string, "{4BB74C}Administrating");
case 1: strcat(string, "{FF0000}Roleplaying");
case 2: strcat(string, "{FF6600}Away From Keyboard");
default: strcat(string, "Unknown");
}
return string;
}

what have I done wrong?
Reply
#2

Show the enums of pStatus
Reply
#3

Have you defined pStatus as in [MAX_PLAYERS] ?
Reply
#4

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Have you defined pStatus as in [MAX_PLAYERS] ?
Yes, I did. aswell as I put it in my pINFO enum, so basically it's gathered with all the player information.
Reply
#5

The error message clearly states that given variable is not an array, so make it one.
Reply
#6

Quote:
Originally Posted by Cadilab
Посмотреть сообщение
The error message clearly states that given variable is not an array, so make it one.
Checking this out.
Reply
#7

Quote:
Originally Posted by Cadilab
Посмотреть сообщение
The error message clearly states that given variable is not an array, so make it one.
Still nothing. -
the status command gives an error too here is it:
Quote:

CMD:status(playerid, params[])
{
if(isnull(params) || !IsNumeric(params)) return SendClientMessage(playerid, -1, "Usage: /status (1, 2, 3).");
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must be logged in to use this.");

new value = strval(params);
if(value <= 0 || value >= 4) return SendClientMessage(playerid, -1, "SERVER: You have entered an invalid status value.");

-- > THIS IS THE ERROR LINE pStatus[playerid] = value - 1;

new string[144];
format(string, sizeof(string), "INFO: {FFFFFF}You have changed your status to %s.", GetPlayerStatus(playerid));
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}

Players enum:
Quote:

enum pInfo
{
pID,
pPass[128],
pSec[256],
pUsername[MAX_PLAYER_NAME],
pName[MAX_PLAYER_NAME],
pCellname[128],
pBlockPM[MAX_PLAYERS],
pDescribe[128],
pDescribe2[128],
pAdText[256],
PlayerWeapon,
PlayerAmmo,
pAudioUrl[256],
pLiveOffer[2], // 0: SAN Network, 1: RLS
Float:pPos[3],
pFurnID,
Float:pFurn[4],
Float:pFurnR[4],
pPMMsg[128],
pTagMsg[128],
Float:pPosa[6],
pInvItem[MAX_INV_SLOTS],
pInvQ[MAX_INV_SLOTS],
pInvEx[MAX_INV_SLOTS],
pInvS[MAX_INV_SLOTS],
pPlayerWeapon,
pPlayerAmmo,
pAmmoType,
pPlayerSerial,
pDelay[MAX_DELAY_SLOTS+1],
pHacker,
pAch[MAX_ACHIEVEMENTS],
pFakeIP[16],
pHost[128],
pMarriedTo[MAX_PLAYER_NAME + 1],
pAccent[64],
pPaymentTD,
pSpeedDelay,
Float:pPosI[3],
pIdleTime,
pDivision[MAX_LSPD_DIVISIONS],
pBeanbagged,
pBeanbaggedTime,
pArcade,
pArcadeRaceCP,
pArcadeRaceCount,
pArcadeLaps,
pScanner,
pIP[16],
pSelectedFurnitureID,
pJailedUntil[64],
pBasketballID,
pHasBasketball,
pBasketballDefending,
Float:pgoto[3],
pCmdSpam,
pCmdTime,
pMute,
pRegisterSkin,
pTrickOrTreat,
pTrickOrTreatHouses[MAX_HOUSES],
pPlantRadio,
pPlantRadioID,
pDarkScreen,
pJobCP,
pJobStatus,
pJobVehicleID,
pJobExtraVehicleID,
pJobHouseID,
pJobProgress,
pAddressCP,
pMapTag[16],
pDialogOpen,
pTogName,
pTogAdminChat,
pLocationsCP,
pStopTalkingTimer,
pMechCall,
p*******StreamType,
p*******StreamExtra,
pFDSubRank[20],
pInjuries[10],
pStatus[MAX_PLAYERS],
Text3D:pInjuriesText,
};
new PlayerInfo[MAX_PLAYERS][pInfo];

Reply
#8

why are you using [MAX_PLAYERS] inside players enum ?
Reply
#9

Quote:
Originally Posted by Cadilab
Посмотреть сообщение
why are you using [MAX_PLAYERS] inside players enum ?
so what should I use instead, remove it?
Reply
#10

[MAX_PLAYERS] make the enum redundant. Remove the [MAX_PLAYERS] from it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)