SA-MP Forums Archive
DeletePlayer3DTextLabel - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DeletePlayer3DTextLabel (/showthread.php?tid=333915)



DeletePlayer3DTextLabel - tyler12 - 13.04.2012

pawn Code:
COMMAND:afk(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
SendClientMessageToAll(blue, string);
TogglePlayerControllable(playerid, 0);
new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(afk, playerid, 0.0, 0.0, 0.7);
return 1;
}
COMMAND:back(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
SendClientMessageToAll(blue, string);
TogglePlayerControllable(playerid, 1);
DeletePlayer3DTextLabel(playerid, PlayerText3D:afk);//line of error
return 1;
}
I keep getting a error
Code:
(3827) : error 017: undefined symbol "afk"



Re: DeletePlayer3DTextLabel - Cjgogo - 13.04.2012

Replace the error line with this:
pawn Code:
DeletePlayer3DTextLabel(playerid,afk);



Re: DeletePlayer3DTextLabel - tyler12 - 13.04.2012

Still getting same error :S


Re: DeletePlayer3DTextLabel - Hoss - 13.04.2012

At top of your script
new Text3D:afk[MAX_PLAYERS];


Re: DeletePlayer3DTextLabel - tyler12 - 13.04.2012

Code:
(3817) : warning 219: local variable "afk" shadows a variable at a preceding level
(3828) : error 035: argument type mismatch (argument 2)
pawn Code:
new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0); // first error 3817
DeletePlayer3DTextLabel(playerid,afk); // second error 3828



Re: DeletePlayer3DTextLabel - Twisted_Insane - 13.04.2012

PHP Code:
new Text3D:awayFKCreate3DTextLabel("Player is afk!"0x008080FF30.040.050.040.00); // first error 3817
DeletePlayer3DTextLabel(playeridawayFK); 



Re: DeletePlayer3DTextLabel - sampmark05 - 13.04.2012

Quote:
Originally Posted by tyler12
View Post
pawn Code:
COMMAND:afk(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
SendClientMessageToAll(blue, string);
TogglePlayerControllable(playerid, 0);
new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(afk, playerid, 0.0, 0.0, 0.7);
return 1;
}
COMMAND:back(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
SendClientMessageToAll(blue, string);
TogglePlayerControllable(playerid, 1);
DeletePlayer3DTextLabel(playerid, PlayerText3D:afk);//line of error
return 1;
}
I keep getting a error
Code:
(3827) : error 017: undefined symbol "afk"
Code:
COMMAND:afk(playerid, params[])
{
    new string[128], playerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
    format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
    SendClientMessageToAll(blue, string);
    TogglePlayerControllable(playerid, 0);
    new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(afk, playerid, 0.0, 0.0, 0.7);
    return 1;
}

COMMAND:back(playerid, params[])
{
    new string[128], playerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
    format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
    SendClientMessageToAll(blue, string);
    TogglePlayerControllable(playerid, 1);
    DeletePlayer3DTextLabel(playerid, PlayerText3D:afk);
    return 1;
}



Re: DeletePlayer3DTextLabel - taborda11 - 13.04.2012

Quote:
Originally Posted by tyler12
View Post
pawn Code:
COMMAND:afk(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
SendClientMessageToAll(blue, string);
TogglePlayerControllable(playerid, 0);
new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(afk, playerid, 0.0, 0.0, 0.7);
return 1;
}
COMMAND:back(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
SendClientMessageToAll(blue, string);
TogglePlayerControllable(playerid, 1);
DeletePlayer3DTextLabel(playerid, PlayerText3D:afk);//line of error
return 1;
}
I keep getting a error
Code:
(3827) : error 017: undefined symbol "afk"
pawn Code:
COMMAND:afk(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
SendClientMessageToAll(blue, string);
new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(afk, playerid, 0.0, 0.0, 0.7);
TogglePlayerControllable(playerid, 0);
return 1;
}
COMMAND:back(playerid, params[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
SendClientMessageToAll(blue, string);
TogglePlayerControllable(playerid, 1);
DeletePlayer3DTextLabel(playerid, Text3D:afk);
return 1;
}
That should work


Re: DeletePlayer3DTextLabel - sampmark05 - 13.04.2012

and download the new streamer plugin 2.6 by Incognito https://sampforum.blast.hk/showthread.php?tid=102865


Re: DeletePlayer3DTextLabel - tyler12 - 13.04.2012

Quote:
Originally Posted by sampmark05
View Post
and download the new streamer plugin 2.6 by Incognito https://sampforum.blast.hk/showthread.php?tid=102865
My streamer is updated.

Now i get 2 warnings
(3826) : warning 219: local variable "afk" shadows a variable at a preceding level
(383 : warning 213: tag mismatch

Lines
3826 - new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
3838 - DeletePlayer3DTextLabel(playerid, Text3D:afk);

EDIT: Ingame label dosent show


Re: DeletePlayer3DTextLabel - Twisted_Insane - 13.04.2012

Did you even read what I wrote above?


Re: DeletePlayer3DTextLabel - tyler12 - 13.04.2012

Quote:
Originally Posted by Twisted_Insane
View Post
Did you even read what I wrote above?
Yes, it did not do anything...


Re: DeletePlayer3DTextLabel - Jochemd - 13.04.2012

Can you actually script, tyler12?


Re: DeletePlayer3DTextLabel - Sasino97 - 13.04.2012

Do like this:

At top of your script
new Text3D:afk;

Then go to the line
"new Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);."

and delete the 'new Text3D:'


Re: DeletePlayer3DTextLabel - Torus - 13.04.2012

dude one minute please see that u add new Text3D:afk[MAX_PLAYERS]; at top then what mistake you have done is

you have added new "Text3D:afk" in the command /afk. just remove the new

heres the code
pawn Code:
new Text3D: afk[MAX_PLAYERS]; // at your top of script

COMMAND:afk(playerid, params[])
{
     new string[128], playerName[MAX_PLAYER_NAME];
     GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
     format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
     SendClientMessageToAll(blue, string);
     Text3D:afk = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(afk, playerid, 0.0, 0.0, 0.7);
    TogglePlayerControllable(playerid, 0);
    return 1;
}
COMMAND:back(playerid, params[])
{
     new string[128], playerName[MAX_PLAYER_NAME];
     GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
     format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
     SendClientMessageToAll(blue, string);
     TogglePlayerControllable(playerid, 1);
     DeletePlayer3DTextLabel(playerid, Text3D:afk);
     return 1;
}
Hope It Helped


Re: DeletePlayer3DTextLabel - Sasino97 - 13.04.2012

Fix to this(there were a 3 or 4 errors) or it will give you an error like "Array has to be indexed", and another error with DeletePlayer3DTextLabel, it has to be Delete3DTextLabel, because afk is of type Text3D, not PlayerText3D, else it will give an error like "Argument type mismatch"

pawn Code:
new Text3D: afk[MAX_PLAYERS]; // at your top of script

COMMAND:afk(playerid, params[])
{
     new string[128], playerName[MAX_PLAYER_NAME];
     GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
     format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
     SendClientMessageToAll(blue, string);
     afk[playerid] = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
     Attach3DTextLabelToPlayer(afk[playerid], playerid, 0.0, 0.0, 0.7); // 1 error here
     TogglePlayerControllable(playerid, 0);
     return 1;
}
COMMAND:back(playerid, params[])
{
     new string[128], playerName[MAX_PLAYER_NAME];
     GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
     format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
     SendClientMessageToAll(blue, string);
     TogglePlayerControllable(playerid, 1);
     Delete3DTextLabel(playerid, afk[playerid]); // 2 Errors here
     return 1;
}
If there's another error, let me know


Re: DeletePlayer3DTextLabel - Torus - 13.04.2012

ohh man srry for that i was in little hurry :P nvm btw thks for telling me too next time i will see to it that i will not make mistakes.


Re: DeletePlayer3DTextLabel - tyler12 - 13.04.2012

Quote:
Originally Posted by [GF]Sasino97
View Post
Fix to this(there were a 3 or 4 errors) or it will give you an error like "Array has to be indexed", and another error with DeletePlayer3DTextLabel, it has to be Delete3DTextLabel, because afk is of type Text3D, not PlayerText3D, else it will give an error like "Argument type mismatch"

pawn Code:
new Text3D: afk[MAX_PLAYERS]; // at your top of script

COMMAND:afk(playerid, params[])
{
     new string[128], playerName[MAX_PLAYER_NAME];
     GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
     format(string, sizeof(string), "SERVER:%s is now in afk mode!", playerName);
     SendClientMessageToAll(blue, string);
     afk[playerid] = Create3DTextLabel("Player is afk!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
     Attach3DTextLabelToPlayer(afk[playerid], playerid, 0.0, 0.0, 0.7); // 1 error here
     TogglePlayerControllable(playerid, 0);
     return 1;
}
COMMAND:back(playerid, params[])
{
     new string[128], playerName[MAX_PLAYER_NAME];
     GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
     format(string, sizeof(string), "SERVER:%s has came back from being afk!", playerName);
     SendClientMessageToAll(blue, string);
     TogglePlayerControllable(playerid, 1);
     Delete3DTextLabel(playerid, afk[playerid]); // 2 Errors here
     return 1;
}
If there's another error, let me know
Will that delete the 3d text label if other players are afk

Im not at a computer at the moment, ill test it soon

Thanks

EDIT:Just 2 warnings,

(3854) : warning 213: tag mismatch
(3854) : warning 202: number of arguments does not match definition
This line
PHP Code:
     Delete3DTextLabel(playeridafk[playerid]); // 2 Errors here 
Quote:
Originally Posted by Jochemd
View Post
Can you actually script, tyler12?
LOOL gtfo