Advertisement
Guest User

First Person [sa-mp]

a guest
May 14th, 2010
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.88 KB | None | 0 0
  1. #include <a_samp>
  2. new Flood[MAX_PLAYERS];
  3. new Answer[MAX_PLAYERS][10];
  4. new ChatText[MAX_PLAYERS][256];
  5. new bool:DialogPower[MAX_PLAYERS];
  6. public OnFilterScriptInit(){
  7. for(new i=0; i<MAX_PLAYERS; i++)
  8. if(IsPlayerConnected(i)&&!IsPlayerNPC(i))
  9. Flood[i]=GetTickCount()+1000;
  10. return 1;}
  11.  
  12. public OnPlayerText(playerid, text[]){
  13. if(DialogPower[playerid]) return 0;
  14. if(Flood[playerid]+1000>GetTickCount()){
  15. new str[256];
  16. format(Answer[playerid],10,"%c%c%c%c",mathrandom(65,90),mathrandom(65,90),mathrandom(65,90),mathrandom(65,90));
  17. format(str, 256, "Ââåäèòå êîä %s: ", Answer[playerid]);
  18. format(ChatText[playerid], 256, "%s", text);
  19. ShowPlayerDialog(playerid, 99, DIALOG_STYLE_INPUT, "Captcha", str, "Ââåñòè", "Êèêíóòüñÿ");
  20. DialogPower[playerid]=true;
  21. return 0;}
  22. Flood[playerid]=GetTickCount();
  23. return 1;}
  24.  
  25. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  26. if(dialogid==99) if(response){
  27. if(!strcmp(inputtext, Answer[playerid])){
  28. SendPlayerMessageToAll(playerid, ChatText[playerid]);
  29. Flood[playerid]=GetTickCount();
  30. DialogPower[playerid]=false;}
  31. else{
  32. DialogPower[playerid]=true;
  33. format(Answer[playerid],10,"%c%c%c%c",mathrandom(65,90),mathrandom(65,90),mathrandom(65,90),mathrandom(65,90));
  34. new str[256]; format(str, 256, "Ââåäèòå êîä %s: ", Answer[playerid]);
  35. ShowPlayerDialog(playerid, 99, DIALOG_STYLE_INPUT, "Captcha", str, "Ââåñòè", "Ïîëó÷èòü äðóãóþ");}
  36. }else{
  37. DialogPower[playerid]=true;
  38. format(Answer[playerid],10,"%c%c%c%c",mathrandom(65,90),mathrandom(65,90),mathrandom(65,90),mathrandom(65,90));
  39. new str[256]; format(str, 256, "Ââåäèòå êîä %s: ", Answer[playerid]);
  40. ShowPlayerDialog(playerid, 99, DIALOG_STYLE_INPUT, "Captcha", str, "Ââåñòè", "Ïîëó÷èòü äðóãóþ");}
  41. return 1;}
  42.  
  43. stock mathrandom(min,max) {
  44. new g=random(max);
  45. while(g<min) g=random(max);
  46. return g;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement