An annoying warning.
#2

It is happening because the variable which stores the 3D Text ID gets destroyed when the command finishes .


Just make label a global and array variable and use Delete3DTextLabel to destroy the 3D Text created by Create3DTextLabel :


pawn Код:
//Put in the top of your gamemode:

new Text3D:label[MAX_PLAYERS];


//And use this command:

CMD:afk(playerid, params[]){
    new mystring[70];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(PlayerInfo[playerid][pAfk] == -1){
        format(mystring, sizeof(mystring), "*{DDDDDD}%s {00FF00}is now away from keyboard!",pname);
        SendClientMessageToAll(COLOR_LIME, mystring);
        TogglePlayerControllable(playerid, 0);
        PlayerInfo[playerid][pAfk] = 1;
        label[playerid] = Create3DTextLabel("I'm away from my keyboard!", 0x00FF00FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
    }else{
        format(mystring, sizeof(mystring), "*{DDDDDD}%s {88FF00}is now back to his keyboard!",pname);
        SendClientMessageToAll(0x88FF00FF, mystring);
        TogglePlayerControllable(playerid, 1);
        PlayerInfo[playerid][pAfk] = -1;
        Delete3DTextLabel(label[playerid]);
    }
    return 1;
}


I hope that i have helped .
Reply


Messages In This Thread
An annoying warning. - by Bogdan1992 - 25.03.2012, 14:47
Re: An annoying warning. - by rjjj - 25.03.2012, 15:12
Re: An annoying warning. - by Bogdan1992 - 25.03.2012, 15:34

Forum Jump:


Users browsing this thread: 2 Guest(s)