Help with dialog -
[MKD]Max - 03.07.2011
i have do at first
#define twentyforshop 1000
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == twentyforshop)
{
if(!response){
return 1;
}
switch(listitem)
{
case 0:{
if(GetPlayerMoney(playerid) <= 1499) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Chainsaw ($2000)");
return 1;
}
GivePlayerMoney(playerid,-1500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Chainsaw. You were charged $1500");
GivePlayerWeapon(playerid,9,1);
}
case 1:{
if(GetPlayerMoney(playerid) <= 4) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy flowers ($5)");
return 1;
}
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought flowers. You were charged $5");
GivePlayerWeapon(playerid,14,1);
}
case 2:{
if(GetPlayerMoney(playerid) <= 99) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Baseball Bat ($100)");
return 1;
}
GivePlayerMoney(playerid,-100);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Baseball Bat. You were charged $100");
GivePlayerWeapon(playerid,5,1);
}
case 3:{
if(GetPlayerMoney(playerid) <= 19) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy Beer ($20)");
return 1;
}
GivePlayerMoney(playerid,-20);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought Beer. You were charged $20");
new Float:beerhealth;
GetPlayerHealth(playerid,beerhealth);
if(beerhealth <=95) {
SetPlayerHealth(playerid,beerhealth+5);
}
case 4:{
if(GetPlayerMoney(playerid) <= 999) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Wallet ($1000)");
return 1;
}
if(HasWallet[playerid] >= 1) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You already have a Wallet");
}
GivePlayerMoney(playerid,-1000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Wallet. You were charged $1000");
SendClientMessage(playerid, 0x00C7FFAA, "You can be robbed upto 3 times and not loose any cash");
HasWallet[playerid] =3;
}
case 5:{
if(GetPlayerMoney(playerid) <= 499) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Parachute ($500)");
return 1;
}
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Parachute. You were charged $500");
GivePlayerWeapon(playerid,46,1);
}
case 6:{
if(GetPlayerMoney(playerid) <= 3999) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy some rope ($4000)");
return 1;
}
if(gotRope[playerid] == 1) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, 0x00C7FFAA, "You already have some rope.");
}
GivePlayerMoney(playerid,-4000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought some rope. You were charged $4000");
gotRope[playerid] =1;
}
case 7:{
if(GetPlayerMoney(playerid) <= 999)
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a pair of rusty sissors. ($1000)");
return 1;
}
GivePlayerMoney(playerid,-1000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought rusty sissors.. You were charged $1000");
gotSissors[playerid] =1;
return 1;
}
}
}
Error is at case 4:{ in this line
error code:
Код:
C:\Documents and Settings\LoL\Desktop\lvrcr\gamemodes\lvrcr.pwn(5133) : error 014: invalid statement; not in switch
C:\Documents and Settings\LoL\Desktop\lvrcr\gamemodes\lvrcr.pwn(5133) : warning 215: expression has no effect
C:\Documents and Settings\LoL\Desktop\lvrcr\gamemodes\lvrcr.pwn(5133) : error 001: expected token: ";", but found ":"
C:\Documents and Settings\LoL\Desktop\lvrcr\gamemodes\lvrcr.pwn(5133) : error 029: invalid expression, assumed zero
C:\Documents and Settings\LoL\Desktop\lvrcr\gamemodes\lvrcr.pwn(5133) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: Help with dialog -
MadeMan - 03.07.2011
Indent your code.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == twentyforshop)
{
if(!response)
{
return 1;
}
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) <= 1499)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Chainsaw ($2000)");
return 1;
}
GivePlayerMoney(playerid,-1500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Chainsaw. You were charged $1500");
GivePlayerWeapon(playerid,9,1);
}
case 1:
{
if(GetPlayerMoney(playerid) <= 4)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy flowers ($5)");
return 1;
}
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought flowers. You were charged $5");
GivePlayerWeapon(playerid,14,1);
}
case 2:
{
if(GetPlayerMoney(playerid) <= 99)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Baseball Bat ($100)");
return 1;
}
GivePlayerMoney(playerid,-100);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Baseball Bat. You were charged $100");
GivePlayerWeapon(playerid,5,1);
}
case 3:
{
if(GetPlayerMoney(playerid) <= 19)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy Beer ($20)");
return 1;
}
GivePlayerMoney(playerid,-20);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought Beer. You were charged $20");
new Float:beerhealth;
GetPlayerHealth(playerid,beerhealth);
if(beerhealth <=95)
{
SetPlayerHealth(playerid,beerhealth+5);
}
case 4:
{
if(GetPlayerMoney(playerid) <= 999)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Wallet ($1000)");
return 1;
}
if(HasWallet[playerid] >= 1)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You already have a Wallet");
}
GivePlayerMoney(playerid,-1000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Wallet. You were charged $1000");
SendClientMessage(playerid, 0x00C7FFAA, "You can be robbed upto 3 times and not loose any cash");
HasWallet[playerid] =3;
}
case 5:
{
if(GetPlayerMoney(playerid) <= 499)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Parachute ($500)");
return 1;
}
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Parachute. You were charged $500");
GivePlayerWeapon(playerid,46,1);
}
case 6:
{
if(GetPlayerMoney(playerid) <= 3999)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy some rope ($4000)");
return 1;
}
if(gotRope[playerid] == 1)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, 0x00C7FFAA, "You already have some rope.");
}
GivePlayerMoney(playerid,-4000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought some rope. You were charged $4000");
gotRope[playerid] =1;
}
case 7:
{
if(GetPlayerMoney(playerid) <= 999)
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a pair of rusty sissors. ($1000)");
return 1;
}
GivePlayerMoney(playerid,-1000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought rusty sissors.. You were charged $1000");
gotSissors[playerid] =1;
return 1;
}
}
}
Do you see the problem now?
Re: Help with dialog -
[MKD]Max - 03.07.2011
no its still the same error
only from case 4:{ to case 7:{ this happen when i delete them is compil with out errors
Re: Help with dialog -
MadeMan - 03.07.2011
You have a '}' missing before case 4
Re: Help with dialog -
[MKD]Max - 03.07.2011
never mind i know whats my worng its at case 3: i forget to add at last
}
}
2 backets