SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Русский/Russian

Reply
 
Thread Tools Display Modes
Old 05/01/2015, 04:29 PM   #1
DeViLsS
Big Clucker
 
Join Date: Oct 2014
Posts: 88
Reputation: 0
Default Перемещение предметов по слотам.

Как сделать перемещение предметов по слотам.

Code:
for(new i; i < 48; i++)
    {
    	if(playertextid == InvSlot[playerid][i])  
        {        
        	if(GetPVarInt(playerid, "SelectSlot") == -1)
            {
            	if(PlayerInfo[playerid][pInvSlot][i] != -1)
                {
                	SetPVarInt(playerid, "SelectSlot", i);                
                    
                    PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][i], 0xf2ddc6ff);
				    PlayerTextDrawShow(playerid, InvSlot[playerid][i]);
                
                }
            }
            
            else if(GetPVarInt(playerid, "SelectSlot") != -1) 
            {
            	if(PlayerInfo[playerid][pInvSlot][i] == -1) 
                {
                	SetPVarInt(playerid, "NewSelectSlot", i);   
                    
                    PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], -1061109505);
                	PlayerTextDrawShow(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")]);   
                           
                    
                    PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 1649);
                    PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 0.000000, 0.000000, 90.000000, 2.000000);
	    			
                    PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], Items_All[PlayerInfo[playerid][pInvSlot][GetPVarInt(playerid,"ChangeSlot") - 1]][invObject]);
        			PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], 0.000000, 0.000000, 0.000000, 1.000000);   
                    
                    SetPVarInt(playerid, "SelectSlot", -1);
                    SetPVarInt(playerid, "NewSelectSlot", -1);
                }
            }
        
        	new string[10];
        	format(string, sizeof(string), "Clot %i", i);
            SendClientMessage(playerid, -1, string);  
        }
    }
В чем ошибка, в моем коде?
DeViLsS is offline   Reply With Quote
Old 09/01/2015, 12:47 PM   #2
valych
Big Clucker
 
valych's Avatar
 
Join Date: Aug 2009
Posts: 110
Reputation: 15
Default Re: Перемещение предметов по слотам.

Что именно у тебя не работает?
valych is offline   Reply With Quote
Old 09/01/2015, 01:43 PM   #3
Daea
Big Clucker
 
Join Date: Dec 2013
Posts: 190
Reputation: 2
Default Re: Перемещение предметов по слотам.

Эмм...
Code:
for(new i; i < 48; i++)
    {
    	if(playertextid == InvSlot[playerid][i])  
        {        
        	if(GetPVarInt(playerid, "SelectSlot") == -1)
            {
            	if(PlayerInfo[playerid][pInvSlot][i] != -1)
                {
                	SetPVarInt(playerid, "SelectSlot", i);                
                    
                    PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][i], 0xf2ddc6ff);
				    PlayerTextDrawShow(playerid, InvSlot[playerid][i]);
                
                }
            }
            
            else if(GetPVarInt(playerid, "SelectSlot") != -1) 
            {
            	if(PlayerInfo[playerid][pInvSlot][i] == -1) 
                {
                	SetPVarInt(playerid, "NewSelectSlot", i);   
                    
                    PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], -1061109505);
                	PlayerTextDrawShow(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")]);   
                           
                    
                    PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 1649);
                    PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 0.000000, 0.000000, 90.000000, 2.000000);
	    			
                    PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], Items_All[PlayerInfo[playerid][pInvSlot][GetPVarInt(playerid,"ChangeSlot") - 1]][invObject]);
        			PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], 0.000000, 0.000000, 0.000000, 1.000000);   
                    InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")] = InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")];
                    InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")] = 0;
                    SetPVarInt(playerid, "SelectSlot", -1);
                    SetPVarInt(playerid, "NewSelectSlot", -1);
                }
            }
        
        	new string[10];
        	format(string, sizeof(string), "Clot %i", i);
            SendClientMessage(playerid, -1, string);  
        }
    }
Daea is offline   Reply With Quote
Old 09/01/2015, 01:45 PM   #4
Daea
Big Clucker
 
Join Date: Dec 2013
Posts: 190
Reputation: 2
Default Re: Перемещение предметов по слотам.

А вообще, думаю лучше сделать так:
Code:
new NewSelectSlot = GetPVarInt(playerid,"NewSelectSlot"), SelectSlot = GetPVarInt(playerid,"SelectSlot");
И использовать в данном коде не GetPVarInt(playerid,"NewSelectSlot"), а NewSelectSlot. Просто мне кажется, что каждый раз делать запрос через PVar - плохо. Просто так думаю...
Daea is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Перемещение группы объектов ~Error Русский/Russian 3 07/06/2014 08:17 PM
Перемещение нескольких объектов как один lost13 Русский/Russian 12 11/12/2010 09:58 AM


All times are GMT. The time now is 04:51 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.