SA-MP Forums Archive
Need Help About Save "TagSystem" SQL - 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: Need Help About Save "TagSystem" SQL (/showthread.php?tid=502674)



Need Help About Save "TagSystem" SQL - edwardluciano - 25.03.2014

Sorry if my thread wrong section & English skill not good
Thank you for all answers future

i has problem about save when login again and use tag it bug somtime lost first word sometime same follow picture

how can i fix

before log out (Create TAG for player and use tag)



after login again (use TAG again)



this my code

Код:
enum pInfo
{
    pTagger[128],
}

public OnAccountUpdate(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		if(gPlayerLogged[playerid])
		{
		    	MySQLCheckConnection();
				new query[MAX_STRING];
				format(query, MAX_STRING, "UPDATE players SET ");
                                MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Tag", PlayerInfo[playerid][pTagger]);
MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]);
		}
	}
	return 1;
}

public OnPlayerLogin(playerid,password[])
{
	if(IsPlayerNPC(playerid)) return 1;
	MySQLCheckConnection();
	new tmp2[256];
	new string2[256];
	new playername2[MAX_PLAYER_NAME];
	new playernamesplit[3][MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername2, sizeof(playername2));
	split(playername2, playernamesplit, '_');
	MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pPassword]);
	if(strcmp(PlayerInfo[playerid][pPassword],password, true ) == 0 )
	{
		new Data[1024];
		new Field[64];
		new rcnt = 1;
		MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
		samp_mysql_strtok(Field, "|", Data);
		while (samp_mysql_strtok(Field, "|", "")==1)
		{
                      if (rcnt == 1) PlayerInfo[playerid][pTagger] = strmid(PlayerInfo[playerid][pTagger], Field, 0, strlen(Field), 16);
                 }



        if(!strcmp(cmdtext, "/mytag", true))
        {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new string1[256],string2[256],string3[256],string4[256],string5[256],string6[256],mstring[1024];
			format(string1,sizeof(string1),"1. %s",PlayerInfo[playerid][pTagger]);
			format(string6,sizeof(string6),"ถอด Tag ออก");

			format(mstring,sizeof(mstring),"%s", string1);

			ShowPlayerDialog(playerid, DIALOG_TAG, DIALOG_STYLE_LIST, "{FF9900}*~ TAG ~*",mstring, "เลือก", "ยกเลิก");

        }

if(dialogid == DIALOG_TAG)
  	{
  	    new tagmr[128];
  		if(!response) { return 1; }
    	switch (listitem)
     	{
			case 0: //////////////////TAG1
			{
			    if(TagShow[playerid] == 1)
			    {
					Delete3DTextLabel(TagDD[playerid]);
					TagShow[playerid] = 0;
			    }
			    
       			if(PlayerInfo[playerid][pTagcolor]== 1)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xFF0000FF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 2)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0x00CA00FF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 3)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0x2F97FFFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 4)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xFF5EAEFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 5)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xFF8000FF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 6)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0x0000FDFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 7)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0x8F20FFFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 8)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xFFFFFFFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 9)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0x8F8F8FFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 10)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xFF9F9FFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 11)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xB3FFB3FF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 12)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0x9DCEFFFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 13)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xFFBBFFFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 14)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xFFC184FF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
				if(PlayerInfo[playerid][pTagcolor]== 15)
				{
   				   strmid(tagmr, PlayerInfo[playerid][pTagger], 0, strlen(PlayerInfo[playerid][pTagger]), 255);
				   TagDD[playerid] = Create3DTextLabel(tagmr, 0xD7AEFFFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
				   Attach3DTextLabelToPlayer(TagDD[playerid], playerid, 0.0, 0.0, 0.5);
				   TagShow[playerid] = 1;
				   SendClientMessage(playerid, COLOR_WHITE, "*คุณได้ติดตั้ง Tag 1 เรียบร้อย");
				   return 1;
				}
    			SendClientMessage(playerid, COLOR_WHITE, "*** โปรดทราบหากข้อความนี้แสดงเมื่อท่านมี Tag อยู่ตำแหน่งนี้นั่นหมายถึง Tag นี้บัค");
				return 1;
			}
}



Re: Need Help About Save "TagSystem" SQL - edwardluciano - 25.03.2014

(T_ T) no body can fix


Re: Need Help About Save "TagSystem" SQL - Beckett - 25.03.2014

I don't understand it, you mean when someone disconnects there will be a tag on his last position or what?


Re: Need Help About Save "TagSystem" SQL - edwardluciano - 26.03.2014

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
I don't understand it, you mean when someone disconnects there will be a tag on his last position or what?
Admin create TAG give someone , someone use that TAG follow pic



When someone logout & login again , use that TAG again follow pic "it bug not same first"



how can i fix

sorry