[Ajuda] expected token
#1

Alguem pode me informar oque ouve?

Код:
C:\Documents and Settings\P.Henrique\Desktop\Nova pasta\gamemodes\BSL.pwn(870) : error 001: expected token: "]", but found "-integer value-"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
a linha й essa..

pawn Код:
new FirstKick[MAX_PLAYERS char];
tem tambйm essa define

pawn Код:
#define char 255
Reply
#2

Char serve para armazenar um ъnico caractere.

Mais sobre char.

O que vocк tentou fazer?

pawn Код:
new FirstKick[500 255]; // ?

//seria:
new FirstKick[MAX_PLAYERS];
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=466074
Reply
#4

Apague:
pawn Код:
#define char 255
Reply
#5

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Char serve para armazenar um ъnico caractere.

Mais sobre char.

O que vocк tentou fazer?

pawn Код:
new FirstKick[500 255]; // ?

//seria:
new FirstKick[MAX_PLAYERS];
Errado..

-

Da uma leitura nisto

Quote:
Originally Posted by Slice
Посмотреть сообщение
"Char-arrays"
PAWN has a feature for accessing single bytes in arrays, intended for use with packed strings. Most SA-MP natives doesn't cover packed strings, though.
You can, however, utilize these arrays a lot for memory optimization. A normal array can store values between -2,147,483,648 and 2,147,483,647; you don't always need that capacity, do you?
With packed strings you can store values between 0-255 (yes, no negative values; -1 will wrap to 255). When you know you don't need negative values and won't ever exceed 255, why not save some memory?

pawn Код:
new bool:g_IsPlayerSomething[ MAX_PLAYERS ]; // 500 cells * 4 bytes per cell = 2000 bytes!
new bool:g_IsPlayerSomething[ MAX_PLAYERS char ]; // 500 bytes = .. 500 bytes!
If you use "char arrays" instead of normal ones where needed 50 times you'll save 75,000 bytes (~73 kb).

Note!
When accessing these arrays, you need to use curly brackets (aka braces) as opposed to the normal square brackets.
Example:
pawn Код:
public OnPlayerConnect( playerid )
{
    g_IsPlayerSomething{ playerid } = false;
//                     ^          ^
}

public OnPlayerSpawn( playerid )
{
//                          v          v
    if ( g_IsPlayerSomething{ playerid } )
    {
        // ..
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)