dialog dont spawn car
#1

Код:
if(dialogid == DIALOG_RENTCAR)
	{
		if(response)
		{
			if(listitem == 0)
			{
				if(inRent[playerid] == 0)
				{
					if(MasinaUnu != 0)
					{
						MasinaUnu--;
						inRent[playerid] = 1;
						IDmasinaInchiriata[playerid] = 526;
						masinaInchiriata[playerid] = CreateVehicle(526, 2148.4204, -1153.0442, 23.6379, -89.1600, -1, -1, 100);
						PutPlayerInVehicle(playerid, masinaInchiriata[playerid], 0);
						SendClientMessage(playerid, COLOR_WHITE, "Ai platit $30.000 pentru a inchiria acest vehicul.");
						SendClientMessage(playerid, COLOR_WHITE, "Ai grija ca cineva sa nu iti fure vehiculul, tu ii vei plati calatoria.");
						SendClientMessage(playerid, COLOR_WHITE, "Poti renunta oricand la masina inchiriata folosind [/unrentveh].");
						GivePlayerCash(playerid, -30000);
					}
					else if(MasinaUnu == 0)
					{
						SendClientMessage(playerid, COLOR_WHITE, "Vehiculul selectat nu se mai afla in stock-ul afacerii!");
					}
				}
			}
		}
	}
what's wrong with this code? it should spawn the vehicle but it doesn't
Reply
#2

Hi
Try this
PHP код:
if(dialogid == DIALOG_RENTCAR)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                if(
inRent[playerid] == 0)
                {
                    if(
MasinaUnu != 0)
                    {
                        
MasinaUnu--;
                        
inRent[playerid] = 1;
                        
IDmasinaInchiriata[playerid] = 526;
                                                new 
Float:xFloat:yFloat:zFloat:angle;
                                            
GetPlayerPos(playeridxyz);
                                            
GetPlayerFacingAngle(playeridangle);
                        
masinaInchiriata[playerid] = CreateVehicle(526xyzangle, -1, -1,-1); 
                        
PutPlayerInVehicle(playeridmasinaInchiriata[playerid], 0);
                        
SendClientMessage(playeridCOLOR_WHITE"Ai platit $30.000 pentru a inchiria acest vehicul.");
                        
SendClientMessage(playeridCOLOR_WHITE"Ai grija ca cineva sa nu iti fure vehiculul, tu ii vei plati calatoria.");
                        
SendClientMessage(playeridCOLOR_WHITE"Poti renunta oricand la masina inchiriata folosind [/unrentveh].");
                        
GivePlayerCash(playerid, -30000);
                    }
                    else if(
MasinaUnu == 0)
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"Vehiculul selectat nu se mai afla in stock-ul afacerii!");
                    }
                }
            }
        }
               return 
1;
    } 
What is IDmasinaInchiriata[playerid]?

rep++, If it works
Reply
#3

same thing, doesnt even spawn a car

IDmasinaInchiriata[playerid] defines the id of the car
Reply
#4

hey, any ideas?
Reply
#5

Here you go, i think it should work.
PHP код:
 if(response)
        {
            if(
listitem == 0)
            {
                if(
inRent[playerid] == 0)
                {
                    if(
MasinaUnu != 0)
                    {
                        
MasinaUnu--;
                        
inRent[playerid] = 1;
                        
IDmasinaInchiriata[playerid] = 526;
                                            new 
Float:xFloat:yFloat:zFloat:angle;
                                            
GetPlayerPos(playeridxyz);
                                            
GetPlayerFacingAngle(playeridangle);
                                            new 
vehicle CreateVehicle(IDmasinaInchiriata[playerid] , xyzangle, -1, -1,-1); 
                        
PutPlayerInVehicle(playeridvehicle0);
                        
SendClientMessage(playeridCOLOR_WHITE"Ai platit $30.000 pentru a inchiria acest vehicul.");
                        
SendClientMessage(playeridCOLOR_WHITE"Ai grija ca cineva sa nu iti fure vehiculul, tu ii vei plati calatoria.");
                        
SendClientMessage(playeridCOLOR_WHITE"Poti renunta oricand la masina inchiriata folosind [/unrentveh].");
                        
GivePlayerCash(playerid, -30000);
                    }
                    else if(
MasinaUnu == 0)
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"Vehiculul selectat nu se mai afla in stock-ul afacerii!");
                    }
                }
            }
        }
               return 
1;
    } 
Reply
#6

return 0; OnDialogResponse cause if you return 1; OnDialogResponse wont be called in other script
Reply
#7

trying with return 0;

will be back with answer
Reply
#8

still no, no changes with return 0/return 1
Reply
#9

any other scripts that use dialogresponse? if yes change to return 0; there too
Reply
#10

Does it display in chat what you're telling it to display? i.e.
PHP код:
SendClientMessage(playeridCOLOR_WHITE"Ai platit $30.000 pentru a inchiria acest vehicul.");
SendClientMessage(playeridCOLOR_WHITE"Ai grija ca cineva sa nu iti fure vehiculul, tu ii vei plati calatoria.");
SendClientMessage(playeridCOLOR_WHITE"Poti renunta oricand la masina inchiriata folosind [/unrentveh]."); 
Does it say that in the chat? if not then it's a problem with "inRent" or "MasinaUnu"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)