Multiple errors. (Error 017, 029).
#1

So, here's the script:

Код:
new 3DText:fpsText[MAX_PLAYERS];
new DLlast[MAX_PLAYERS] = 0;
new FPS2[MAX_PLAYERS] = 0;
new string[64];

public OnFilterScriptInit() {
    SetTimer("FPSUP",1203,true);
    return 1;
}

public OnPlayerUpdate(playerid) {
    new drunk2 = GetPlayerDrunkLevel(playerid);
    if(drunk2 < 100) {
        SetPlayerDrunkLevel(playerid,2000);
    } else {
        if(DLlast[playerid] != drunk2) {
            new fps = DLlast[playerid] - drunk2;
            if((fps > 0) && (fps < 200)) {
                FPS2[playerid] = fps;
                DLlast[playerid] = drunk2;
            }
        }
    }
}

public OnPlayerSpawn(playerid) {
    Attach3DTextLabelToPlayer(fpsText[playerid], playerid, 0.0, 0.0, 0.7);
    return 1;
}

public OnPlayerConnect(playerid) {
    fpsText[i] = Create3DTextLabel("FPS: 30",0xFFFFFFFF,0.0,0.0,0.0,10.0);
    return 1;
}

public OnPlayerDisconnect(playerid) {
    Delete3DTextLabel(fpsText[playerid]);
    return 1;
}

forward FPSUP();
public FPSUP()  {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            format(string,sizeof(string),"FPS: %d",FPS2[i]-1);
            Update3DTextLabelText(fpsText[i],0xFFFFFFFF,string);
        }
        continue;
    }
}
Here's the errors:

Quote:

error 017: undefined symbol "fpsText"
error 017: undefined symbol "i"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Basically, OnPlayerConnect is the part which cannot work.
Reply
#2

pawn Код:
public OnPlayerConnect(playerid) {
    fpsText[playerid] = Create3DTextLabel("FPS: 30",0xFFFFFFFF,0.0,0.0,0.0,10.0);
    return 1;
}
Reply
#3

Danish:
Quote:

error 017: undefined symbol "fpsText"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Reply
#4

Change this:
pawn Код:
new 3DText:fpsText[MAX_PLAYERS];
to this
pawn Код:
new Text3D:fpsText[MAX_PLAYERS];
You need to use Text3D not 3DText
Reply
#5

Still getting errors @ Quattro.


Quote:

error 017: undefined symbol "fpsText"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Reply
#6

It compiles fine.
pawn Код:
#define FILTERSCRIPT

#include < a_samp >

new Text3D:fpsText[MAX_PLAYERS];
new DLlast[MAX_PLAYERS] = 0;
new FPS2[MAX_PLAYERS] = 0;
new string[64];

public OnFilterScriptInit() {
    SetTimer("FPSUP",1203,true);
    return 1;
}

public OnPlayerUpdate(playerid) {
    new drunk2 = GetPlayerDrunkLevel(playerid);
    if(drunk2 < 100) {
        SetPlayerDrunkLevel(playerid,2000);
    } else {
        if(DLlast[playerid] != drunk2) {
            new fps = DLlast[playerid] - drunk2;
            if((fps > 0) && (fps < 200)) {
                FPS2[playerid] = fps;
                DLlast[playerid] = drunk2;
            }
        }
    }
}

public OnPlayerSpawn(playerid) {
    Attach3DTextLabelToPlayer(fpsText[playerid], playerid, 0.0, 0.0, 0.7);
    return 1;
}

public OnPlayerConnect(playerid) {
    fpsText[playerid] = Create3DTextLabel("FPS: 30",0xFFFFFFFF,0.0,0.0,0.0,10.0,0,0);
    return 1;
}

public OnPlayerDisconnect(playerid) {
    Delete3DTextLabel(fpsText[playerid]);
    return 1;
}

forward FPSUP();
public FPSUP()  {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            format(string,sizeof(string),"FPS: %d",FPS2[i]-1);
            Update3DTextLabelText(fpsText[i],0xFFFFFFFF,string);
        }
        else continue;
    }
}
Reply
#7

You missed one parameter.
pawn Код:
fpsText[i] = Create3DTextLabel("FPS: 30",0xFFFFFFFF,0.0,0.0,0.0,10.0, 0); // 0 - Virtual world missing parameter
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)