SA-MP Forums Archive
How to display "clear" or "In Use" depending on the value of a varabile. - 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: How to display "clear" or "In Use" depending on the value of a varabile. (/showthread.php?tid=217957)



How to display "clear" or "In Use" depending on the value of a varabile. - Haydz - 29.01.2011

Hey guys, how can i display either "Clear" or "In Use" depending of value of a certain varabile.

pawn Код:
new string[170];
format(string,sizeof(string),"Las Venturas Airport Information\n\t- Active Runways\n\t\t27L -\tInUse\n\t\t27R -\tClear\n\t\t9L -\t%s\n\t\t9R -\t%s\n\t- Active Aircrafts\t- %d\n\t- Windspeed(Knots)\t- %d",
                aircraftcount,GetPVarInt(playerid,"randomknots"));
                ShowPlayerDialog(playerid, LVAIRPORTDISPLAY, DIALOG_STYLE_LIST, "Air Traffic Control",string, "Ok", "Exit");
As you can see i'v put %s beside runways 9L and R. so if a player types /land it will declare a certain a certain runway varabile to "1"

here the /land command.
pawn Код:
if (IsPlayerInRangeOfPoint(playerid, 700, 1306.2268, 1262.2083, 14.2656) == 1)
{
    if (LV9L == 1)
    {
        LV9L = 1;
        SetTimerEx("timer_reset", 20000, false, "i", 1);
        GameTextForPlayer(playerid, "You're allowed to land at Las venturas Airport 9L", 6500, 6);
        format(string, sizeof string, "%s@Radio: is landing at LV9L", PlayerInfo[playerid][CallSign]) && SendClientMessageToAll(COLOR_GREY, string);
    }
    if (LV9R == 1)
    {
        LV9R = 1;
        SetTimerEx("timer_reset", 20000, false, "i", 1);
        GameTextForPlayer(playerid, "You're allowed to land at Las venturas Airport 9R", 6500, 6);
        format(string, sizeof string, "%s@Radio: is landing at LV9R", PlayerInfo[playerid][CallSign]) && SendClientMessageToAll(COLOR_GREY, string);
    }
}
so if LV9R was varabile = 1
and LV9L was varabile = 0
The dialog would display
LV9R - In Use
LV9L - Clear.

Not really sure what i would use considering i havn't done anything like this before.


Re: How to display "clear" or "In Use" depending on the value of a varabile. - Toreno - 29.01.2011

Yes, you can do when variable is 1 then its okay to land at a specific place and if variable is 0.
Send another msg.


Re: How to display "clear" or "In Use" depending on the value of a varabile. - Haydz - 29.01.2011

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
Yes, you can do when variable is 1 then its okay to land at a specific place and if variable is 0.
Send another msg.
please read the topic next time.


Re: How to display "clear" or "In Use" depending on the value of a varabile. - Infamous - 29.01.2011

Is this 'LV9R = 1;' being set to 1 before the player types the command?

Also this is kinda pointless:

pawn Код:
if (LV9L == 1)
    {
        LV9L = 1;
Surely you want that to be set to 0 after it has been called as the player landing will be a hazzard to other people typing the command.


Re: How to display "clear" or "In Use" depending on the value of a varabile. - Haydz - 29.01.2011

ah yes that is correct. i had if(LV9L == 1) return send blah before meaning if somebody was landing it would say they couldn't land. Just havn't got around to changing that yet. but when a player types /land if nobody is landing it will set the runway number to 1.