Boolean
#1

( I Just started learning pawno, so I'm a Beginner. )
I made /whereismech command that creates a checkpoint at the mechanic place, So What I want is: If the player has already another checkpoint he won't be able to /whereismech, he needs to delete the first one. So I thought about creating a boolean that conatins (false) and after using a checkpoint command the boolean gets a (true) , but as I said I'm new and maybe it's not a good Idea but here is what I tried to do:
pawn Код:
new bool: Bo;
Bo=false;
pawn Код:
if (strcmp(cmdtext, "/whereismech", true) == 0)
    {
        if (Bo == true) return SendClientMessage(playerid, 0xFF0000AA, "You already have an active Checkpoint, use /deletecheckpoint to have another");
        else
        {

        if (!IsPlayerInRangeOfPoint(playerid, 5, 1607.2327, -1841.8683, 13.5116))
        {
            SetPlayerCheckpoint(playerid, 1607.2327, -1841.8683, 13.5116, 3);
            SendClientMessage (playerid, 0xFF0000AA, "Go to the checkpoint and /repair there");
            Bo = true;
            return 1;
        }
        else
        {
        SendClientMessage(playerid, 0xFF0000AA, "You are already in the mechanic place, use /repair, this will cost you 5000$");
        return 1;
        }
        }
    }
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
Bo=false;
return 1;
}
Quote:

(171) : error 017: undefined symbol "Bo"
(182) : error 017: undefined symbol "Bo"
(182) : warning 215: expression has no effect
(219) : error 017: undefined symbol "Bo"
(219) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Reply
#2

At top of script
pawn Код:
new bool:Bo=false;
Reply
#3

Thanks it works,
So I need to add the new's before
pawn Код:
#include <a_samp>
#if defined FILTERSCRIPT
?
Reply
#4

No you need to define it at where you are define your news like example

pawn Код:
new abc;
new abc1;
//here you can define it
new bool:Bo=false;
Reply
#5

I just have One "new" which is
pawn Код:
new bool:Bo=false;
This didn't work
pawn Код:
#include <a_samp>
#if defined FILTERSCRIPT
new bool:Bo=false;
But this one is working fine
pawn Код:
new bool:Bo=false;
#include <a_samp>
#if defined FILTERSCRIPT
Thanks for help (+rep)
Reply
#6

no problem enjoy
Reply
#7

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
At top of script
pawn Код:
new bool:Bo=false;
that will work i think
Reply
#8

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
no problem enjoy
yea but answer me :P why the firs one didn't work? isn't it the same as the second?
Reply
#9

maybe you defined it after your code like

your code is at upside and you defined it after the code
Reply
#10

Quote:
Originally Posted by Sarra
Посмотреть сообщение
yea but answer me :P why the firs one didn't work? isn't it the same as the second?
i think maybe cause this is a FS but in GMs u must put them under the includes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)