SA-MP Forums Archive
Strcat Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Strcat Help (/showthread.php?tid=413846)



Strcat Help - AphexCCFC - 07.02.2013

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.


Re: Strcat Help - Jefff - 07.02.2013

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


Re: Strcat Help - AphexCCFC - 07.02.2013

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


Re: Strcat Help - T0pAz - 07.02.2013

What's wrong with it?


Re: Strcat Help - AphexCCFC - 07.02.2013

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


Re: Strcat Help - AphexCCFC - 07.02.2013

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.


Re: Strcat Help - AphexCCFC - 07.02.2013

Anyone know?


Re: Strcat Help - T0pAz - 07.02.2013

What's the size of fishname1?


Re: Strcat Help - AphexCCFC - 07.02.2013

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.


Re: Strcat Help - T0pAz - 07.02.2013

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^