[SA-MP] [Scripting] Statsi u textdrawowima
Results 1 to 2 of 2
  1. #1
    Senior Member Array
    Join Date
    Mar 2011
    Location
    Banja Luka
    Karma
    17

    Default [Scripting] Statsi u textdrawowima

    1.Korak:Ako koristite gamemodove koji vec imaju statse izbrišite sve vezano za statse ili editujte.
    2.Korak: Pri vrhu skripte ubacite
    Code:
    forward ShowStats(playerid,targetid);
    3 Korak: Nadite u Gamemodu new i ubacite
    Code:
    new Text:TextdrawI[MAX_PLAYERS];
    new Text:TextdrawP[MAX_PLAYERS];
    new Text:TextdrawG[MAX_PLAYERS];
    new Text:TextdrawL[MAX_PLAYERS];
    new Text:TextdrawR[MAX_PLAYERS];
    new Text:TextdrawW[MAX_PLAYERS];
    new Text:TextdrawS[MAX_PLAYERS];
    new Text:TextdrawD[MAX_PLAYERS];
    new Text:TextdrawB[MAX_PLAYERS];
    new pokazanistatsi[MAX_PLAYERS];
    Naravno pazite da nemate vec u GM tako definirane.
    4. Korak: Pod
    Code:
    public OnPlayerConnect(playerid)
    Stavite:
    Code:
     pokazanistatsi[playerid] = 0;
    
    	PlayerInfo[playerid][pAge] = 0;
    	PlayerInfo[playerid][pLevel] = 0;
    	PlayerInfo[playerid][pConnectSeconds] = 0;
    	PlayerInfo[playerid][pExp] = 0;
    	new randphone = 100000 + random(899999);//minimum 1000  max 9999 //giving one at the start
    	PlayerInfo[playerid][pPnumber] = randphone;
    5. Korak: Sada treba dodati pamcenje Novaca, levela, zavisi sta sste sve stavili.
    pod
    Code:
    enum pInfo
    Ubacite
    Code:
    pPnumber,
    	pExp,
    	pAge,
    	pLevel,
    	pConnectSeconds,
    6. Korak: Ako editujete samo promijenite ako nemate i radite ispocetka pravite
    Code:
    public ShowStats(playerid,targetid)
    7.Korak:Pod public ShowStats(playerid,targetid) definiramo
    Code:
    new age = PlayerInfo[targetid][pAge];
    		new level = PlayerInfo[targetid][pLevel];
    		new atext[20];
    		new exp = PlayerInfo[targetid][pExp];
    		new expamount = nxtlevel*levelexp;
    		new pnumber = PlayerInfo[targetid][pPnumber];
    		new ptime = PlayerInfo[targetid][pConnectSeconds];
    		new name[MAX_PLAYER_NAME];
    		GetPlayerName(targetid, name, sizeof(name));
    8.Korak: Došli smo do koraka kada pravimo textdrawowe.Najlakše vam je pomocu Textdraw editora napraviti (imate na dnu među boljim editorima za downloadat).
    Evo primjer textdrawowa kako trebaju izgledati UPOZORENJE:Ovo je opće i nemojte kopirati u GM zato sto nece raditi.
    Code:
       new coordsstring[256];
       //STATS TEXTDRAWS
        	format(coordsstring, sizeof(coordsstring),"Ime: %s",name);
        	TextdrawI[playerid] = TextDrawCreate(Kordinate, coordsstring);
        	TextDrawBackgroundColor(TextdrawI[playerid], 255);
        	TextDrawFont(TextdrawI[playerid], 1);
        	TextDrawLetterSize(TextdrawI[playerid], 0.500000, 1.000000);
        	TextDrawColor(TextdrawI[playerid], -1);
        	TextDrawSetOutline(TextdrawI[playerid], 0);
        	TextDrawSetProportional(TextdrawI[playerid], 1);
        	TextDrawSetShadow(TextdrawI[playerid], 1);
    
        	format(coordsstring, sizeof(coordsstring),"Spol: %s",atext);
    	    TextdrawP[playerid] = TextDrawCreate(Kordinate, coordsstring);
        	TextDrawBackgroundColor(TextdrawP[playerid], 255);
        	TextDrawFont(TextdrawP[playerid], 1);
        	TextDrawLetterSize(TextdrawP[playerid], 0.500000, 1.000000);
        	TextDrawColor(TextdrawP[playerid], -1);
        	TextDrawSetOutline(TextdrawP[playerid], 0);
        	TextDrawSetProportional(TextdrawP[playerid], 1);
        	TextDrawSetShadow(TextdrawP[playerid], 1);
    
            format(coordsstring, sizeof(coordsstring),"Godina: %d",age);
        	TextdrawG[playerid] = TextDrawCreate(kordinate,coordsstring);
        	TextDrawBackgroundColor(TextdrawG[playerid], 255);
        	TextDrawFont(TextdrawG[playerid], 1);
        	TextDrawLetterSize(TextdrawG[playerid], 0.500000, 1.000000);
        	TextDrawColor(TextdrawG[playerid], -1);
        	TextDrawSetOutline(TextdrawG[playerid], 0);
        	TextDrawSetProportional(TextdrawG[playerid], 1);
        	TextDrawSetShadow(TextdrawG[playerid], 1);
    
            format(coordsstring, sizeof(coordsstring),"Level: %d",level);
        	TextdrawL[playerid] = TextDrawCreate(kordinate,coordsstring);
        	TextDrawBackgroundColor(TextdrawL[playerid], 255);
        	TextDrawFont(TextdrawL[playerid], 1);
        	TextDrawLetterSize(TextdrawL[playerid], 0.500000, 1.000000);
        	TextDrawColor(TextdrawL[playerid], -1);
        	TextDrawSetOutline(TextdrawL[playerid], 0);
        	TextDrawSetProportional(TextdrawL[playerid], 1);
        	TextDrawSetShadow(TextdrawL[playerid], 1);
    
            format(coordsstring, sizeof(coordsstring),"Sati igre: %d",ptime / 3600);
        	TextdrawS[playerid] = TextDrawCreate(kordinate,coordsstring);
        	TextDrawBackgroundColor(TextdrawS[playerid], 255);
        	TextDrawFont(TextdrawS[playerid], 1);
        	TextDrawLetterSize(TextdrawS[playerid], 0.500000, 1.000000);
        	TextDrawColor(TextdrawS[playerid], -1);
        	TextDrawSetOutline(TextdrawS[playerid], 0);
        	TextDrawSetProportional(TextdrawS[playerid], 1);
        	TextDrawSetShadow(TextdrawS[playerid], 1);
    
            format(coordsstring, sizeof(coordsstring),"Respekt: %d/%d",exp,expamount);
        	TextdrawR[playerid] = TextDrawCreate(kordinate,coordsstring);
        	TextDrawBackgroundColor(TextdrawR[playerid], 255);
        	TextDrawFont(TextdrawR[playerid], 1);
        	TextDrawLetterSize(TextdrawR[playerid], 0.500000, 1.000000);
        	TextDrawColor(TextdrawR[playerid], -1);
        	TextDrawSetOutline(TextdrawR[playerid], 0);
        	TextDrawSetProportional(TextdrawR[playerid], 1);
        	TextDrawSetShadow(TextdrawR[playerid], 1);
    
            format(coordsstring, sizeof(coordsstring),"Broj: %d",pnumber);
        	TextdrawB[playerid] = TextDrawCreate(kordinate,coordsstring);
        	TextDrawBackgroundColor(TextdrawB[playerid], 255);
        	TextDrawFont(TextdrawB[playerid], 1);
        	TextDrawLetterSize(TextdrawB[playerid], 0.500000, 1.000000);
        	TextDrawColor(TextdrawB[playerid], -1);
        	TextDrawSetOutline(TextdrawB[playerid], 0);
        	TextDrawSetProportional(TextdrawB[playerid], 1);
        	TextDrawSetShadow(TextdrawB[playerid], 1);
    Naravno to stavite ispod to jest na kraju
    Code:
    pod public ShowStats(playerid,targetid)
    Umjesto Kordinate sta pišu
    Code:
    TextDrawCreate(kordinate,coordsstring);
    stavljate kordinate gdje ce se textdraw nalazit ..
    Code:
    TextDrawFont(TextdrawB[playerid], 1);
    Font od toga textdrawa mozete promijeniti kako vam paše.
    Code:
    TextDrawColor(TextdrawB[playerid], -1);
    Boja Textdrawa.

    Credits : $--L84S--$
    Last edited by k@lu^; 16-04-2012 at 11:08.

  2. #2
    Senior Member Array
    Join Date
    Mar 2011
    Location
    Banja Luka
    Karma
    17

    Default

    -------------------------NASTAVAK------------

    9.Korak: Pravimo komandu /stats
    prvo pod public
    Code:
    OnPlayerCommandText(playerid, cmdtext[])
    Code:
     ------------------------------------------statsi----------------------------------------------------------------
    	if (strcmp(cmd, "/stats", true) == 0)
    	{
    	    if(IsPlayerConnected(playerid))
    	    {
    			if (gPlayerLogged[playerid] != 0)
    			{
    			    if(pokazanistatsi[playerid] == 0)
    			    {
    					ShowStats(playerid,playerid);
    					GetPlayerName(playerid, sendername, sizeof(sendername));
    			    	format(string, sizeof(string), "* %s gleda dokumente", sendername);
    			    	ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawI[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawP[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawG[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawL[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawR[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawW[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawS[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawD[playerid]);
    			    	TextDrawShowForPlayer(playerid,Text:TextdrawB[playerid]);
    			    	pokazanistatsi[playerid] = 1;
    			    }
    			    else if(pokazanistatsi[playerid] == 1)
    			    {
    		 			TextDrawHideForPlayer(playerid, TextdrawI[playerid]);
    		 			TextDrawHideForPlayer(playerid, TextdrawP[playerid]);
     					TextDrawHideForPlayer(playerid, TextdrawG[playerid]);
    		 			TextDrawHideForPlayer(playerid, TextdrawL[playerid]);
    		 			TextDrawHideForPlayer(playerid, TextdrawR[playerid]);
    		 			TextDrawHideForPlayer(playerid, TextdrawW[playerid]);
    		 			TextDrawHideForPlayer(playerid, TextdrawS[playerid]);
    		 			TextDrawHideForPlayer(playerid, TextdrawD[playerid]);
    		 			TextDrawHideForPlayer(playerid, TextdrawB[playerid]);
    		 			TextDrawDestroy(TextdrawI[playerid]);
    		 			TextDrawDestroy(TextdrawP[playerid]);
    		 			TextDrawDestroy(TextdrawG[playerid]);
    		 			TextDrawDestroy(TextdrawL[playerid]);
    		 			TextDrawDestroy(TextdrawR[playerid]);
    		 			TextDrawDestroy(TextdrawW[playerid]);
    		 			TextDrawDestroy(TextdrawS[playerid]);
    		 			TextDrawDestroy(TextdrawD[playerid]);
     					TextDrawDestroy(TextdrawB[playerid]);
    		 			pokazanistatsi[playerid] = 0;
    			    }
    			}
    			else
    			{
    				SendClientMessage(playerid, COLOR_GRAD1, "   Niste prijavljeni!");
    			}
    		}
    		return 1;
    	}
    
              else if(pokazanistatsi[playerid] == 1)
    	           {
     		    	TextDrawHideForPlayer(playerid, TextdrawI[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawP[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawG[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawL[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawR[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawW[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawS[playerid]);
     			    TextDrawHideForPlayer(playerid, TextdrawD[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawB[playerid]);
     		    	TextDrawDestroy(TextdrawI[playerid]);
     		    	TextDrawDestroy(TextdrawP[playerid]);
     		    	TextDrawDestroy(TextdrawG[playerid]);
     		    	TextDrawDestroy(TextdrawL[playerid]);
     		    	TextDrawDestroy(TextdrawR[playerid]);
     			    TextDrawDestroy(TextdrawW[playerid]);
     		    	TextDrawDestroy(TextdrawS[playerid]);
     		    	TextDrawDestroy(TextdrawD[playerid]);
     		    	TextDrawDestroy(TextdrawB[playerid]);
        		    pokazanistatsi[playerid] = 0;
                    }
    Evo da malo objasnim
    Code:
    TextDrawShowForPlayer(playerid,Text:TextdrawI[playerid]);
    Kada kucate /stats pokazuje vam textdraw.
    Code:
    TextDrawHideForPlayer(playerid, TextdrawI[playerid]);
    Sakriva textdraw nakon gasenja tipkom shift.
    i na kraju
    Code:
    TextDrawDestroy(TextdrawI[playerid]);
    Pomocu toga unistavate textdraw.
    10. Korak: Pod
    Code:
    else if (PRESSED(KEY_SPRINT))
    Code:
     else if(pokazanistatsi[playerid] == 1)
    	           {
     		    	TextDrawHideForPlayer(playerid, TextdrawI[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawP[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawG[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawL[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawR[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawW[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawS[playerid]);
     			    TextDrawHideForPlayer(playerid, TextdrawD[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawB[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawPo[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawO[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawRa[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawDr[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawM[playerid]);
     		    	TextDrawHideForPlayer(playerid, TextdrawDt[playerid]);
     		    	TextDrawDestroy(TextdrawI[playerid]);
     		    	TextDrawDestroy(TextdrawP[playerid]);
     		    	TextDrawDestroy(TextdrawG[playerid]);
     		    	TextDrawDestroy(TextdrawL[playerid]);
     		    	TextDrawDestroy(TextdrawR[playerid]);
     			    TextDrawDestroy(TextdrawW[playerid]);
     		    	TextDrawDestroy(TextdrawS[playerid]);
     		    	TextDrawDestroy(TextdrawD[playerid]);
     		    	TextDrawDestroy(TextdrawB[playerid]);
     		    	TextDrawDestroy(TextdrawPo[playerid]);
     		    	TextDrawDestroy(TextdrawO[playerid]);
     		    	TextDrawDestroy(TextdrawRa[playerid]);
     		    	TextDrawDestroy(TextdrawDr[playerid]);
     		    	TextDrawDestroy(TextdrawM[playerid]);
     			    TextDrawDestroy(TextdrawDt[playerid]);
        		    pokazanistatsi[playerid] = 0;
                    }
    Znaci To vam je zadnji korak pomoću tipke Shift gasite textdrawove sve to jest Statse.
    Naravano vi mozete staviti da sa drugim tipkama i sa nekom komandom npr. /ugasi ili tako nesto to je vaš izbor.

    SLIKA : http://img828.imageshack.us/img828/261/statsi1.jpg

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •