11.12.2015, 13:39
Hello, I ran into a bug from a really short code but I just can't find what I did wrong.
I'm using myStrcpy to store strings in a variable.
i use a stock to reset the inventory from a player like this:
I already made some prints in that stock which might be usefull to locate the problem for you guys since I cant find the issue.
As you see the string overlap eachother.
Hopefully someone can help me!
Here is the enum for InventoryInfo
I'm using myStrcpy to store strings in a variable.
Код:
myStrcpy(to[], const from[]) { new length = strlen(from); for (new i = 0; i <= length; i++) { to[i] = from[i]; } return 1; }
Код:
stock ResetInventory(playerid) { for(new b=26; b<=53; b++) { myStrcpy(InventoryInfo[playerid][invtext][b],"None"); if(b==26) printf("test3: %s",InventoryInfo[playerid][invtext][26]); if(b==27) printf("test4: %s",InventoryInfo[playerid][invtext][26]); if(b==28) printf("test5: %s",InventoryInfo[playerid][invtext][26]); } return 1; }
Код:
test3: None test4: NNone test5: NNNone
Hopefully someone can help me!
Here is the enum for InventoryInfo
Код:
enum inventorystats { invtext[64], itemid, ammo, sort, } new InventoryInfo[MAX_PLAYERS][inventorystats][54];