strcmp name, if false, how to return?
#1

hello all!

Today, I was trying to make a command that opens a gate.
I got the gate working perfectly, But i am also trying to make that gate opening ONLY for a specific name. I used strcmp to check the name, and still it opens for others.


I mean, if the player isn't named driftking, how can I return: sorry, you are not allowed to open this gate?

because now it opens the gate for everyone.

Thanks a lot, and I am not good explaining, sorry.

pawn Код:
if(strcmp(cmd, "/open", true) == 0) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if (strcmp(name, "[Mw]drifking", false))
{
    if(IsPlayerInRangeOfPoint(playerid, 11.0, 1497.19000000,-710.91000000,97.61000000))
            {
            MoveObject(gate, 1497.19000000,-714.91000000,101.61000000,2);//This will move the gate
            SendClientMessage(playerid,COLOR_BLUE,"GATE OPENING! (ALERT; ALERT)");//This will send an message announcing the gate Stats!
            SetTimer("GateClose", 8000, 0);//This will start the counting till the gate will be closed
            }
   if(!IsPlayerInRangeOfPoint(playerid, 11.0, 1497.19000000,-710.91000000,97.61000000))
            {
            SendClientMessage(playerid, COLOR_YELLOW, "You are not close enough to the gate!");
            }
}
if (!strcmp(name, "[Mw]drifking", false)){SendClientMessage(playerid,COLOR_BLUE,"You are not allowed to open this gate, sorry!");}


            return 1;
 }
Thats my try. xD
Reply


Messages In This Thread
strcmp name, if false, how to return? - by denNorske - 17.08.2012, 07:20
Re: strcmp name, if false, how to return? - by FalconX - 17.08.2012, 07:39
Re: strcmp name, if false, how to return? - by denNorske - 17.08.2012, 07:51
Re: strcmp name, if false, how to return? - by denNorske - 17.08.2012, 08:12
Re: strcmp name, if false, how to return? - by FalconX - 17.08.2012, 08:17
Re: strcmp name, if false, how to return? - by denNorske - 17.08.2012, 08:19

Forum Jump:


Users browsing this thread: 1 Guest(s)