21.07.2009, 11:43
i need a a scripft where i can put someone name into a script and they can go into a sertain place but if they dont have the right name they get killed when they tryed to enter
/////////////////////////////////////////////////////
///////////// Script by Abhinav ////////////////////
///////////////////////////////////////////////////
#include <a_samp>
forward DeathZone();
new DZTimer;
new bool:Found[MAX_PLAYERS]=false;
public OnFilterScriptInit()
{
DZTimer=SetTimer("DeathZone",100,1);
GangZoneShowForAll(GangZoneCreate(95.0,1800.0,286.0,1940.0),0xEE3333FF);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(DZTimer);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public DeathZone(){
for(new i;i<=MAX_PLAYERS;i++){
Found[i]=false;
if(IsPlayerConnected(i) && IsPlayerInArea(i,95.0,286.0,1800.0,1940.0)){
if(!strcmp(GetPName(i),"NAME",false,8) && strlen(GetPName(i))==8) Found[i]=true; ///// chnage NAME to the desired name you want
}
if(!Found[i] && IsPlayerConnected(i) && IsPlayerInArea(i,95.0,286.0,1800.0,1940.0)){
SetPlayerHealth(i,0);
return 1;
}
}
return 1;
}
stock 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;
}
else{
return 0;
}
}
stock GetPName(playerid){
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}