[Help]Error
#1

Код:
if(!strcmp(cmd,"/setprefix",true))
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    new para1,prefix[60];
    para1 = ReturnUser(tmp);
    prefix = strtok(cmdtext,idx);
    printf("PREFIX: %s",prefix);
    if(!strlen(prefix))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    if(pInfo[playerid][Adminlevel] >= 6 || IsPlayerAdmin(playerid))
    {
        if(IsPlayerConnected(para1))
        {
            if(para1 != INVALID_PLAYER_ID)
            {
                GetPlayerName(para1,giveplayer,sizeof giveplayer);
                format(string,sizeof string,"PREFIX: Administrator {FFFF00}%s{00FFFF} set you PREFIX{FFFF00} %s{00FFFF}. Congratulations!",PlayerName(playerid),prefix);
                SendClientMessage(para1,COLOR_ORANGE,string);
                strcat(pInfo[para1][Prefix],prefix);
                format(string, sizeof(string), "PREFIX: {FFFF00}%s {00FFFF} now have PREFIX {FFFF00}%s{00FFFF}. Congratulations!", giveplayer, prefix);
                SendClientMessageToAll(COLOR_ORANGE, string);
            }
        }
    }
    else
     {
          SendClientMessage(playerid, COLOR_RED, "You have no access to this command!");
    }
    return 1;
}
Код:
Error:(14006) : error 017: undefined symbol "Prefix"
Код:
strcat(pInfo[para1][Prefix],prefix);
Reply
#2

Add it on top

and i recommend you to use izcmd + sscanf thats faster and easier!
Reply
#3

Код:
if(!strcmp(cmd,"/setprefix",true))
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    new para1,prefix[60];
    para1 = ReturnUser(tmp);
    prefix = strtok(cmdtext,idx);
    printf("PREFIX: %s",prefix);
    if(!strlen(prefix))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    if(pInfo[playerid][Adminlevel] >= 6 || IsPlayerAdmin(playerid))
    {
        if(IsPlayerConnected(para1))
        {
            if(para1 != INVALID_PLAYER_ID)
            {
                GetPlayerName(para1,giveplayer,sizeof giveplayer);
                format(string,sizeof string,"PREFIX: Administrator {FFFF00}%s{00FFFF} set you PREFIX{FFFF00} %s{00FFFF}. Congratulations!",PlayerName(playerid),prefix);
                SendClientMessage(para1,COLOR_ORANGE,string);
                strcat(pInfo[para1][prefix],prefix);
                format(string, sizeof(string), "PREFIX: {FFFF00}%s {00FFFF} now have PREFIX {FFFF00}%s{00FFFF}. Congratulations!", giveplayer, prefix);
                SendClientMessageToAll(COLOR_ORANGE, string);
            }
        }
    }
    else
     {
          SendClientMessage(playerid, COLOR_RED, "You have no access to this command!");
    }
    return 1;
}
Reply
#4

Does "pInfo[para1][Prefix]" realy exists?
Reply
#5

Код:
(14006) : error 033: array must be indexed (variable "prefix")
Reply
#6

Код:
new Prefix[MAX_PLAYERS]; // place it where your all MAX_PLAYERS are
if(!strcmp(cmd,"/setprefix",true))
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    new para1,prefix[60];
    para1 = ReturnUser(tmp);
    prefix = strtok(cmdtext,idx);
    printf("PREFIX: %s",prefix);
    if(!strlen(prefix))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    if(pInfo[playerid][Adminlevel] >= 6 || IsPlayerAdmin(playerid))
    {
        if(IsPlayerConnected(para1))
        {
            if(para1 != INVALID_PLAYER_ID)
            {
                GetPlayerName(para1,giveplayer,sizeof giveplayer);
                format(string,sizeof string,"PREFIX: Administrator {FFFF00}%s{00FFFF} set you PREFIX{FFFF00} %s{00FFFF}. Congratulations!",PlayerName(playerid),prefix);
                SendClientMessage(para1,COLOR_ORANGE,string);
                strcat(pInfo[para1][Prefix],prefix);
                format(string, sizeof(string), "PREFIX: {FFFF00}%s {00FFFF} now have PREFIX {FFFF00}%s{00FFFF}. Congratulations!", giveplayer, prefix);
                SendClientMessageToAll(COLOR_ORANGE, string);
            }
        }
    }
    else
     {
          SendClientMessage(playerid, COLOR_RED, "You have no access to this command!");
    }
    return 1;
}
Reply
#7

Add "Prefix[60]" to your "pInfo" enum and dont use the code from AliBro
Reply
#8

Not working
Reply
#9

Show me your pInfo Enum
Reply
#10

Код:
enum pInfo
{
pMutedTime, //Тук ще се запише времето за което е заглушен
	pTest,
	pKey[256],
	ExpS,
	pTazerBullets,
	pIP[21],
	pO,
    pRobTime,
   	pJobTimer,
   	pIgnorePM,
	pNPM,
	VGod,
	pAdmin,
	pCOP,
	pSilenSkill,
	Prefix[60],
	pDrugPerk,
	pDrugs,
	pDis,
	pEvent,
	pAccount,
	pManage,
	pDuty,
	aTog,
	pRank,
	pMember,
	pBanned,
	pBlock,
	pDonateRank,
	pBV,
	pWarns,
	pAWarns,
	pFWarns,
	pReg,
	pCash,
	pKills,
	pDeaths,
	pGun0,
	pGun1,
	pGun2,
	pGun3,
	pGun4,
	pGun5,
	pGun6,
	pGun7,
	pGun8,
	pGun9,
	pGun10,
	pGun11,
	pGun12,
	pModel,
	pMuted,
	prMuted,
	ptrMuted,
	ptMuted,
	pvMuted,
	paMuted,
	pvtMuted,
	patMuted,
	pfMuted,
	pftMuted,
	pSpree,
	Float:pCalcSec,
	pCWons,
	pLotto,
	pHide,
    pJailed,
	pCrimes,
	pWantedLevel,
	pWantedDeaths,
	pJail,
	pHealme,
	pFixme,
	pRes,
	pKill,
	pArmourme,
	AFKstatus,
	Level,
	Exp,
	pJailTime,
	WsSkill,
    pDmon,
    pV,
   	EpSkill,
   	LevelSkill,
	MoneySkill
};
new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
if(!strcmp(cmd,"/setprefix",true))
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    new para1,prefix[60];
    para1 = ReturnUser(tmp);
    prefix = strtok(cmdtext,idx);
    printf("PREFIX: %s",prefix);
    if(!strlen(prefix))
    {
        return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setprefix [playerid] [Prefix text]");
    }
    if (PlayerInfo[playerid][pAdmin] >= 6)
    {
        if(IsPlayerConnected(para1))
        {
            if(para1 != INVALID_PLAYER_ID)
            {
                GetPlayerName(para1,giveplayer,sizeof giveplayer);
                format(string,sizeof string,"PREFIX: Administrator {FFFF00}%s{00FFFF} set you PREFIX{FFFF00} %s{00FFFF}. Congratulations!",PlayerName(playerid),prefix);
                SendClientMessage(para1,COLOR_ORANGE,string);
                strcat(PlayerInfo[para1][Prefix],prefix);
                format(string, sizeof(string), "PREFIX: {FFFF00}%s {00FFFF} now have PREFIX {FFFF00}%s{00FFFF}. Congratulations!", giveplayer, prefix);
                SendClientMessageToAll(COLOR_ORANGE, string);
            }
        }
    }
    else
     {
          SendClientMessage(playerid, COLOR_RED, "You have no access to this command!");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)