new lokuoja[MAX_PLAYERS],sekimas[MAX_PLAERS];
public OnPlayerConnect(playerid)
{
SEKTI = TextDrawCreate( 550, 150, "Liko vaziuoti:~n~~n~" );
TextDrawUseBox(SEKTI,1);
TextDrawBoxColor(SEKTI,0x00000066);
TextDrawTextSize(SEKTI,159, 81);
TextDrawAlignment(SEKTI,0);
TextDrawBackgroundColor(SEKTI,0x000000ff);
TextDrawFont(SEKTI,2);
TextDrawLetterSize(SEKTI,0.199999,1.200005);
TextDrawColor(SEKTI,0xffffffff );
TextDrawSetOutline(SEKTI,1);
TextDrawSetProportional(SEKTI,1);
TextDrawSetShadow(SEKTI,1);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[], success )
{
if(!strcmp(cmdtext, "/sekti", true,4))
{
if(playerDB[playerid][specialybe] == 1) // policijos specialybe, galima keisti
{
if(cmdtext[6]==0){SendClientMessage(playerid, WHITE, "Atsiteleportuoti žaideja pas save: {FF0000}/get{00FF00} Dalis vardo"); return 1;} //Jeigu neteisingai parasai komanda
new vardas[MAX_PLAYER_NAME]; //sukuria new'a
strmid(vardas,cmdtext[5],0,MAX_PLAYER_NAME);
new id = GetPlayeridMid(vardas);
if (playerDB[id][ikalintas]) {SendClientMessage(playerid, RED, "Žaidejas kalejime"); return 1;} //tikrina ar zaidejas kaleime, jei taip tai jis negales /get
playerDB[playerid][rid][0]=id;
sekimas[playerid] = SetTimerEx("Seku", 200, true, "e", playerid);
TextDrawShowForPlayer( playerid, SEKTI);
}
return 1;
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(lokuoja[playerid])
{
new Zaidejas = playerDB[playerid][rid][0];
new vardas[MAX_PLAYER_NAME];
GetPlayerName(Zaidejas,vardas,sizeof(vardas));
new msg[100];
format(msg,sizeof(msg),"Atvykai pas þaidëjà %s ",vardas);
SendClientMessage(playerid,RAUDONA,msg);
KillTimer( sekimas[ playerid ] );
playerDB[playerid][rid][0]=0;
TextDrawHideForPlayer( playerid, SEKTI);
}
return 1;
}
forward Seku(playerid);
public Seku(playerid)
{
new
Zaidejas = playerDB[playerid][rid][0],
Distancija = GetDistanceBetweenPlayers( playerid, Zaidejas ),
String [ 100 ],
Float:Coo[ 3 ]
;
/*
- Gauname Žaidėjo pozicija
- Nustatome CP vietą
*/
lokuoja[playerid] = true;
GetPlayerPos ( Zaidejas, Coo[ 0 ], Coo[ 1 ], Coo[ 2 ] );
SetPlayerCheckpoint( playerid, Coo[ 0 ], Coo[ 1 ], Coo[ 2 ], 5 );
/*
- Formatuojame Žinute
*/
format ( String, sizeof( String ), "Sekimas : %s~n~%dmetrai" ,pName( Zaidejas ) , Distancija );
TextDrawSetString( SEKTI,String );
/*
- Rodome Textdrawus
*/
TextDrawShowForPlayer( playerid, SEKTI);
return true;
}
stock GetDistanceBetweenPlayers( playerid, giveplayerid )
{
new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
GetPlayerPos(playerid, x1, y1, z1);
GetPlayerPos(giveplayerid, x2, y2, z2);
return floatround(floatsqroot(floatpower(floatabs(floatsub(x2,x1)), 2) + floatpower(floatabs(floatsub(y2,y1)),2) + floatpower(floatabs(floatsub(z2,z1)) ,2)));
}