Problem in the repfam system
#1

My repfam system is kinda bugged, when 4/5 turn it on in the same time it's get turn off from some players why?

all codes of it:

Код:
new Text3D:fRepfamtext[MAX_PLAYERS];
new fRepfam[MAX_PLAYERS];
new fRepfamTimer[MAX_PLAYERS];
Код:
CMD:repfam(playerid, params[])
{
	new string[300];
	if(gettime() < fRepfamTimer[playerid])
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You have to wait 2 minutes to take your bandana off");
		return 1;
	}

	if(PlayerInfo[playerid][pFMember] != INVALID_FAMILY_ID)
	{
        if(fRepfam[playerid] == 1)
        {
			SendClientMessageEx(playerid, COLOR_GREEN, "You are not representing your repfam anymore.");
			Delete3DTextLabel(fRepfamtext[playerid]);
			//Delete3DTextLabel(fRepfamtext[playerid][fRepfam]);
			fRepfam[playerid] = 0;
        }
        else
        {
			new fam = PlayerInfo[playerid][pFMember];
            fRepfamTimer[playerid] = gettime()+120;
            SendClientMessageEx(playerid, COLOR_GREEN, "You are now representing the repfam.");
            format(string, sizeof(string), "{%s}%s", Family_NumToDialogHex(FamilyInfo[fam][FamilyColor]), FamilyInfo[fam][FamilyName]);
            fRepfam[playerid] = 1;
            fRepfamtext[playerid] = Create3DTextLabel(string, 0xFFFFFFFF, 0, 0, 0, 25, 0, 1);
            Attach3DTextLabelToPlayer(fRepfamtext[playerid], playerid, 0.0, 0.0, 0.0);
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not part of a gang.");
    }
    return 1;
}
Also im using this codes when using this cmds /makeleader , /quitgang , /switchfam , /fcreate , OnPlayerDisconnect , OnPlayerConnect , OnPlayerLoad

Код:
Delete3DTextLabel(fRepfamtext[playerid]);
		fRepfam[playerid] = 0;
		fRepfamTimer[playerid] = gettime()+0;
What the problem? wtf
Reply
#2

No one know how to fix this problem?
Reply
#3

I've encountered this problem, This is the cause when you're not setting to invalid 3dtextlabel id before deleting them.

add this under onplayerconnect

Код:
fRepfamtext[playerid] = Text3D:INVALID_3DTEXT_ID;
it should be fixed.
Reply
#4

Thanks, i'll try that
Reply
#5

still same, maybe i should put it in repfam cmd too?

and when i use /switchfam it's removing for the other players too why?

The codes only for who use it not for all right?
Код:
Delete3DTextLabel(fRepfamtext[playerid]);
		fRepfam[playerid] = 0;
		fRepfamTimer[playerid] = gettime()+0;
Reply
#6

HI
Reply
#7

HEY?? STILL SAME
Reply
#8

Quote:
Originally Posted by PierreMarley
Посмотреть сообщение
HEY?? STILL SAME
Please don't spam, give me a moment to read your post and i will edit this post to see what i can help with, don't reply to this until i edit it or wait until someone else helps you, thanks.
Reply
#9

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Please don't spam, give me a moment to read your post and i will edit this post to see what i can help with, don't reply to this until i edit it or wait until someone else helps you, thanks.
read rules...he can bump his thread every 24 hours.
Reply
#10

Quote:
Originally Posted by PierreMarley
Посмотреть сообщение
My repfam system is kinda bugged, when 4/5 turn it on in the same time it's get turn off from some players why?

all codes of it:

Код:
new Text3D:fRepfamtext[MAX_PLAYERS];
new fRepfam[MAX_PLAYERS];
new fRepfamTimer[MAX_PLAYERS];
Код:
CMD:repfam(playerid, params[])
{
	new string[300];
	if(gettime() < fRepfamTimer[playerid])
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You have to wait 2 minutes to take your bandana off");
		return 1;
	........
    return 1;
}
Also im using this codes when using this cmds /makeleader , /quitgang , /switchfam , /fcreate , OnPlayerDisconnect , OnPlayerConnect , OnPlayerLoad

Код:
Delete3DTextLabel(fRepfamtext[playerid]);
		fRepfam[playerid] = 0;
		fRepfamTimer[playerid] = gettime()+0;
What the problem? wtf
Idk what to reply to this as your code is very confusing and based on variables that i can't see although i can tell you this, did you put in mind what would happen if a player dies/disconnects with that repfam cmd on? also im confused about that timer gettime()+120? , show the /switchfam cmd too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)