I need help with business! - Please HELP me! -
ivanVU - 13.10.2012
I have problem's my business script, i don't know why this doesen't work, i think that problem is with this check with isplayerinrangeofpoint..
Код:
CMD:firma(playerid,params[])
{
new Float:XA,Float:YA,Float:ZA;
new idv = PlayerInfo[playerid][pFirma];
XA = InfoFirme[idv][ExitX]; YA = InfoFirme[idv][ExitY]; ZA = InfoFirme[idv][ExitZ];
if(!IsPlayerInRangeOfPoint(playerid,5.0, XA, YA, ZA)) return SCM(playerid, -1, "You aren't near your business!!");
ShowPlayerDialog(playerid,Dialog_Firme,DIALOG_STYLE_LIST,Business",""SZ"S"B"tate \n"SZ"S"B"ell\n"SZ"F"B"inancies","Ok","Exit");
return true;
}
it show's me dialog, but it doesen't show me any of dialog responses!
Код:
new w[128],Float:XA,Float:YA,Float:ZA;
new idv = PlayerInfo[playerid][pFirma];
XA = InfoFirme[idv][ExitX]; YA = InfoFirme[idv][ExitY]; ZA = InfoFirme[idv][ExitZ];
if(dialogid == Dialog_Firme)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, XA, YA, ZA))
{
if(!response) return SendClientMessage(playerid, -1, "You quit!");
switch(listitem)
{
case 0:
{
format(w,sizeof(w),""SZ"Current state in business: "B"%i$ ",InfoFirme[idv][PareVlasnika]);
SendClientMessage(playerid,-1,w);
}
case 1:
{
DestroyPickup(InfoFirme[idv][PickupFirme]);
InfoFirme[idv][PickupFirme] = CreatePickup(1314, 23, InfoFirme[idv][IzlazXFirme], InfoFirme[idv][IzlazYFirme], InfoFirme[idv][IzlazZFirme]);
format(InfoFirme[idv][VlasnikFirme], 24, "Nitko");
InfoFirme[idv][FirmaNaProdaju] = 1;
GivePlayerMoney(playerid, InfoFirme[idv][CenaFirme]/2);
format(w,sizeof(w),"Prodali ste firmu za %i$!",InfoFirme[idv][CenaFirme]/2);
PlayerInfo[playerid][pFirma] = -1;
SendClientMessage(playerid,-1,w);
UpdateFirme(idv);
format(Label, sizeof(Label), ""SZ"Firma: "B"%s\n"SZ"Vlasnik: "B"%s\n"SZ"Cijena: "B"%i$\n"SZ"Level: "B"%i",InfoFirme[idv][ImeFirme],InfoFirme[idv][VlasnikFirme],InfoFirme[idv][CenaFirme],InfoFirme[idv][LevelFirme]);
Update3DTextLabelText(InfoFirme[idv][LabelFirme],-1,Label);
}
case 2:
{
ShowPlayerDialog(playerid,Dialog_Firme+1,DIALOG_STYLE_INPUT,"Withdraw","How much money you want to withdraw from your account?","Withdraw","Quit");
}
}
}
return true;
}
Re: I need help with business! -
gtakillerIV - 13.10.2012
Instead of:
PHP код:
switch(listitem)
{
case 0:
{
format(w,sizeof(w),""SZ"Current state in business: "B"%i$ ",InfoFirme[idv][PareVlasnika]);
SendClientMessage(playerid,-1,w);
}
case 1:
{
DestroyPickup(InfoFirme[idv][PickupFirme]);
InfoFirme[idv][PickupFirme] = CreatePickup(1314, 23, InfoFirme[idv][IzlazXFirme], InfoFirme[idv][IzlazYFirme], InfoFirme[idv][IzlazZFirme]);
format(InfoFirme[idv][VlasnikFirme], 24, "Nitko");
InfoFirme[idv][FirmaNaProdaju] = 1;
GivePlayerMoney(playerid, InfoFirme[idv][CenaFirme]/2);
format(w,sizeof(w),"Prodali ste firmu za %i$!",InfoFirme[idv][CenaFirme]/2);
PlayerInfo[playerid][pFirma] = -1;
SendClientMessage(playerid,-1,w);
UpdateFirme(idv);
format(Label, sizeof(Label), ""SZ"Firma: "B"%s\n"SZ"Vlasnik: "B"%s\n"SZ"Cijena: "B"%i$\n"SZ"Level: "B"%i",InfoFirme[idv][ImeFirme],InfoFirme[idv][VlasnikFirme],InfoFirme[idv][CenaFirme],InfoFirme[idv][LevelFirme]);
Update3DTextLabelText(InfoFirme[idv][LabelFirme],-1,Label);
}
case 2:
{
ShowPlayerDialog(playerid,Dialog_Firme+1,DIALOG_STYLE_INPUT,"Withdraw","How much money you want to withdraw from your account?","Withdraw","Quit");
}
}
}
return true;
}
Use:
PHP код:
if(response)
{
switch(listitem)
{
case 0:
{
format(w,sizeof(w),""SZ"Current state in business: "B"%i$ ",InfoFirme[idv][PareVlasnika]);
SendClientMessage(playerid,-1,w);
}
case 1:
{
DestroyPickup(InfoFirme[idv][PickupFirme]);
InfoFirme[idv][PickupFirme] = CreatePickup(1314, 23, InfoFirme[idv][IzlazXFirme], InfoFirme[idv][IzlazYFirme], InfoFirme[idv][IzlazZFirme]);
format(InfoFirme[idv][VlasnikFirme], 24, "Nitko");
InfoFirme[idv][FirmaNaProdaju] = 1;
GivePlayerMoney(playerid, InfoFirme[idv][CenaFirme]/2);
format(w,sizeof(w),"Prodali ste firmu za %i$!",InfoFirme[idv][CenaFirme]/2);
PlayerInfo[playerid][pFirma] = -1;
SendClientMessage(playerid,-1,w);
UpdateFirme(idv);
format(Label, sizeof(Label), ""SZ"Firma: "B"%s\n"SZ"Vlasnik: "B"%s\n"SZ"Cijena: "B"%i$\n"SZ"Level: "B"%i",InfoFirme[idv][ImeFirme],InfoFirme[idv][VlasnikFirme],InfoFirme[idv][CenaFirme],InfoFirme[idv][LevelFirme]);
Update3DTextLabelText(InfoFirme[idv][LabelFirme],-1,Label);
}
case 2:
{
ShowPlayerDialog(playerid,Dialog_Firme+1,DIALOG_STYLE_INPUT,"Withdraw","How much money you want to withdraw from your account?","Withdraw","Quit");
}
}
}
else
{
SendClientMessage(playerid, -1, "You quit!");
}
So it will be:
PHP код:
new w[128],Float:XA,Float:YA,Float:ZA;
new idv = PlayerInfo[playerid][pFirma];
XA = InfoFirme[idv][ExitX]; YA = InfoFirme[idv][ExitY]; ZA = InfoFirme[idv][ExitZ];
if(dialogid == Dialog_Firme)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, XA, YA, ZA))
{
if(response)
{
switch(listitem)
{
case 0:
{
format(w,sizeof(w),""SZ"Current state in business: "B"%i$ ",InfoFirme[idv][PareVlasnika]);
SendClientMessage(playerid,-1,w);
}
case 1:
{
DestroyPickup(InfoFirme[idv][PickupFirme]);
InfoFirme[idv][PickupFirme] = CreatePickup(1314, 23, InfoFirme[idv][IzlazXFirme], InfoFirme[idv][IzlazYFirme], InfoFirme[idv][IzlazZFirme]);
format(InfoFirme[idv][VlasnikFirme], 24, "Nitko");
InfoFirme[idv][FirmaNaProdaju] = 1;
GivePlayerMoney(playerid, InfoFirme[idv][CenaFirme]/2);
format(w,sizeof(w),"Prodali ste firmu za %i$!",InfoFirme[idv][CenaFirme]/2);
PlayerInfo[playerid][pFirma] = -1;
SendClientMessage(playerid,-1,w);
UpdateFirme(idv);
format(Label, sizeof(Label), ""SZ"Firma: "B"%s\n"SZ"Vlasnik: "B"%s\n"SZ"Cijena: "B"%i$\n"SZ"Level: "B"%i",InfoFirme[idv][ImeFirme],InfoFirme[idv][VlasnikFirme],InfoFirme[idv][CenaFirme],InfoFirme[idv][LevelFirme]);
Update3DTextLabelText(InfoFirme[idv][LabelFirme],-1,Label);
}
case 2:
{
ShowPlayerDialog(playerid,Dialog_Firme+1,DIALOG_STYLE_INPUT,"Withdraw","How much money you want to withdraw from your account?","Withdraw","Quit");
}
}
}
else
{
SendClientMessage(playerid, -1, "You quit!");
}
}
return 1;
}
Re: I need help with business! -
ivanVU - 13.10.2012
I tried and it didn't worked. again it show's me only dialog, but when i click on something it doesen't want to response.. (dialog response..)
Re: I need help with business! -
gtakillerIV - 13.10.2012
Oh, sorry. This should do it:
PHP код:
new w[128],Float:XA,Float:YA,Float:ZA;
new idv = PlayerInfo[playerid][pFirma];
XA = InfoFirme[idv][ExitX]; YA = InfoFirme[idv][ExitY]; ZA = InfoFirme[idv][ExitZ];
if(dialogid == Dialog_Firme)
{
if(response)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, XA, YA, ZA))
{
switch(listitem)
{
case 0:
{
format(w,sizeof(w),""SZ"Current state in business: "B"%i$ ",InfoFirme[idv][PareVlasnika]);
SendClientMessage(playerid,-1,w);
}
case 1:
{
DestroyPickup(InfoFirme[idv][PickupFirme]);
InfoFirme[idv][PickupFirme] = CreatePickup(1314, 23, InfoFirme[idv][IzlazXFirme], InfoFirme[idv][IzlazYFirme], InfoFirme[idv][IzlazZFirme]);
format(InfoFirme[idv][VlasnikFirme], 24, "Nitko");
InfoFirme[idv][FirmaNaProdaju] = 1;
GivePlayerMoney(playerid, InfoFirme[idv][CenaFirme]/2);
format(w,sizeof(w),"Prodali ste firmu za %i$!",InfoFirme[idv][CenaFirme]/2);
PlayerInfo[playerid][pFirma] = -1;
SendClientMessage(playerid,-1,w);
UpdateFirme(idv);
format(Label, sizeof(Label), ""SZ"Firma: "B"%s\n"SZ"Vlasnik: "B"%s\n"SZ"Cijena: "B"%i$\n"SZ"Level: "B"%i",InfoFirme[idv][ImeFirme],InfoFirme[idv][VlasnikFirme],InfoFirme[idv][CenaFirme],InfoFirme[idv][LevelFirme]);
Update3DTextLabelText(InfoFirme[idv][LabelFirme],-1,Label);
}
case 2:
{
ShowPlayerDialog(playerid,Dialog_Firme+1,DIALOG_STYLE_INPUT,"Withdraw","How much money you want to withdraw from your account?","Withdraw","Quit");
}
}
}
else
{
SendClientMessage(playerid, -1, "You quit!");
}
}
return 1;
}
Re: I need help with business! -
ivanVU - 14.10.2012
Yes I did it like that and it still doesen't work :S
Re: I need help with business! -
Simplyfrag - 14.10.2012
just try and see if it works will you
Re: I need help with business! -
ivanVU - 14.10.2012
I tried as I said, but it doesen't work, so it's not the problem..
Re: I need help with business! -
SwisherSweet - 15.10.2012
omg again wiht the other guys house system bla bla bla here you do
Has this thing you have to do very common error on noob scripters..
https://sampwiki.blast.hk/wiki/OnDialogResponse
Visit the site...
Код:
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
+rep if it helped...
(you have to do this in ever OnDialogResponse you have!!!
Re: I need help with business! -
ivanVU - 15.10.2012
I't didn't help, btw. i re-edited dialog and it look's like this now..
Код:
if(dialogid == Dialog_Firme)
{
if(response)
{
if(listitem == 0)
{
format(w,sizeof(w),""SZ"Current state in business: "B"%i$ ",InfoFirme[idv][PareVlasnika]);
SendClientMessage(playerid,-1,w);
}
if(listitem == 1)
{
DestroyPickup(InfoFirme[idv][PickupFirme]);
InfoFirme[idv][PickupFirme] = CreatePickup(1314, 23, InfoFirme[idv][IzlazXFirme], InfoFirme[idv][IzlazYFirme], InfoFirme[idv][IzlazZFirme]);
format(InfoFirme[idv][VlasnikFirme], 24, "Nitko");
InfoFirme[idv][FirmaNaProdaju] = 1;
GivePlayerMoney(playerid, InfoFirme[idv][CenaFirme]/2);
format(w,sizeof(w),"Prodali ste firmu za %i$!",InfoFirme[idv][CenaFirme]/2);
PlayerInfo[playerid][pFirma] = -1;
SendClientMessage(playerid,-1,w);
UpdateFirme(idv);
format(Label, sizeof(Label), ""SZ"Firma: "B"%s\n"SZ"Vlasnik: "B"%s\n"SZ"Cijena: "B"%i$\n"SZ"Level: "B"%i",InfoFirme[idv][ImeFirme],InfoFirme[idv][VlasnikFirme],InfoFirme[idv][CenaFirme],InfoFirme[idv][LevelFirme]);
Update3DTextLabelText(InfoFirme[idv][LabelFirme],-1,Label);
}
if(listitem == 2)
{
ShowPlayerDialog(playerid,Dialog_Firme+1,DIALOG_STYLE_INPUT,"Withdraw","How much money you want to withdraw from your account?","Withdraw","Quit");
}
}
else
{
SendClientMessage(playerid, -1, "You quit!");
}
return 1;
}
Re: I need help with business! -
fiki574 - 15.10.2012
pawn Код:
if(response)
{
switch(dialogid == Dialog_Firme)
{
case 1:
{
switch(listitem)
{
case 0:
{
format(w,sizeof(w),""SZ"Current state in business: "B"%i$ ",InfoFirme[idv][PareVlasnika]);
SendClientMessage(playerid,-1,w);
}
case 1:
{
DestroyPickup(InfoFirme[idv][PickupFirme]);
InfoFirme[idv][PickupFirme] = CreatePickup(1314, 23, InfoFirme[idv][IzlazXFirme], InfoFirme[idv][IzlazYFirme], InfoFirme[idv][IzlazZFirme]);
format(InfoFirme[idv][VlasnikFirme], 24, "Nitko");
InfoFirme[idv][FirmaNaProdaju] = 1;
GivePlayerMoney(playerid, InfoFirme[idv][CenaFirme]/2);
format(w,sizeof(w),"Prodali ste firmu za %i$!",InfoFirme[idv][CenaFirme]/2);
PlayerInfo[playerid][pFirma] = -1;
SendClientMessage(playerid,-1,w);
UpdateFirme(idv);
format(Label, sizeof(Label), ""SZ"Firma: "B"%s\n"SZ"Vlasnik: "B"%s\n"SZ"Cijena: "B"%i$\n"SZ"Level: "B"%i",InfoFirme[idv][ImeFirme],InfoFirme[idv][VlasnikFirme],InfoFirme[idv][CenaFirme],InfoFirme[idv][LevelFirme]);
Update3DTextLabelText(InfoFirme[idv][LabelFirme],-1,Label);
}
}
}
}
}
else SendClientMessage(playerid, -1, "You quit!");