Strcat Help
#1

pawn Код:
strcat(PlayerInfo[playerid][pFishName1], FishNames[FishName]);
This doesn't seem to work, but I want PlayerInfo[playerid][pFishName1] to be set as FishNames[FishName]

under FishNames[FishName] I have "Clownfish", "Shark" etc.
Reply
#2

You must set maxlenght after FishNames[FishName], size PlayerInfo[playerid][pFishName1]
Reply
#3

pawn Код:
new FishName = random(sizeof(FishNames));
I have this.
Reply
#4

What's wrong with it?
Reply
#5

pawn Код:
FishName[FishNames]
^ This works, it's just not working when I want to join it together with my PlayerInfo[playerid][pFishName1] variable.
Reply
#6

Basically, I have a /fish command, everything works fine, except I want "PlayerInfo[playerid][pFishName1]" to display whats in "FishNames[FishName]".

pawn Код:
new FishNames[][] =
{
    "Shark",
    "Clownfish",
    "Angelfish",
    "Catfish",
    "Dogfish",
    "Eel"
};
Which is one of these selected at random.
Reply
#7

Anyone know?
Reply
#8

What's the size of fishname1?
Reply
#9

pawn Код:
enum pInfo
{
    pLevel,
    pGender,
    pCash,
    pBank,
    pJob,
    pBirthDate,
    pBirthMonth,
    pBirthYear,
    pAdminLevel,
    pAdminDuty,
    pSkin,
    pFishPermit,
    pFish1,
    pFish2,
    pFish3,
    pFish4,
    pFish5,
    pFishes,
    Float:pPosX,
    Float:pPosY,
    Float:pPosZ,
    Float:pPosA,
    pRegistered,
    pFishName1,
    pFishName2,
    pFishName3,
    pFishName4,
    pFishName5,
    pFishNames,
    pFishingRod,
    pRodDurab,
    pBait
}
This is all I have for the FishName1 variable.
Reply
#10

String must be in array as it's a group of characters.

pawn Код:
enum pInfo
{
    pLevel,
    pGender,
    pCash,
    pBank,
    pJob,
    pBirthDate,
    pBirthMonth,
    pBirthYear,
    pAdminLevel,
    pAdminDuty,
    pSkin,
    pFishPermit,
    pFish1,
    pFish2,
    pFish3,
    pFish4,
    pFish5,
    pFishes,
    Float:pPosX,
    Float:pPosY,
    Float:pPosZ,
    Float:pPosA,
    pRegistered,
    pFishName1[16],
    pFishName2[16],
    pFishName3[16],
    pFishName4[16],
    pFishName5[16],
    pFishNames,
    pFishingRod,
    pRodDurab,
    pBait
}
Try that^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)