Double IFs in one command problem
#1

I want to show players a dialog, but NOT if they have less than one hour playtime.

How do i define two IFs in one?

Example:

pawn Код:
if(IsPlayerInRangeOfPoint(playerid,COORDZ))
        {
            ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "DIALOG Stuff here");
        }
That's my command, But i want to include this too:
pawn Код:
if(PlayerInfo[playerid][pHourz] < 1)
        {
            SendClientMessage(playerid, COLOR-HERE, "  Text here.");
            return 1;
        }
Basically, if they are at place and have one hour play time it shows.

If less than 1 hour playing time: YOU CANT BUY

If they arent at the place, they get a message

how do i include two IFs in one?

something like as in INRANGEBLABLA && HASTIME BLABLA

+rep for best answer
Reply
#2

pawn Код:
new a,b,bool:c;
if(!c && a == 1||
c && b == 0 ||
!c && a == 0)
This?
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInRangeOfPoint(playerid,COORDZ))
        {
            SendClientMessage(playerid,-1,"You are not at the COORDZ");
            return 1;
        }
        if(PlayerInfo[playerid][pHourz] < 1)
        {
            SendClientMessage(playerid, COLOR-HERE, "  Text here.");
            return 1;
        }
        ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "DIALOG Stuff here");
        return 1;
    }
    return 0;
}
try like that.
Reply
#4

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInRangeOfPoint(playerid,COORDZ))
        {
            SendClientMessage(playerid,-1,"You are not at the COORDZ");
            return 1;
        }
        if(PlayerInfo[playerid][pHourz] < 1)
        {
            SendClientMessage(playerid, COLOR-HERE, "  Text here.");
            return 1;
        }
        ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "DIALOG Stuff here");
        return 1;
    }
    return 0;
}
try like that.
exactly how i want it, but now i get 1million errrs + pawn crash.
Reply
#5

Here you go.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInRangeOfPoint(playerid,COORDZ))
        {
            if(PlayerInfo[playerid][pHourz] < 1)
            {
                ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "DIALOG Stuff here");
            }
            else SendClientMessage(playerid, -1, "You do not have an hours playing time");
        }
        else SendClientMessage(playerid,-1,"You are not at the COORDZ");
        return 1;
   }
}
This would activate the function, -IF- the player is inside the specific coordinations and has 1 "Hourz".
Reply
#6

Quote:
Originally Posted by Blunt
Посмотреть сообщение
Here you go.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInRangeOfPoint(playerid,COORDZ))
        {
            if(PlayerInfo[playerid][pHourz] < 1)
            {
                ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "DIALOG Stuff here");
            }
            else SendClientMessage(playerid, -1, "You do not have an hours playing time");
        }
        else SendClientMessage(playerid,-1,"You are not at the COORDZ");
        return 1;
   }
}
This would activate the function, -IF- the player is inside the specific coordinations and has 1 "Hourz".
exactly as i want it, but it just says i don't have 1 hour now. the "phourz" was just an example of my shit btw.
Reply
#7

Quote:
Originally Posted by Deathh
Посмотреть сообщение
exactly how i want it, but now i get 1million errrs + pawn crash.
and what are those +1millsion erorrs?
Reply
#8

Код:
if(IsPlayerInRangeOfPoint(playerid,COORDZ) && PlayerInfo[playerid][pHourz] < 1)
{
	ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "DIALOG Stuff here");
}
You mean this?
Reply
#9

Quote:
Originally Posted by The DeLuca
Посмотреть сообщение
Код:
if(IsPlayerInRangeOfPoint(playerid,COORDZ) && PlayerInfo[playerid][pHourz] < 1)
{
	ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "DIALOG Stuff here");
}
You mean this?
Yes i believe that is infact what he needs.

Quote:
Originally Posted by Kaczmi
Посмотреть сообщение
pawn Код:
new a,b,bool:c;
if(!c && a == 1||
c && b == 0 ||
!c && a == 0)
This?
Seriously? This is [sarcasm]REALLY...REALLY HELPFUL![/sarcasm] -_-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)