dialog dont spawn car -
enzulikeS - 08.05.2018
Код:
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
Re: dialog dont spawn car -
TadePoleMG - 08.05.2018
Hi
![Smiley](images/smilies/smile.png)
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:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
masinaInchiriata[playerid] = CreateVehicle(526, x, y, z, angle, -1, -1,-1);
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!");
}
}
}
}
return 1;
}
What is IDmasinaInchiriata[playerid]?
rep++, If it works
Re: dialog dont spawn car -
enzulikeS - 08.05.2018
same thing, doesnt even spawn a car
IDmasinaInchiriata[playerid] defines the id of the car
Re: dialog dont spawn car -
enzulikeS - 08.05.2018
hey, any ideas?
Re: dialog dont spawn car -
TadePoleMG - 08.05.2018
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:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
new vehicle = CreateVehicle(IDmasinaInchiriata[playerid] , x, y, z, angle, -1, -1,-1);
PutPlayerInVehicle(playerid, vehicle, 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!");
}
}
}
}
return 1;
}
Re: dialog dont spawn car -
Lokii - 08.05.2018
return 0;
OnDialogResponse cause if you return 1;
OnDialogResponse wont be called in other script
Re: dialog dont spawn car -
enzulikeS - 08.05.2018
trying with return 0;
will be back with answer
Re: dialog dont spawn car -
enzulikeS - 08.05.2018
still no, no changes with return 0/return 1
Re: dialog dont spawn car -
Lokii - 08.05.2018
any other scripts that use dialogresponse? if yes change to return 0; there too
Re: dialog dont spawn car -
ItsRobinson - 08.05.2018
Does it display in chat what you're telling it to display? i.e.
PHP код:
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].");
Does it say that in the chat? if not then it's a problem with "inRent" or "MasinaUnu"