SA-MP Forums Archive
something about gates opening and closing - 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: something about gates opening and closing (/showthread.php?tid=127657)



something about gates opening and closing - thecutkiller - 14.02.2010

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.


Re: something about gates opening and closing - VonLeeuwen - 14.02.2010

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


Re: something about gates opening and closing - Calgon - 14.02.2010

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;
}