something about gates opening and closing
#1

Hey!

I'm making a base with a gate for a server.
I'm done but now I want such a protection of the gate that you need to have [BS] in your name to open and close the gate.

How can I do this?


Thanks.

Thecutkiller.
Reply
#2

Код:
if(strcmp(cmd, "/open", true) == 0)
{
if(strcmp(GetPlayerName(playerid), "[BS]", true, 3))
{
//do your actions
}
}
You could trys omething like this
Reply
#3

Quote:
Originally Posted by VonLeeuwen
Код:
if(strcmp(cmd, "/open", true) == 0)
{
if(strcmp(GetPlayerName(playerid), "[BS]", true, 3))
{
//do your actions
}
}
You could trys omething like this
1) You can't use GetPlayerName like that, it's a variable that the value is unloaded to
2) strcmp would check the absolute value, meaning that it'd have to be either the whole string or not at the start


pawn Код:
if(strcmp(cmd, "/open", true) == 0)
{
    new Name[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, Name, sizeof( Name ) );
    if( strfind( Name, "[BS]", true ) )
    {
      // Execute
    }
    else
    {
      // Doesn't have "[BS]" in their name, so yeah.
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)