Advertisement
vivaz

/sekti komanda

Jun 15th, 2012
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. new lokuoja[MAX_PLAYERS],sekimas[MAX_PLAERS];
  2.  
  3. public OnPlayerConnect(playerid)
  4. {
  5. SEKTI = TextDrawCreate( 550, 150, "Liko vaziuoti:~n~~n~" );
  6. TextDrawUseBox(SEKTI,1);
  7. TextDrawBoxColor(SEKTI,0x00000066);
  8. TextDrawTextSize(SEKTI,159, 81);
  9. TextDrawAlignment(SEKTI,0);
  10. TextDrawBackgroundColor(SEKTI,0x000000ff);
  11. TextDrawFont(SEKTI,2);
  12. TextDrawLetterSize(SEKTI,0.199999,1.200005);
  13. TextDrawColor(SEKTI,0xffffffff );
  14. TextDrawSetOutline(SEKTI,1);
  15. TextDrawSetProportional(SEKTI,1);
  16. TextDrawSetShadow(SEKTI,1);
  17. return 1;
  18. }
  19. public OnPlayerCommandText(playerid, cmdtext[], success )
  20. {
  21. if(!strcmp(cmdtext, "/sekti", true,4))
  22. {
  23. if(playerDB[playerid][specialybe] == 1) // policijos specialybe, galima keisti
  24. {
  25. if(cmdtext[6]==0){SendClientMessage(playerid, WHITE, "Atsiteleportuoti žaideja pas save: {FF0000}/get{00FF00} Dalis vardo"); return 1;} //Jeigu neteisingai parasai komanda
  26. new vardas[MAX_PLAYER_NAME]; //sukuria new'a
  27. strmid(vardas,cmdtext[5],0,MAX_PLAYER_NAME);
  28. new id = GetPlayeridMid(vardas);
  29. if (playerDB[id][ikalintas]) {SendClientMessage(playerid, RED, "Žaidejas kalejime"); return 1;} //tikrina ar zaidejas kaleime, jei taip tai jis negales /get
  30. playerDB[playerid][rid][0]=id;
  31. sekimas[playerid] = SetTimerEx("Seku", 200, true, "e", playerid);
  32. TextDrawShowForPlayer( playerid, SEKTI);
  33. }
  34. return 1;
  35. }
  36. return 1;
  37. }
  38. public OnPlayerEnterCheckpoint(playerid)
  39. {
  40. if(lokuoja[playerid])
  41. {
  42. new Zaidejas = playerDB[playerid][rid][0];
  43. new vardas[MAX_PLAYER_NAME];
  44. GetPlayerName(Zaidejas,vardas,sizeof(vardas));
  45. new msg[100];
  46. format(msg,sizeof(msg),"Atvykai pas þaidëjà %s ",vardas);
  47. SendClientMessage(playerid,RAUDONA,msg);
  48. KillTimer( sekimas[ playerid ] );
  49. playerDB[playerid][rid][0]=0;
  50. TextDrawHideForPlayer( playerid, SEKTI);
  51. }
  52. return 1;
  53. }
  54. forward Seku(playerid);
  55. public Seku(playerid)
  56. {
  57. new
  58. Zaidejas = playerDB[playerid][rid][0],
  59. Distancija = GetDistanceBetweenPlayers( playerid, Zaidejas ),
  60. String [ 100 ],
  61. Float:Coo[ 3 ]
  62. ;
  63.  
  64. /*
  65. - Gauname Žaidėjo pozicija
  66. - Nustatome CP vietą
  67. */
  68. lokuoja[playerid] = true;
  69. GetPlayerPos ( Zaidejas, Coo[ 0 ], Coo[ 1 ], Coo[ 2 ] );
  70. SetPlayerCheckpoint( playerid, Coo[ 0 ], Coo[ 1 ], Coo[ 2 ], 5 );
  71.  
  72.  
  73. /*
  74. - Formatuojame Žinute
  75. */
  76.  
  77. format ( String, sizeof( String ), "Sekimas : %s~n~%dmetrai" ,pName( Zaidejas ) , Distancija );
  78. TextDrawSetString( SEKTI,String );
  79.  
  80. /*
  81. - Rodome Textdrawus
  82. */
  83.  
  84. TextDrawShowForPlayer( playerid, SEKTI);
  85.  
  86. return true;
  87. }
  88. stock GetDistanceBetweenPlayers( playerid, giveplayerid )
  89. {
  90. new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
  91. GetPlayerPos(playerid, x1, y1, z1);
  92. GetPlayerPos(giveplayerid, x2, y2, z2);
  93. return floatround(floatsqroot(floatpower(floatabs(floatsub(x2,x1)), 2) + floatpower(floatabs(floatsub(y2,y1)),2) + floatpower(floatabs(floatsub(z2,z1)) ,2)));
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement