Thread: Useful Snippets
View Single Post
Old 30/01/2007, 01:20 PM   #12
[QB]Flame^
Little Clucker
 
Join Date: Apr 2006
Posts: 6
Reputation: 0
Default Re: Useful Snippets

Admin Area
pawn Code:
// Set the timer triggering the function which checks if players are in the 'admin' area

SetTimer("AreaCheck", 1000, 1);

// The function

AreaCheck()
{
    for(new i=0; i<MAX_PLAYERS; i++ ) {
        if(IsPlayerConnected(i) && IsPlayerInArea(i, minx, maxx, miny, maxy) && !IsPlayerAdmin(i)) // CHECK: If the player is a admin, if the player is in the area
        { // He's not.
            SendClientMessage(i, YOURCOLOR, "You are not allowed to enter the ADMIN area.");
            /* Do with him whatever
                you want */

        }
    }
}

// ISPIA Function

IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}

Since it's something most newb scripters want to have, and "cant" find it, i'll post a very basic one. Hopefully this will stop some of the 'I cant find a working code' bs.
[QB]Flame^ is offline   Reply With Quote