[Help] Attach3DTextLabelToPlayer - 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: [Help] Attach3DTextLabelToPlayer (
/showthread.php?tid=661405)
[Help] Attach3DTextLabelToPlayer -
ApolloScripter - 03.12.2018
I give the command below (entering duty mode), and it creates the 3DLabel normally, and appears on top of the administrator name "Admin" in blue, but when I give the command again (to exit duty mode) the 3DLabel does not exit, someone know why?
PHP код:
ACMD:admin[1](playerid, params[])
{
if(GetPlayerAdminLevel(playerid) < 2)
return Msg(playerid, RED, "[ > ] Vocк nгo tem permissгo para usar este comando.");
new name[MAX_PLAYER_NAME];
new Text3D:adminindicitor[MAX_PLAYERS];
GetPlayerName(playerid, name, sizeof(name));
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
{
Msg(playerid, RED, "[ > ] Vocк nгo pode fazer isso enquanto estб espiando!");
return 1;
}
if(!IsPlayerOnAdminDuty(playerid))
{
adminindicitor[playerid] = Create3DTextLabel("Admin", 0x33CCFFFF, 30.0, 40.0, 50.0, 10.0, 0);
TogglePlayerAdminDuty(playerid, true);
MsgAdminsF(1, NovoA, "[ > ] O(a) Administrador(a){FFFFFF} %s {00c0ff}saiu do modo jogador!", name);
Attach3DTextLabelToPlayer(adminindicitor[playerid], playerid, 0.0, 0.0, 0.2);
}
else
{
TogglePlayerAdminDuty(playerid, false);
MsgAdminsF(1, NovoA, "[ > ] O(a) Administrador(a){FFFFFF} %s {00c0ff}entrou no modo jogador!", name);
Delete3DTextLabel(adminindicitor[playerid]);
}
return 1;
}
Re: [Help] Attach3DTextLabelToPlayer -
Kaliber - 03.12.2018
Your
Variable is local.
So it gets resetted every time the command is called.
You have to declare it global (out of the command), so that is saved.
(Or change from
to
)
Re: [Help] Attach3DTextLabelToPlayer -
ApolloScripter - 03.12.2018
It worked !, Thank you <3