Hospital doesn't work Help please -
ruckfules99 - 01.01.2013
Can someone please help me with this code. The first items on the list work in this dialog but the last two (listitem 2 and 3 do not work and I cannot figure out why. They do not do what they are suppose to nor do they return anything. I can't figure it out, please help
Код:
if(dialogid==HOSPITAL_DIALOG) {
new Float:health;
GetPlayerHealth(playerid, health);
if(response) {
ShowPlayerDialog(playerid,HOSPITAL_DIALOG,2,"Los Santos Hospital","Buy Health $1000 Full Health Restore\nBuy Cure $4500 Infections Cure\nBuy Health & Cure $5000 Health Restore & Infections Cured\nBuy Injections $10000 5 Injections For Cops","Select","Cancel");
if(listitem==0) {
if(GetPlayerMoney(playerid) <= 999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(health == 100) {
SendClientMessage(playerid,COLOR_ERROR,"You do not require medical services");
return 1;
}
GivePlayerMoney(playerid,-1000);
SetPlayerHealth(playerid,100.0);
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been healed by the hospital");
return 1;
}
if(listitem==1) {
if(GetPlayerMoney(playerid) <= 4499) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(health == 100) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You do not require medical services");
return 1;
}
if(Chlamydia[playerid] == 1) {
GivePlayerMoney(playerid,-4500);
Chlamydia[playerid] =0;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been cured of infections by the hospital");
return 1;
}
if(listitem==2) {
if(GetPlayerMoney(playerid) <= 4999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(Chlamydia[playerid] == 1 && health == 100) {
SendClientMessage(playerid,COLOR_ERROR,"You do not require medical services");
return 1;
}
GivePlayerMoney(playerid,-5000);
SetPlayerHealth(playerid,100.0);
Chlamydia[playerid] =0;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been healed/cured by the hospital");
return 1;
}
if(listitem==3) {
if(GetPlayerMoney(playerid) <= 9999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford To Buy Injections");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_MARINE && gTeam[playerid] != TEAM_AIRSUPPORT && gTeam[playerid] != TEAM_BOUNTY && gTeam[playerid] != TEAM_SWAT) {
GivePlayerMoney(playerid,-10000);
PlayerDrugs[playerid] += 5;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought 5 injections from the hospital");
SendClientMessage(playerid, 0x00C7FFAA, "Use /inject [amount] to heal yourself");
return 1;
}
}
}
}
}
Re: Hospital doesn't work -
MattSlater - 01.01.2013
You put a listitem inside a listitem lol, listitem 2 & 3 are inside listitem 1
Re: Hospital doesn't work -
IRio97 - 01.01.2013
pawn Код:
if(dialogid==HOSPITAL_DIALOG) {
new Float:health;
GetPlayerHealth(playerid, health);
if(response) {
ShowPlayerDialog(playerid,HOSPITAL_DIALOG,2,"Los Santos Hospital","Buy Health $1000 Full Health Restore\nBuy Cure $4500 Infections Cure\nBuy Health & Cure $5000 Health Restore & Infections Cured\nBuy Injections $10000 5 Injections For Cops","Select","Cancel");
if(listitem==0) {
if(GetPlayerMoney(playerid) <= 999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(health == 100) {
SendClientMessage(playerid,COLOR_ERROR,"You do not require medical services");
return 1;
}
GivePlayerMoney(playerid,-1000);
SetPlayerHealth(playerid,100.0);
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been healed by the hospital");
return 1;
}
if(listitem==1) {
if(GetPlayerMoney(playerid) <= 4499) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(health == 100) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You do not require medical services");
return 1;
}
if(Chlamydia[playerid] == 1) {
GivePlayerMoney(playerid,-4500);
Chlamydia[playerid] =0;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been cured of infections by the hospital");
return 1;
}
return 1;
}
if(listitem==2) {
if(GetPlayerMoney(playerid) <= 4999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(Chlamydia[playerid] == 1 && health == 100) {
SendClientMessage(playerid,COLOR_ERROR,"You do not require medical services");
return 1;
}
GivePlayerMoney(playerid,-5000);
SetPlayerHealth(playerid,100.0);
Chlamydia[playerid] =0;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been healed/cured by the hospital");
return 1;
}
if(listitem==3) {
if(GetPlayerMoney(playerid) <= 9999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford To Buy Injections");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_MARINE && gTeam[playerid] != TEAM_AIRSUPPORT && gTeam[playerid] != TEAM_BOUNTY && gTeam[playerid] != TEAM_SWAT) {
GivePlayerMoney(playerid,-10000);
PlayerDrugs[playerid] += 5;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought 5 injections from the hospital");
SendClientMessage(playerid, 0x00C7FFAA, "Use /inject [amount] to heal yourself");
return 1;
}
}
}
}
}
Re: Hospital doesn't work -
ruckfules99 - 01.01.2013
Okay so my listitem 2 now works but the third one (listitem 3) doesn't work nor return anything. I've tried to fix it and nothing lol.
Код:
if(dialogid==HOSPITAL_DIALOG) {
new Float:health;
GetPlayerHealth(playerid, health);
if(response) {
ShowPlayerDialog(playerid,HOSPITAL_DIALOG,2,"Los Santos Hospital","Buy Health $1000 Full Health Restore\nBuy Cure $4500 Infections Cure\nBuy Health & Cure $5000 Health Restore & Infections Cured\nBuy Injections $10000 5 Injections For Cops","Select","Cancel");
if(listitem==0) {
if(GetPlayerMoney(playerid) <= 999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(health == 100) {
SendClientMessage(playerid,COLOR_ERROR,"You do not require medical services");
return 1;
}
GivePlayerMoney(playerid,-1000);
SetPlayerHealth(playerid,100.0);
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been healed by the hospital");
return 1;
}
if(listitem==1) {
if(GetPlayerMoney(playerid) <= 4499) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(health == 100) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You do not require medical services");
return 1;
}
if(Chlamydia[playerid] == 1) {
GivePlayerMoney(playerid,-4500);
Chlamydia[playerid] =0;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been cured of infections by the hospital");
return 1;
}
return 1;
}
if(listitem==2) {
if(GetPlayerMoney(playerid) <= 4999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford Medical Services");
return 1;
}
if(Chlamydia[playerid] == 0 && health == 100) {
SendClientMessage(playerid,COLOR_ERROR,"You do not require medical services");
return 1;
}
GivePlayerMoney(playerid,-5000);
SetPlayerHealth(playerid,100.0);
Chlamydia[playerid] =0;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have been healed/cured by the hospital");
return 1;
}
return 1;
}
if(listitem==3) {
if(GetPlayerMoney(playerid) <= 9999) {
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE FAIL");
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Afford To Buy Injections");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_MARINE && gTeam[playerid] != TEAM_AIRSUPPORT && gTeam[playerid] != TEAM_BOUNTY && gTeam[playerid] != TEAM_SWAT) {
SendClientMessage(playerid,COLOR_ERROR,"Only Law Enforcment agents can buy injections");
return 1;
}
GivePlayerMoney(playerid,-10000);
PlayerDrugs[playerid] += 5;
SendClientMessage(playerid, 0xA9A9A9AA, "-HOSPITAL- PURCHASE");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought 5 injections from the hospital");
SendClientMessage(playerid, 0x00C7FFAA, "Use /inject [amount] to heal yourself");
return 1;
}
return 1;
}