SA-MP Forums Archive
Missing: } - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Missing: } (/showthread.php?tid=253077)



Missing: } - Penait1 - 04.05.2011

Can anybody see where i forgot a }?

In this code:

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1957 && response == 1)
{
if(listitem == 0)
{
if(freegift[playerid] == 0)
{
GivePlayerWeapon(playerid, 31, 5000);
SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen a M4! In 4 hours you can choose another gift!");
SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
something[playerid] = 1;
return 1;
}
else if(freegift[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
}
if(listitem == 1)
{
if(freegift[playerid] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
GivePlayerMoney(playerid, 100000);
something[playerid] = 1;
return 1;
}
else if(freegift[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
}
if(listitem == 2)
{
if(freegift[playerid] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen 250 score! In 4 hours you can choose another gift!");
SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 250);
SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
something[playerid] = 1;
return 1;
}
else if(freegift[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
}

(theres also a bit code from dialogresponse under this, but that works perfect)

Thankz


Re: Missing: } - Sascha - 04.05.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1957 && response == 1)
    {
        if(listitem == 0)
        {
            if(freegift[playerid] == 0)
            {
                GivePlayerWeapon(playerid, 31, 5000);
                SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen a M4! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
                SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
                something[playerid] = 1;
                return 1;
            }
            else if(freegift[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
            }
        } //here
        if(listitem == 1)
        {
            if(freegift[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
                SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
                GivePlayerMoney(playerid, 100000);
                something[playerid] = 1;
                return 1;
            }
            else if(freegift[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
            }
        } // here
        if(listitem == 2)
        {
            if(freegift[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen 250 score! In 4 hours you can choose another gift!");
                SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 250);
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
                something[playerid] = 1;
                return 1;
            }
            else if(freegift[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
            }
        }
    }
    return 1;
}



Re: Missing: } - xir - 04.05.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1957 && response == 1)
    {
        if(listitem == 0)
        {
            if(freegift[playerid] == 0)
            {
                GivePlayerWeapon(playerid, 31, 5000);
                SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen a M4! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
                SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
                something[playerid] = 1;
                return 1;
            }
            else if(freegift[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
            }
        }
        if(listitem == 1)
        {
            if(freegift[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
                SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
                GivePlayerMoney(playerid, 100000);
                something[playerid] = 1;
                return 1;
            }
            else if(freegift[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
            }
        }
        if(listitem == 2)
        {
            if(freegift[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Serverguid: {00FF15}You have choosen 250 score! In 4 hours you can choose another gift!");
                SetTimerEx("freegifttimer", 14400000, 0,"e",playerid);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 250);
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
                something[playerid] = 1;
                return 1;
            }
            else if(freegift[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Serverguid: {00FF15}Serverguid: {00FF15}You have choosen $100,00 cash! In 4 hours you can choose another gift!");
                SetPlayerPos(playerid, 1940.4705,-2267.8896,13.5745);
                return 1;
            }
        }
    }
    return 1;
}



Re: Missing: } - Ronaldo_raul™ - 04.05.2011

lol... where is the error message..........show us the line in which u are getting error.....


Re: Missing: } - Sascha - 04.05.2011

Quote:
Originally Posted by ronaldoraul
Посмотреть сообщение
lol... where is the error message..........show us the line in which u are getting error.....
fail lol..
if you forget a } somewhere you get MANY errors with many different lines...
"Missing }" + the code are enough information to fix it...


and 1 advice Penait1:
watch for your indentation (check my version for some ok indentation). this helps you to find those mistakes easier:P


Re: Missing: } - Ronaldo_raul™ - 04.05.2011

Quote:
Originally Posted by Sascha
Посмотреть сообщение
fail lol..
if you forget a } somewhere you get MANY errors with many different lines...
"Missing }" + the code are enough information to fix it...


and 1 advice Penait1:
watch for your indentation (check my version for some ok indentation). this helps you to find those mistakes easier:P
thnks for the suggestions.........