SA-MP Forums Archive
VIP Tag disappears for player 1 if player 2 uses it at the same time. - 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: VIP Tag disappears for player 1 if player 2 uses it at the same time. (/showthread.php?tid=340476)



VIP Tag disappears for player 1 if player 2 uses it at the same time. - OleKristian95 - 07.05.2012

pawn Код:
CMD:viptag(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1) {
        if(PlayerInfo[playerid][VIPTag] == 0)   {
            PlayerInfo[playerid][VIPTag] = 1;
            Delete3DTextLabel(PlayerInfo[playerid][Tag3D]);
            PlayerInfo[playerid][Tag3D] = Create3DTextLabel("VIP Member", blue, 0.0, 0.0, 0.0, 90.0, 0, 1);
            Attach3DTextLabelToPlayer(PlayerInfo[playerid][Tag3D], playerid, 0.0, 0.0, 1.2);
            SendClientMessage(playerid,green,"This feature has been enabled!");
            return CMDMessageToAdmins(playerid,"VIP Tag");
        } else {
            PlayerInfo[playerid][VIPTag] = 0;
            Delete3DTextLabel(PlayerInfo[playerid][Tag3D]);
            return SendClientMessage(playerid,red,"This feature has been enabled!");
        }
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 4 to use this command");
}
I would like it to work with two and even more people at the same time.


Re: VIP Tag disappears for player 1 if player 2 uses it at the same time. - LetsOWN[PL] - 07.05.2012

I dunno how looks your PlayerInfo enum, so here is sample script I made. I hope it will be helpfull, and it is what you meant.
pawn Код:
// at the top of the script
new Text3D:vip3d[MAX_PLAYERS];
public OnGameModeInit()
{
...
for(new PlayerId = 0; PlayerId < MAX_PLAYERS; PlayerId++)
{
vip3d[PlayerId] = Create3DTextLabel("VIP Member", blue, 0.0, 0.0, -500.0, 30.0, 0, 0);
}
..
}
This code creates this 3dText for all players. Yes, it is required.
And now:
pawn Код:
// Your code modifited
CMD:viptag(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1) {
        if(PlayerInfo[playerid][VIPTag] == 0)   {
            PlayerInfo[playerid][VIPTag] = 1;
            Attach3DTextLabelToPlayer(vip3d[playerid], playerid, 0.0, 0.0, 1.2);
            SendClientMessage(playerid,green,"This feature has been enabled!");
            return CMDMessageToAdmins(playerid,"VIP Tag");
        } else {
            PlayerInfo[playerid][VIPTag] = 0;
            Delete3DTextLabel(vip3d[playerid]);
            return SendClientMessage(playerid,red,"This feature has been enabled!");
        }
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 4 to use this command");
It should work for now.
WARNING: It might not work in this form, so please modify it at your own. I think it is all I can do from this level.

Hope it will works.

Greetz,
LetsOWN



Re: VIP Tag disappears for player 1 if player 2 uses it at the same time. - OleKristian95 - 07.05.2012

superconfused

enum pInfo
{
Text3D:Tag3D,
VIPTag,
}

Thats how my PlayerInfo enum looks like.

Edit:
All I want is it to work for several players at once not a new code.
It doesnt seem like that is necessary.


Re: VIP Tag disappears for player 1 if player 2 uses it at the same time. - LetsOWN[PL] - 07.05.2012

Hm.. I understand it this way:
You want to show this 3DDraw only for some players, not all? Yes?

Greetz,
LetsOWN



Re: VIP Tag disappears for player 1 if player 2 uses it at the same time. - OleKristian95 - 07.05.2012

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
Hm.. I understand it this way:
You want to show this 3DDraw only for some players, not all? Yes?

Greetz,
LetsOWN
If one VIP Member uses this it showes for him, if another one tried to use it the 3D Draw disappears from the the first VIP member but appears on the second one typing it.
It only works for 1 VIP at the time I want every it to work for more VIPS at the same time.


Re: VIP Tag disappears for player 1 if player 2 uses it at the same time. - ViniBorn - 07.05.2012

How you declared Tag3D ?
pawn Код:
PlayerInfo[playerid][Tag3D]



Re: VIP Tag disappears for player 1 if player 2 uses it at the same time. - OleKristian95 - 10.05.2012

What do you mean?