Why is this not working?
#1

Sorry for the title but wasn't sure about a good one..

PHP код:
C:\Users\andrei\Desktop\Scripting SA-MP\Basic RP Script Scratch FIX\gamemodes\U1.pwn(2753) : error 006must be assigned to an array
C:\Users\andrei\Desktop\Scripting SA-MP\Basic RP Script Scratch FIX\gamemodes\U1.pwn(2754) : error 006must be assigned to an array
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors

PHP код:
new test[64][7]; 
PHP код:
 if(PlayerInfo[playerid][pItem1] == 1) { test[0] = "Test String"; }
        if(
PlayerInfo[playerid][pItem2] == 0) { test[1] = "EMPTY"; }
        if(
PlayerInfo[playerid][pItem3] == 0) { test[2] = "EMPTY"; }
        if(
PlayerInfo[playerid][pItem4] == 0) { test[3] = "EMPTY"; }
        if(
PlayerInfo[playerid][pItem5] == 0) { test[4] = "EMPTY"; }
        if(
PlayerInfo[playerid][pItem6] == 0) { test[5] = "EMPTY"; }
        if(
PlayerInfo[playerid][pItem7] == 0) { test[6] = "EMPTY"; } 
I also tried new test[7][64] which made the error go away but I wasn't getting the full text, I was receiving only this "Test Strin"
Reply
#2

I'd rather do it this way
PHP код:
    new test[1][6]; 
    if(
PlayerInfo[playerid][pKicks] == 1)
                
format(test[0], sizeof(test[0]), "EMPTY"); 
Reply
#3

Quote:
Originally Posted by TATIK
Посмотреть сообщение
PHP код:
new test[7][64]; 
I did that but it didn't worked, nevermind I solved anyway, I had the format string too small... thanks anyway
Reply
#4

You don't have to use 2-dimensional arrays for a single string. It could simply be test[64]. Also, I suggest you to use strcpy to copy strings than using format.
Reply
#5

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
You don't have to use 2-dimensional arrays for a single string. It could simply be test[64]. Also, I suggest you to use strcpy to copy strings than using format.
Can you show me an example of strcpy?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)