Author Topic: [FIXED] PSA ERROR FILTERSCRIPT AND BASIC BY ME AND BLACKPANTHER  (Read 2237 times)

0 Members and 1 Guest are viewing this topic.

Offline mrockxkingbutt

  • Crime Boss
  • ****
  • Posts: 373
  • I AM Best Scripter And You Are Not :P
    • View Profile
[FIXED] PSA ERROR FILTERSCRIPT AND BASIC BY ME AND BLACKPANTHER
« on: February 22, 2013, 07:45:42 am »
[pawn]#include <a_vcmp>
#define COLOR_GREY 0xAFAFAFAA
//------------------------------------------------------------------------------------------------------

main()
{
   print("\n  ----------------------------------\n");
   printf("    PSA Filterscript\n");
   printf("    \tby [TDH]Boss\n");
   print("  ----------------------------------\n");
}

//------------------------------------------------------------------------------------------------------

public OnFilterScriptInit()
{
   SetTimer("PSAtimer",100,1); // PSA timer activation.
   return 1;
}

//------------------------------------------------------------------------------------------------------

public OnFilterScriptExit()
{
}

//------------------------------------------------------------------------------------------------------

public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,GetNick(playerid),MAX_PLAYER_NAME);
   new str[256];
   format(str,256,"3[%d] %s joined the server.",playerid,GetNick(playerid));
    SendToIRC(str);
   return 1;
}

//------------------------------------------------------------------------------------------------------

public OnPlayerDisconnect(playerid, reason)
{
   new str[256];
   format(str,256,"3[%d] %s left the server.",playerid,GetNick(playerid));
    SendToIRC(str);
   return 1;
}

//------------------------------------------------------------------------------------------------------

public OnPlayerDeath(playerid, killerid, reason, bodypart)
{
   new str[256];
   if(killerid == INVALID_PLAYER_ID) format(str,256,"4[%d] %s died",playerid,GetNick(playerid));
   else format(str,256,"4[%d] %s killed [%d] %s (%s)",killerid,GetNick(killerid),playerid,GetNick(playerid),GetWeapon(reason));
   SendToIRC(str);
    return 1;
}

//------------------------------------------------------------------------------------------------------

public OnPlayerText(playerid, cmdtext[])
{
   new str[256];
   format(str,256,"2[%d]7 %s:1 %s",playerid,GetNick(playerid),cmdtext);
    SendToIRC(str);
   return 1;
}

//------------------------------------------------------------------------------------------------------

/*public OnPlayerTextMe(playerid, cmdtext[])
{
   new str[256];
   format(str,256,"6[%d]6 %s6 %s",playerid,GetNick(playerid),cmdtext);
    SendToIRC(str);
   return 1;
}*/

//------------------------------------------------------------------------------------------------------

PerformSQLquery(str[]) // PSA function for performing queries.
{
   new File: file;
   file = fopen("sql_input.psa");
   fwrite(file,str);
   fclose(file);
   return false;
}

//------------------------------------------------------------------------------------------------------

PerformSQLquerySelect(qid[], str[]) // PSA function for performing "select" queries.
{
   format(str,sizeof(str),"%d %s",qid,str);
   new File: file;
   file = fopen("sql_input.psa");
   fwrite(file,str);
   fclose(file);
   return false;
}

//------------------------------------------------------------------------------------------------------

OnQueryResult(qid[], str[]){ // Function for outputting "select" queries results. qid is the one from PerformSQLquerySelect.
   printf("Received query %s: %s",qid,str);
}

//------------------------------------------------------------------------------------------------------

SendToIRC(str[]) // PSA function for sending things to IRC.
{
   new File: file;
   file = fopen("irc_input.psa");
   fwrite(file,str);
   fclose(file);
   return false;
}

//------------------------------------------------------------------------------------------------------

public PSAtimer() // PSA timer for reading things from IRC.
{
   new cont[1024], str[256], File: file;
   if(fexist("irc_output.psa")){
      file = fopen("irc_output.psa");
      fread(file,cont,sizeof(cont));
      fclose(file);
      while(strfind(cont,"\n")>0){
          strmid(str,cont,0,strfind(cont,"\n"));
          strdel(cont,0,strfind(cont,"\n"));
         SendClientMessageToAll(COLOR_GREY,str);
         print(str);
      }
      fremove("irc_output.psa");
   }
   if(fexist("sql_output.psa")){
      new qid[256];
      file = fopen("sql_output.psa");
      fread(file,cont,sizeof(cont));
      fclose(file);
      while(strfind(cont,"\n")>0){
          strmid(str,cont,0,strfind(cont,"\n"));
          strdel(cont,0,strfind(cont,"\n"));
          new space = strfind(qid," ");
          strmid(qid,str,0,space);
          strdel(str,0,space);
         OnQueryResult(qid,str);
         //SendClientMessageToAll(COLOR_GREY,str);
         //print(str);
      }
      fremove("sql_output.psa");
   }
}
forward PSAtimer();

//------------------------------------------------------------------------------------------------------

GetNick(playerid)
{
   new Nick[MAX_PLAYER_NAME];
   if(IsPlayerConnected(playerid)) GetPlayerName(playerid,Nick,sizeof(Nick));
   else format(Nick,sizeof(Nick),"0");
   return Nick;
}

//------------------------------------------------------------------------------------------------------

GetWeapon(weaponid)
{
   new Wep[MAX_PLAYER_NAME];
   GetWeaponName(weaponid,Wep,sizeof(Wep));
   return Wep;
}
#pragma unused PerformSQLquerySelect
#pragma unused PerformSQLquery[/pawn]
this is a fixed filterscript you can you this as filterscript or as you can add this in your script
My Servers Showroom!
www.jimxvcmpscripts.createaforum.com/

Quote from:  rohanaj60
i m a great script Editor

Rofl! lmao lol