death zone - 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: death zone (
/showthread.php?tid=87599)
death zone -
sggassasin - 21.07.2009
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
Re: death zone -
refshal - 21.07.2009
Script Request Thread.
Re: death zone -
abhinavdabral - 21.07.2009
Use PlayerToPoint .... when someone enters the Area ..... Check his name with strcmp ... if the name is matched, then do nothing..but if he/she have a wrong name, then set his/her Health to 0.
Re: death zone -
sggassasin - 22.07.2009
i dont know how to use playertopoint
Re: death zone -
sggassasin - 22.07.2009
actuly come to think of it i dont understand any of it
Re: death zone -
abhinavdabral - 22.07.2009
you want to check rectangluar area or Circular? I will try to make it for you
Re: death zone -
sggassasin - 22.07.2009
Circular
Re: death zone -
abhinavdabral - 22.07.2009
here is the code ..in this code you need to replace NAME with the name you want to allow to enter ..... also this will create Area 51 a locked one.
pawn Код:
/////////////////////////////////////////////////////
///////////// 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;
}
Re: death zone -
refshal - 22.07.2009
@Abhinav: Just a question, why did you include the unused functions? They're useless if they're unused.
Re: death zone -
abhinavdabral - 23.07.2009
I thought I would add something in them..but I didnt .. :P