SA-MP Forums Archive
Problem in the repfam system - 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: Problem in the repfam system (/showthread.php?tid=645228)



Problem in the repfam system - PierreMarley - 23.11.2017

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


Re: Problem in the repfam system - PierreMarley - 24.11.2017

No one know how to fix this problem?


Re: Problem in the repfam system - ToiletDuck - 24.11.2017

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.


Re: Problem in the repfam system - PierreMarley - 24.11.2017

Thanks, i'll try that


Re: Problem in the repfam system - PierreMarley - 25.11.2017

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;



Re: Problem in the repfam system - PierreMarley - 27.11.2017

HI


Re: Problem in the repfam system - PierreMarley - 11.12.2017

HEY?? STILL SAME


Re: Problem in the repfam system - RogueDrifter - 11.12.2017

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.


Re: Problem in the repfam system - Xeon™ - 11.12.2017

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.


Re: Problem in the repfam system - RogueDrifter - 11.12.2017

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.